mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 14:08:11 +00:00
Add snapshot of booking-window rules to train schedules and update related logic
This commit is contained in:
@@ -111,6 +111,27 @@ export class TrainSchedule extends BaseEntity {
|
||||
@Column({ name: 'booking_cycle_no', type: 'int', default: 0 })
|
||||
bookingCycleNo!: number;
|
||||
|
||||
// ── Booking-window rule snapshot ──────────────────────────────────────────
|
||||
// The scheduling rule this train was created with, frozen at creation. A later
|
||||
// global-rules edit applies only to FUTURE schedules — an already-open schedule
|
||||
// keeps its base rule. The batch board derives its display windows (open time +
|
||||
// reopen cycles) from THIS snapshot, never from the live global config. NULL on
|
||||
// legacy rows created before the snapshot existed (board falls back to live cfg).
|
||||
@Column({ name: 'rule_window_open_hour', type: 'int', nullable: true })
|
||||
ruleWindowOpenHour?: number | null;
|
||||
|
||||
@Column({ name: 'rule_window_duration_hours', type: 'numeric', precision: 6, scale: 4, nullable: true })
|
||||
ruleWindowDurationHours?: number | null;
|
||||
|
||||
@Column({ name: 'rule_reopen_delay_minutes', type: 'int', nullable: true })
|
||||
ruleReopenDelayMinutes?: number | null;
|
||||
|
||||
@Column({ name: 'rule_import_window_lead_days', type: 'int', nullable: true })
|
||||
ruleImportWindowLeadDays?: number | null;
|
||||
|
||||
@Column({ name: 'rule_export_booking_lead_hours', type: 'int', nullable: true })
|
||||
ruleExportBookingLeadHours?: number | null;
|
||||
|
||||
@OneToMany(() => TrainScheduleBooking, (scheduleBooking) => scheduleBooking.trainSchedule)
|
||||
scheduleBookings?: TrainScheduleBooking[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user