mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 22:58:17 +00:00
feat(warehouse): batch 3 — loading, dispatch & train-departure visibility
- WarehouseLoading entity + Batch3 migration (wagon loading records) - wagon-aware load() with validation; dispatch moved to PATCH - read-only SchedulingReadFacade (schedule/wagon/departure) — never writes scheduling - new endpoints: GET /warehouse-loadings, loadable-wagons, booking schedule - Loading Queue / Loaded Inventory / Dispatch Queue pages + routes + sidebar - FreightVisual illustrations (page heroes + empty states) - booking detail: loaded/dispatched/wagon + read-only train schedule Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { BaseEntity } from '@edr/api-common';
|
||||
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
||||
|
||||
import { Booking } from '../../bookings/entities/booking.entity';
|
||||
import { WarehouseInventory } from './warehouse-inventory.entity';
|
||||
|
||||
/**
|
||||
* Batch 3 — a record that a warehouse inventory item was physically loaded onto a wagon.
|
||||
* The warehouse OWNS this record. It only READS wagon/schedule data from the scheduling
|
||||
* domain (via SchedulingReadFacade); it never writes to wagons or train schedules.
|
||||
*/
|
||||
@Entity({ schema: 'freight', name: 'warehouse_loadings' })
|
||||
@Index(['warehouseInventoryId'])
|
||||
@Index(['bookingId'])
|
||||
@Index(['wagonId'])
|
||||
export class WarehouseLoading extends BaseEntity {
|
||||
@Column({ name: 'warehouse_inventory_id', type: 'uuid' })
|
||||
warehouseInventoryId!: string;
|
||||
|
||||
@ManyToOne(() => WarehouseInventory)
|
||||
@JoinColumn({ name: 'warehouse_inventory_id' })
|
||||
inventory?: WarehouseInventory;
|
||||
|
||||
@Column({ name: 'booking_id', type: 'uuid', nullable: true })
|
||||
bookingId?: string | null;
|
||||
|
||||
@ManyToOne(() => Booking, { nullable: true })
|
||||
@JoinColumn({ name: 'booking_id' })
|
||||
booking?: Booking | null;
|
||||
|
||||
/** Physical wagon the item was loaded onto. References freight.wagons (read-only link). */
|
||||
@Column({ name: 'wagon_id', type: 'uuid' })
|
||||
wagonId!: string;
|
||||
|
||||
@Column({ name: 'loaded_at', type: 'timestamptz' })
|
||||
loadedAt!: Date;
|
||||
|
||||
@Column({ name: 'loaded_by', type: 'varchar', length: 120, nullable: true })
|
||||
loadedBy?: string | null;
|
||||
|
||||
@Column({ name: 'loaded_weight', type: 'numeric', precision: 14, scale: 3, nullable: true })
|
||||
loadedWeight?: number | null;
|
||||
|
||||
@Column({ name: 'notes', type: 'text', nullable: true })
|
||||
notes?: string | null;
|
||||
}
|
||||
Reference in New Issue
Block a user