mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 16:00:56 +00:00
booking operations and trains scheduling also allocations
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
// apps/edr-freight-api/src/modules/container-management/entities/container.entity.ts
|
||||
import { Entity, Column, ManyToOne, OneToMany, JoinColumn } from 'typeorm';
|
||||
import { BaseEntity } from '@edr/api-common';
|
||||
import { Booking } from '../../bookings/entities/booking.entity';
|
||||
import { BookingContainer } from '../../bookings/entities/booking-container.entity';
|
||||
import { WagonBookingAllocation } from '../../train-schedules/entities/wagon-booking-allocation.entity';
|
||||
import { Wagon } from '../../wagons/entities/wagon.entity';
|
||||
import { Cargo } from '../../cargoes/entities/cargoes.entity';
|
||||
|
||||
@@ -34,7 +37,27 @@ sealNumber!: string | null;
|
||||
@Column({ type: 'varchar', default: 'AVAILABLE' })
|
||||
status!: string; // AVAILABLE, LOADED, IN_TRANSIT, MAINTENANCE, DAMAGED
|
||||
|
||||
// Relationship to Wagon
|
||||
@Column({ name: 'booking_id', type: 'uuid', nullable: true })
|
||||
bookingId!: string | null;
|
||||
|
||||
@ManyToOne(() => Booking, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'booking_id' })
|
||||
booking?: Booking | null;
|
||||
|
||||
@Column({ name: 'wagon_booking_allocation_id', type: 'uuid', nullable: true })
|
||||
wagonBookingAllocationId!: string | null;
|
||||
|
||||
@ManyToOne(() => WagonBookingAllocation, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'wagon_booking_allocation_id' })
|
||||
wagonBookingAllocation?: WagonBookingAllocation | null;
|
||||
|
||||
@Column({ name: 'booking_container_id', type: 'uuid', nullable: true })
|
||||
bookingContainerId!: string | null;
|
||||
|
||||
@ManyToOne(() => BookingContainer, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'booking_container_id' })
|
||||
bookingContainer?: BookingContainer | null;
|
||||
|
||||
@ManyToOne(() => Wagon, (wagon) => wagon.containers, { onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'wagon_id' })
|
||||
wagon!: Wagon | null;
|
||||
|
||||
Reference in New Issue
Block a user