Merge pull request #1096 from Tria-plc/freight_feature/usermanagement

Freight feature/usermanagement
This commit is contained in:
marshal
2026-08-03 22:53:30 +03:00
committed by GitHub
21 changed files with 615 additions and 28 deletions

View File

@@ -0,0 +1,25 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
/**
* PER_TON (bulk) cargo can have a loading limit BELOW the wagon's rated
* capacity: sugar rides 50T on a 70T wagon (density/stowage/policy), so 200T
* needs 4 wagons, not the 3 that raw capacity implies. Stored as a jsonb map
* { [wagonTypeId]: maxTons } on cargo_types — the PER_TON mirror of
* items_per_wagon_map. Unset (or no key) means the wagon's full rated capacity,
* so existing cargo types keep their current behaviour with no backfill.
*/
export class AddCargoTypeTonsPerWagonMap3190000000000 implements MigrationInterface {
name = 'AddCargoTypeTonsPerWagonMap3190000000000';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "freight"."cargo_types" ADD COLUMN IF NOT EXISTS "tons_per_wagon_map" jsonb`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "freight"."cargo_types" DROP COLUMN IF EXISTS "tons_per_wagon_map"`,
);
}
}