feat: add per-ton cargo loading limits and update related services

This commit is contained in:
Marshal
2026-08-03 19:16:28 +00:00
parent 9afc281d21
commit 488c2465be
14 changed files with 394 additions and 21 deletions

View File

@@ -60,6 +60,17 @@ export class CargoType extends BaseEntity {
@Column({ name: 'items_per_wagon_map', type: 'jsonb', nullable: true })
itemsPerWagonMap?: Record<string, number> | null;
/**
* PER_TON (bulk) only: the most tons of THIS cargo that may ride one wagon of
* each allowed type, keyed by wagon-type id (e.g. sugar → { NW5: 50 } on a
* 70T wagon). Caps both the wagon count and how much each wagon is loaded, so
* 200T of sugar takes 4 wagons at 50T rather than 3 at 70T. A missing key (or
* a null map) means the wagon's full rated capacity — unlike itemsPerWagonMap
* this is optional, so cargo without a loading limit is unaffected.
*/
@Column({ name: 'tons_per_wagon_map', type: 'jsonb', nullable: true })
tonsPerWagonMap?: Record<string, number> | null;
@Column({ name: 'requires_director_approval', type: 'boolean', default: false })
requiresDirectorApproval!: boolean;