mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 09:58:12 +00:00
- Introduced DEACTIVATED status for trains, allowing staff to park trains indefinitely. - Implemented methods to deactivate and reactivate trains in the TrainBuilderService. - Added UI components for train deactivation and reactivation in TrainBuilderDetailPage. - Created a dropdown setting for admin-managed import train numbers, with corresponding migrations. - Updated yard code length to accommodate soft-delete suffix. - Enhanced train status handling to include DEACTIVATED state.
24 lines
878 B
TypeScript
24 lines
878 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
/**
|
|
* New built-train lifecycle status DEACTIVATED: staff park a train indefinitely
|
|
* (only allowed while it has no DRAFT/SCHEDULED/DISPATCHED schedule). Like
|
|
* UNDER_MAINTENANCE / OUT_OF_SERVICE it is staff-owned — the scheduler never
|
|
* overwrites it and refuses to schedule a deactivated train.
|
|
*
|
|
* Postgres cannot drop an enum value, so down() is a no-op.
|
|
*/
|
|
export class AddTrainDeactivatedStatus2380000000000 implements MigrationInterface {
|
|
name = 'AddTrainDeactivatedStatus2380000000000';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(
|
|
`ALTER TYPE "freight"."train_status" ADD VALUE IF NOT EXISTS 'DEACTIVATED'`,
|
|
);
|
|
}
|
|
|
|
public async down(): Promise<void> {
|
|
// Enum values cannot be removed in Postgres; leaving the label is harmless.
|
|
}
|
|
}
|