Files
edr-platform/apps/edr-freight-api/src/modules/bookings/entities/booking-container-allocation.entity.ts
natib21 6fa315db0f fix
2026-06-29 14:45:22 +00:00

33 lines
959 B
TypeScript

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;
}