mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 12:41:04 +00:00
38 lines
1008 B
TypeScript
38 lines
1008 B
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Freight } from '@edr/types';
|
|
import { Column, Entity } from 'typeorm';
|
|
|
|
@Entity({ name: 'bookings' })
|
|
export class Booking extends BaseEntity {
|
|
@Column({ name: 'reference', type: 'varchar', length: 64, unique: true })
|
|
reference!: string;
|
|
|
|
@Column({ name: 'customer_id', type: 'uuid' })
|
|
customerId!: string;
|
|
|
|
@Column({ name: 'train_id', type: 'uuid', nullable: true })
|
|
trainId?: string | null;
|
|
|
|
@Column({
|
|
name: 'status',
|
|
type: 'enum',
|
|
enum: Freight.BookingStatus,
|
|
default: Freight.BookingStatus.Draft,
|
|
})
|
|
status!: Freight.BookingStatus;
|
|
|
|
@Column({ name: 'scheduled_date', type: 'timestamptz' })
|
|
scheduledDate!: Date;
|
|
|
|
@Column({ name: 'total_amount', type: 'numeric', precision: 14, scale: 2, default: 0 })
|
|
totalAmount!: number;
|
|
|
|
@Column({
|
|
name: 'payment_status',
|
|
type: 'enum',
|
|
enum: Freight.PaymentStatus,
|
|
default: Freight.PaymentStatus.Pending,
|
|
})
|
|
paymentStatus!: Freight.PaymentStatus;
|
|
}
|