mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
Intercity cargo is loaded at its origin yard and unloaded at its destination, but
only some yards have the equipment. EDR's facilities are Indode, Sebeta, Modjo,
Adama and Dire Dawa — and the set grows, so it has to be data.
- yards.has_facility marks a yard as a load/unload point; the new yard_facilities
record says what it can do. Only Indode stores cargo (has_warehouse), so only it
accrues storage/demurrage — the rest just move cargo on and off the train.
- facility_handling_events records each load/unload and carries its GRN.
warehouse_inventory cannot: its warehouse/yard/zone are NOT NULL, so a facility
without a warehouse could never have a row. inventory_id links to the storage
record when there is one.
- YardFacilitiesService.facilityForYard is the single resolver the handling flows
share, so they cannot drift on what a facility is.
- The seeder flags EXISTING yards and creates none. The codes are historical and
do not read like the facility names — Indode is KALITY ("Gelan Multi Purpose
Port (Indode)") and Sebeta is LEGACY_DEST — so it maps by code. Creating fresh
INDODE/SEBETA yards would have split data that routes and bookings already
reference.
Negad is deliberately absent: NAGAD ("DCT/SGDT") is in Djibouti while
NEGAD_FY_BCC is in Ethiopia and inactive, and which one is the intercity facility
is unsettled.
No behaviour change yet — nothing reads has_facility until the gate lands.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { YardCountry } from '@edr/types';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { IsBoolean, IsEnum, IsInt, IsOptional, IsUUID, MaxLength, Min, IsString } from 'class-validator';
|
|
|
|
export class CreateYardDto {
|
|
@ApiProperty({ description: 'Customer-facing yard label', maxLength: 100 })
|
|
@IsString()
|
|
@MaxLength(100)
|
|
label!: string;
|
|
|
|
@ApiProperty({ enum: YardCountry, description: 'Country where the yard is located' })
|
|
@IsEnum(YardCountry)
|
|
country!: YardCountry;
|
|
|
|
@ApiPropertyOptional({ default: true })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isActive?: boolean;
|
|
|
|
@ApiPropertyOptional({
|
|
default: false,
|
|
description:
|
|
'This yard can load/unload cargo. Intercity bookings may only be loaded at their origin and unloaded at their destination when it is a facility.',
|
|
})
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
hasFacility?: boolean;
|
|
|
|
@ApiPropertyOptional({ default: 1, description: 'UI display sort order' })
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
displayOrder?: number;
|
|
|
|
@ApiPropertyOptional({ description: 'Insert after this record ID' })
|
|
@IsOptional()
|
|
@IsUUID('4')
|
|
insertAfterId?: string;
|
|
}
|