Train scheduling API,Routes and UI

This commit is contained in:
hagiye
2026-06-08 16:31:28 +03:00
parent 3d1f972e52
commit 7facbeda22
38 changed files with 1993 additions and 696 deletions

View File

@@ -3,6 +3,8 @@ import { Entity, Column, ManyToOne, OneToMany, JoinColumn } from 'typeorm';
import { BaseEntity } from '@edr/api-common';
import { Train } from '../../trains/entities/train.entity';
import { Container } from '../../container-management/entities/container.entity';
import { Yard } from '../../rule-engine/entities/yard.entity';
import { WagonType } from '../../wagon-types/entities/wagon-type.entity';
@Entity({ name: 'wagons', schema: 'freight' })
export class Wagon extends BaseEntity {
@@ -12,12 +14,23 @@ export class Wagon extends BaseEntity {
@Column({ name: 'wagon_type_id', type: 'uuid' })
wagonTypeId!: string;
@ManyToOne(() => WagonType, { onDelete: 'RESTRICT' })
@JoinColumn({ name: 'wagon_type_id' })
wagonType?: WagonType;
@Column({ name: 'train_id', type: 'uuid', nullable: true })
trainId!: string | null;
@Column({ name: 'sequence_number', type: 'int', nullable: true })
sequenceNumber!: number | null;
@Column({ name: 'current_location_yard_id', type: 'uuid', nullable: true })
currentLocationYardId!: string | null;
@ManyToOne(() => Yard, { nullable: true, onDelete: 'SET NULL' })
@JoinColumn({ name: 'current_location_yard_id' })
currentLocationYard?: Yard | null;
@Column({ name: 'tare_weight', type: 'decimal', precision: 10, scale: 2 })
tareWeight!: number;
@@ -25,7 +38,7 @@ export class Wagon extends BaseEntity {
maxPayloadWeight!: number;
@Column({ type: 'varchar', default: 'AVAILABLE' })
status!: string; // AVAILABLE, ASSIGNED, MAINTENANCE, RETIRED
status!: string; // AVAILABLE, IMPORT_READY, EXPORT_READY, ASSIGNED, MAINTENANCE, RETIRED
@Column({ type: 'text', nullable: true })
notes!: string | null;
@@ -38,4 +51,4 @@ export class Wagon extends BaseEntity {
// Relationship to Container
@OneToMany(() => Container, (container) => container.wagon)
containers!: Container[];
}
}