Files
edr-platform/apps/edr-freight-api/src/migrations/2110000000000-AddBookingIsSplit.ts
Marshal 4b7f6d2548 enhance contract and booking services with server-side search and validation improvements
- Added  parameter to  and  for server-side free-text search on contract reference, company name, and booking details.
- Introduced new validation errors in  for container clashes and space issues when creating bookings.
- Implemented paginated dropdown settings retrieval in .
- Updated  to fetch active yards using a new method that handles pagination.
- Enhanced  with a  method to fetch all records by walking through pages.
- Refactored  to support filtering and pagination in schedule listings.
- Improved  to return a paginated list of facilities.
- Updated UI components in  and  to utilize debounced search inputs for better performance.
- Added alerts in  to inform users about booking constraints related to splits and capacity.
- Enhanced  to display notifications for split bookings and capacity usage.
2026-07-12 10:51:31 +00:00

33 lines
1.2 KiB
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
/**
* Partial-batch splits no longer promote a ONE_TIME contract to GENERAL.
* Instead the reduced booking is flagged is_split, and the booking gate lets
* the customer book exactly the remainder under the still-ONE_TIME contract.
*/
export class AddBookingIsSplit2110000000000 implements MigrationInterface {
name = 'AddBookingIsSplit2110000000000';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.bookings
ADD COLUMN IF NOT EXISTS is_split BOOLEAN NOT NULL DEFAULT FALSE
`);
// Quantities the booking carried before the split — the remainder ledger
// for ONE_TIME contracts, which have no quantity cap to derive it from.
await queryRunner.query(`
ALTER TABLE freight.bookings
ADD COLUMN IF NOT EXISTS pre_split_quantities JSONB NULL
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.bookings DROP COLUMN IF EXISTS pre_split_quantities
`);
await queryRunner.query(`
ALTER TABLE freight.bookings DROP COLUMN IF EXISTS is_split
`);
}
}