Files
edr-platform/apps/edr-freight-api/src/migrations/1826000000000-AddCargoScopeQuantityCap.ts
Marshal 11c7f1bb74 add quantity cap for GENERAL contracts and implement capacity tracking
- Updated ContractClearanceService and ContractsController to remove region parameter from queue method.
- Enhanced ContractsRepository to attach contract files for download and added attachContractFiles method.
- Modified ContractsService to persist cargo scope with quantity cap based on contract kind.
- Introduced quantityCap field in CreateContractCargoScopeDto and ContractCargoScope entity.
- Implemented capacity tracking in the frontend with ContractCapacityNotice component to display remaining bookable quantities.
- Updated various components and services to support new capacity features, including hooks and API calls.
- Added migration to include quantity_cap column in contract_cargo_scope table.
2026-06-28 17:32:18 +00:00

24 lines
908 B
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
/**
* GENERAL contracts can be booked repeatedly until a total cargo quantity cap is
* reached (e.g. 100 containers across many shipments). `quantity_cap` on each
* cargo-scope line holds that ceiling (containers per size, or tons/items for
* bulk). NULL = uncapped; always NULL for ONE_TIME (single booking).
*/
export class AddCargoScopeQuantityCap1826000000000 implements MigrationInterface {
name = 'AddCargoScopeQuantityCap1826000000000';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE freight.contract_cargo_scope ADD COLUMN IF NOT EXISTS quantity_cap NUMERIC(12,2);`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE freight.contract_cargo_scope DROP COLUMN IF EXISTS quantity_cap;`,
);
}
}