mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 07:38:10 +00:00
fix build num
This commit is contained in:
35
apps/edr-freight-web/backoffice/src/constants/trainRuns.ts
Normal file
35
apps/edr-freight-web/backoffice/src/constants/trainRuns.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* EDR run-number pairs, keyed by the odd EXPORT run (Ethiopia → Djibouti). The
|
||||
* even IMPORT run (Djibouti → Ethiopia) is fixed by the export run, so choosing
|
||||
* an export number fully determines the import one.
|
||||
*
|
||||
* Run numbers are always 4 digits (8401, never 84001). Pairs are listed out
|
||||
* rather than computed from the 8001/+100/+1 pattern, so a run that ever breaks
|
||||
* the convention stays correct here.
|
||||
*
|
||||
* Mirrors RUN_WAGONS/IMPORT_RUN in the API's SeedWagonRunNumbers migration —
|
||||
* keep the two in sync when runs are added or retired.
|
||||
*/
|
||||
export const TRAIN_RUN_PAIRS: Record<string, string> = {
|
||||
"8001": "8002",
|
||||
"8101": "8102",
|
||||
"8201": "8202",
|
||||
"8301": "8302",
|
||||
"8401": "8402",
|
||||
"8501": "8502",
|
||||
"8601": "8602",
|
||||
"8701": "8702",
|
||||
"8801": "8802",
|
||||
"8901": "8902",
|
||||
"9001": "9002",
|
||||
};
|
||||
|
||||
/** Selectable export runs, in run order. */
|
||||
export const EXPORT_TRAIN_OPTIONS = Object.keys(TRAIN_RUN_PAIRS).map((run) => ({
|
||||
label: run,
|
||||
value: run,
|
||||
}));
|
||||
|
||||
/** The import run implied by an export run; empty string when unset/unknown. */
|
||||
export const importRunFor = (exportRun: unknown): string =>
|
||||
TRAIN_RUN_PAIRS[String(exportRun ?? "")] ?? "";
|
||||
Reference in New Issue
Block a user