mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 18:48:11 +00:00
booking operations and trains scheduling also allocations
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { BaseEntity } from '@edr/api-common';
|
||||
import { TrainScheduleStatus as TrainScheduleStatusEnum } from '@edr/types';
|
||||
import { Column, Entity, Index, JoinColumn, ManyToOne, OneToMany, OneToOne } from 'typeorm';
|
||||
|
||||
import { Yard } from '../../rule-engine/entities/yard.entity';
|
||||
@@ -7,11 +8,11 @@ import { TrainSet } from '../../train-sets/entities/train-set.entity';
|
||||
import { TrainScheduleBooking } from './train-schedule-booking.entity';
|
||||
|
||||
export const TRAIN_SCHEDULE_STATUSES = [
|
||||
'DRAFT',
|
||||
'SCHEDULED',
|
||||
'DISPATCHED',
|
||||
'ARRIVED',
|
||||
'CANCELLED',
|
||||
TrainScheduleStatusEnum.Draft,
|
||||
TrainScheduleStatusEnum.Scheduled,
|
||||
TrainScheduleStatusEnum.Dispatched,
|
||||
TrainScheduleStatusEnum.Arrived,
|
||||
TrainScheduleStatusEnum.Cancelled,
|
||||
] as const;
|
||||
|
||||
export type TrainScheduleStatus = (typeof TRAIN_SCHEDULE_STATUSES)[number];
|
||||
@@ -57,6 +58,27 @@ export class TrainSchedule extends BaseEntity {
|
||||
@Column({ name: 'status', type: 'varchar', length: 20, default: 'DRAFT' })
|
||||
status!: TrainScheduleStatus;
|
||||
|
||||
@Column({ name: 'train_number', type: 'varchar', length: 20, nullable: true })
|
||||
trainNumber?: string | null;
|
||||
|
||||
@Column({ name: 'direction', type: 'varchar', length: 10, nullable: true })
|
||||
direction?: string | null;
|
||||
|
||||
@Column({ name: 'actual_departure_at', type: 'timestamptz', nullable: true })
|
||||
actualDepartureAt?: Date | null;
|
||||
|
||||
@Column({ name: 'actual_arrival_at', type: 'timestamptz', nullable: true })
|
||||
actualArrivalAt?: Date | null;
|
||||
|
||||
@Column({ name: 'prepared_by_user_id', type: 'uuid', nullable: true })
|
||||
preparedByUserId?: string | null;
|
||||
|
||||
@Column({ name: 'checked_by_user_id', type: 'uuid', nullable: true })
|
||||
checkedByUserId?: string | null;
|
||||
|
||||
@Column({ name: 'max_wagons', type: 'int', default: 53 })
|
||||
maxWagons!: number;
|
||||
|
||||
@OneToMany(() => TrainScheduleBooking, (scheduleBooking) => scheduleBooking.trainSchedule)
|
||||
scheduleBookings?: TrainScheduleBooking[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user