mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 11:08:12 +00:00
feat: enhance booking flow with multi-route support and onboarding document integration
- Introduced multi-route functionality in the booking process, allowing users to add additional routes for general contracts. - Updated the StepDocuments component to display onboarding documents automatically attached to bookings. - Refactored Step4Route to manage extra routes and quantities dynamically. - Improved Step8Review to reflect the new onboarding document handling and updated submission readiness checks. - Added new API endpoints and services for managing contract route lines and rejecting bookings. - Removed the allowConsolidation field from the booking model as it is now managed by the system. - Created migrations for the new contract route lines table and updated related entities.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Consolidation is now system-managed: the backend consolidates partial-wagon
|
||||
* container bookings automatically, derived from the container quantities. The
|
||||
* `allow_consolidation` opt-in flag is therefore redundant and is dropped.
|
||||
* `consolidation_partner_id` (the actual pairing link) is unaffected.
|
||||
*/
|
||||
export class DropAllowConsolidation1820000000000 implements MigrationInterface {
|
||||
name = 'DropAllowConsolidation1820000000000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.bookings DROP COLUMN IF EXISTS allow_consolidation;`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.bookings ADD COLUMN IF NOT EXISTS allow_consolidation BOOLEAN NOT NULL DEFAULT false;`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { MigrationInterface, QueryRunner, Table, TableIndex } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Multi-route general contracts: a contract may reserve quantity across several
|
||||
* routes. Each (contract, route, container type) is a row here; drawdown orders
|
||||
* reference the route line they drew from via booking_orders.route_line_id.
|
||||
*/
|
||||
export class CreateContractRouteLines1820000000001
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'CreateContractRouteLines1820000000001';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
schema: 'freight',
|
||||
name: 'contract_route_lines',
|
||||
columns: [
|
||||
{ name: 'id', type: 'uuid', isPrimary: true, generationStrategy: 'uuid', default: 'gen_random_uuid()' },
|
||||
{ name: 'contract_booking_id', type: 'uuid' },
|
||||
{ name: 'origin_yard_id', type: 'uuid' },
|
||||
{ name: 'destination_yard_id', type: 'uuid' },
|
||||
{ name: 'container_type_id', type: 'uuid', isNullable: true },
|
||||
{ name: 'quantity', type: 'numeric', precision: 12, scale: 3 },
|
||||
{ name: 'created_at', type: 'timestamptz', default: 'now()' },
|
||||
{ name: 'updated_at', type: 'timestamptz', default: 'now()' },
|
||||
{ name: 'deleted_at', type: 'timestamptz', isNullable: true },
|
||||
],
|
||||
foreignKeys: [
|
||||
{
|
||||
columnNames: ['contract_booking_id'],
|
||||
referencedSchema: 'freight',
|
||||
referencedTableName: 'bookings',
|
||||
referencedColumnNames: ['id'],
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
],
|
||||
}),
|
||||
true,
|
||||
);
|
||||
|
||||
await queryRunner.createIndex(
|
||||
'freight.contract_route_lines',
|
||||
new TableIndex({
|
||||
name: 'idx_contract_route_lines_contract',
|
||||
columnNames: ['contract_booking_id'],
|
||||
}),
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.booking_orders ADD COLUMN IF NOT EXISTS route_line_id uuid;`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.booking_orders DROP COLUMN IF EXISTS route_line_id;`,
|
||||
);
|
||||
await queryRunner.dropTable('freight.contract_route_lines', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user