mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 07:15:45 +00:00
- Added functionality to cancel contracts, allowing users to provide a reason for cancellation. - Updated contract statuses to include SUSPENDED and changed CLOSED to COMPLETED. - Enhanced the UI to reflect the new cancellation option and updated messaging for contract statuses. - Refactored contract booking actions to accommodate changes in booking logic for ONE_TIME and GENERAL contracts. - Removed clearance document management from the contract detail page, as it is now handled per booking. - Introduced a SQL script to reset bookings and train schedules for development purposes.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
|
|
import { Locomotive } from '../../locomotives/entities/locomotive.entity';
|
|
import { TrainSet } from './train-set.entity';
|
|
|
|
/**
|
|
* Link row joining a train set to one of its locomotives. A train set must be
|
|
* pulled by at least one locomotive; `sequenceNo` is a plain
|
|
* order index — no front/rear semantics are modelled yet.
|
|
*/
|
|
@Entity({ schema: 'freight', name: 'train_set_locomotives' })
|
|
@Index(['trainSetId', 'locomotiveId'], { unique: true })
|
|
export class TrainSetLocomotive extends BaseEntity {
|
|
@Column({ name: 'train_set_id', type: 'uuid' })
|
|
trainSetId!: string;
|
|
|
|
@ManyToOne(() => TrainSet, (trainSet) => trainSet.locomotives, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'train_set_id' })
|
|
trainSet?: TrainSet;
|
|
|
|
@Column({ name: 'locomotive_id', type: 'uuid' })
|
|
locomotiveId!: string;
|
|
|
|
@ManyToOne(() => Locomotive)
|
|
@JoinColumn({ name: 'locomotive_id' })
|
|
locomotive?: Locomotive;
|
|
|
|
@Column({ name: 'sequence_no', type: 'int', default: 0 })
|
|
sequenceNo!: number;
|
|
}
|