import { BaseEntity } from '@edr/api-common'; import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm'; import { Booking } from './booking.entity'; import { Vehicle } from '../../vehicles/entities/vehicle.entity'; @Entity({ schema: 'freight', name: 'booking_container_allocations' }) @Index(['bookingId']) @Index(['vehicleId']) export class BookingContainerAllocation extends BaseEntity { @ManyToOne(() => Booking, (b) => b.containerAllocations) @JoinColumn({ name: 'booking_id' }) booking!: Booking; @Column('uuid', { name: 'booking_id' }) bookingId!: string; @Column('uuid', { name: 'container_id' }) containerId!: string; @ManyToOne(() => Vehicle) @JoinColumn({ name: 'vehicle_id' }) vehicle!: Vehicle; @Column('uuid', { name: 'vehicle_id', nullable: true }) vehicleId?: string; @Column('text') containerType!: string; // CONTAINER, BULK_DRY, etc @Column('integer', { default: 1 }) quantity!: number; }