mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 13:10:56 +00:00
- Added `unplaced` method in `BookingNotifierService` to log warnings for bookings that cannot be placed on any train. - Introduced `getAvailableDays` method in `TrainSchedulingService` to retrieve distinct days with open departures for a given route. - Created `AvailableDaysQueryDto` for querying available days based on origin and destination yards. - Updated `TrainSchedulingController` to expose an endpoint for available days. - Modified frontend components to support day-level booking, allowing customers to select only a day without pinning to a specific train. - Removed references to train schedules in booking forms and review steps, emphasizing day selection. - Added a database migration to create an index for efficient querying of bookings by route and day.
22 lines
833 B
TypeScript
22 lines
833 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
/**
|
|
* Day-level booking pool: customers select a DAY (route + day), not a specific
|
|
* train. The batch engine's pool query filters bookings on
|
|
* (origin_yard_id, destination_yard_id, scheduled_date, status); this partial
|
|
* index backs that scan.
|
|
*/
|
|
export class AddBookingRouteDayIndex1784100000000 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
CREATE INDEX IF NOT EXISTS idx_bookings_route_day
|
|
ON freight.bookings (origin_yard_id, destination_yard_id, scheduled_date, status)
|
|
WHERE deleted_at IS NULL;
|
|
`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`DROP INDEX IF EXISTS freight.idx_bookings_route_day;`);
|
|
}
|
|
}
|