Project Initialization

This commit is contained in:
Muluhabt
2026-05-12 15:17:16 +03:00
parent 33fa742e8a
commit 3b8b6979db
259 changed files with 15962 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
{
"name": "@edr/types",
"version": "0.0.0",
"private": true,
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
".": "./src/index.ts",
"./common": "./src/common/index.ts",
"./freight": "./src/freight/index.ts",
"./passenger": "./src/passenger/index.ts"
},
"scripts": {
"type-check": "tsc --noEmit",
"lint": "eslint src"
},
"devDependencies": {
"@edr/eslint-config": "workspace:*",
"@edr/tsconfig": "workspace:*",
"typescript": "^5.5.4"
}
}

View File

@@ -0,0 +1,34 @@
export interface BaseEntity {
id: string;
createdAt: string;
updatedAt: string;
deletedAt?: string | null;
}
export interface ApiResponse<T> {
success: boolean;
data: T;
message?: string;
timestamp: string;
}
export interface PaginationMeta {
page: number;
pageSize: number;
total: number;
totalPages: number;
hasNextPage: boolean;
hasPreviousPage: boolean;
}
export interface PaginatedResponse<T> {
items: T[];
meta: PaginationMeta;
}
export interface PaginationQuery {
page?: number;
pageSize?: number;
sortBy?: string;
sortOrder?: 'ASC' | 'DESC';
}

View File

@@ -0,0 +1,96 @@
import type { BaseEntity } from '../common';
export enum BookingStatus {
Draft = 'DRAFT',
Confirmed = 'CONFIRMED',
InTransit = 'IN_TRANSIT',
Delivered = 'DELIVERED',
Cancelled = 'CANCELLED',
}
export enum ConsignmentStatus {
Pending = 'PENDING',
Loaded = 'LOADED',
InTransit = 'IN_TRANSIT',
AtDestination = 'AT_DESTINATION',
Delivered = 'DELIVERED',
Returned = 'RETURNED',
}
export enum TrainStatus {
Available = 'AVAILABLE',
Scheduled = 'SCHEDULED',
InService = 'IN_SERVICE',
UnderMaintenance = 'UNDER_MAINTENANCE',
OutOfService = 'OUT_OF_SERVICE',
}
export enum CargoType {
Container = 'CONTAINER',
BulkLiquid = 'BULK_LIQUID',
BulkDry = 'BULK_DRY',
General = 'GENERAL',
Refrigerated = 'REFRIGERATED',
Hazardous = 'HAZARDOUS',
}
export enum PaymentStatus {
Pending = 'PENDING',
Paid = 'PAID',
Overdue = 'OVERDUE',
Cancelled = 'CANCELLED',
Refunded = 'REFUNDED',
}
export interface ICustomer extends BaseEntity {
name: string;
email: string;
phone: string;
address?: string;
taxId?: string;
}
export interface ITrain extends BaseEntity {
code: string;
capacityTons: number;
status: TrainStatus;
notes?: string;
}
export interface ITrackingEvent extends BaseEntity {
consignmentId: string;
location: string;
status: ConsignmentStatus;
occurredAt: string;
description?: string;
}
export interface IConsignment extends BaseEntity {
bookingId: string;
trackingNumber: string;
cargoType: CargoType;
weightKg: number;
status: ConsignmentStatus;
originStation: string;
destinationStation: string;
}
export interface IBooking extends BaseEntity {
reference: string;
customerId: string;
trainId?: string;
status: BookingStatus;
scheduledDate: string;
totalAmount: number;
paymentStatus: PaymentStatus;
}
export interface IInvoice extends BaseEntity {
bookingId: string;
invoiceNumber: string;
amount: number;
currency: string;
status: PaymentStatus;
issuedAt: string;
dueAt: string;
}

View File

@@ -0,0 +1,3 @@
export * from './common';
export * as Freight from './freight';
export * as Passenger from './passenger';

View File

@@ -0,0 +1,95 @@
import type { BaseEntity } from '../common';
export enum TicketStatus {
Reserved = 'RESERVED',
Confirmed = 'CONFIRMED',
CheckedIn = 'CHECKED_IN',
Cancelled = 'CANCELLED',
Refunded = 'REFUNDED',
Expired = 'EXPIRED',
}
export enum SeatClass {
Economy = 'ECONOMY',
Business = 'BUSINESS',
First = 'FIRST',
Sleeper = 'SLEEPER',
}
export enum SeatStatus {
Available = 'AVAILABLE',
Reserved = 'RESERVED',
Occupied = 'OCCUPIED',
Blocked = 'BLOCKED',
}
export enum ScheduleStatus {
Scheduled = 'SCHEDULED',
Boarding = 'BOARDING',
Departed = 'DEPARTED',
Arrived = 'ARRIVED',
Cancelled = 'CANCELLED',
Delayed = 'DELAYED',
}
export enum PaymentStatus {
Pending = 'PENDING',
Paid = 'PAID',
Failed = 'FAILED',
Refunded = 'REFUNDED',
}
export interface IStation extends BaseEntity {
code: string;
name: string;
city: string;
country: string;
latitude?: number;
longitude?: number;
}
export interface ISchedule extends BaseEntity {
trainCode: string;
originStationId: string;
destinationStationId: string;
departureTime: string;
arrivalTime: string;
status: ScheduleStatus;
basePrice: number;
}
export interface ISeat extends BaseEntity {
scheduleId: string;
seatNumber: string;
seatClass: SeatClass;
status: SeatStatus;
price: number;
}
export interface IPassenger extends BaseEntity {
fullName: string;
email: string;
phone: string;
nationalId?: string;
dateOfBirth?: string;
}
export interface ITicket extends BaseEntity {
reference: string;
passengerId: string;
scheduleId: string;
seatId: string;
status: TicketStatus;
pricePaid: number;
issuedAt: string;
}
export interface IPayment extends BaseEntity {
ticketId: string;
amount: number;
currency: string;
status: PaymentStatus;
provider: string;
providerTransactionId?: string;
paidAt?: string;
}

View File

@@ -0,0 +1,9 @@
{
"extends": "@edr/tsconfig/base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"noEmit": true
},
"include": ["src"]
}