mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 05:18:11 +00:00
33 lines
990 B
TypeScript
33 lines
990 B
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
import { LastMile } from './last-mile.entity';
|
|
import { Vehicle } from '../../vehicles/entities/vehicle.entity';
|
|
|
|
@Entity({ schema: 'freight', name: 'last_mile_container_allocations' })
|
|
@Index(['lastMileId'])
|
|
@Index(['vehicleId'])
|
|
export class LastMileContainerAllocation extends BaseEntity {
|
|
@ManyToOne(() => LastMile, (lm) => lm.containerAllocations)
|
|
@JoinColumn({ name: 'last_mile_id' })
|
|
lastMile!: LastMile;
|
|
|
|
@Column('uuid', { name: 'last_mile_id' })
|
|
lastMileId!: string;
|
|
|
|
@Column('uuid', { name: 'container_id' })
|
|
containerId!: string;
|
|
|
|
@ManyToOne(() => Vehicle)
|
|
@JoinColumn({ name: 'vehicle_id' })
|
|
vehicle?: Vehicle | null;
|
|
|
|
@Column('uuid', { name: 'vehicle_id', nullable: true })
|
|
vehicleId?: string | null;
|
|
|
|
@Column('text', { name: 'container_type' })
|
|
containerType!: string;
|
|
|
|
@Column('integer', { default: 1 })
|
|
quantity!: number;
|
|
}
|