mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 17:10:56 +00:00
implement intercity booking management and booking window websocket integration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { YardCountry } from '@edr/types';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsBoolean, IsInt, IsOptional, IsString, IsUUID, MaxLength, Min } from 'class-validator';
|
||||
import { IsBoolean, IsEnum, IsInt, IsOptional, IsUUID, MaxLength, Min, IsString } from 'class-validator';
|
||||
|
||||
export class CreateYardDto {
|
||||
@ApiProperty({ description: 'Customer-facing yard label', maxLength: 100 })
|
||||
@@ -7,10 +8,9 @@ export class CreateYardDto {
|
||||
@MaxLength(100)
|
||||
label!: string;
|
||||
|
||||
@ApiProperty({ description: 'Country where the yard is located, e.g. Ethiopia, Djibouti', maxLength: 50 })
|
||||
@IsString()
|
||||
@MaxLength(50)
|
||||
country!: string;
|
||||
@ApiProperty({ enum: YardCountry, description: 'Country where the yard is located' })
|
||||
@IsEnum(YardCountry)
|
||||
country!: YardCountry;
|
||||
|
||||
@ApiPropertyOptional({ default: true })
|
||||
@IsOptional()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { BaseEntity } from '@edr/api-common';
|
||||
import { YardCountry } from '@edr/types';
|
||||
import { Column, Entity, Index } from 'typeorm';
|
||||
|
||||
@Entity({ schema: 'freight', name: 'yards' })
|
||||
@@ -12,8 +13,11 @@ export class Yard extends BaseEntity {
|
||||
@Column({ name: 'label', type: 'varchar', length: 100 })
|
||||
label!: string;
|
||||
|
||||
// Constrained to YardCountry by DTO validation + a DB CHECK constraint;
|
||||
// route/schedule trade direction is derived from this value. Typed as the
|
||||
// enum's literal values so plain strings from seeds/queries still fit.
|
||||
@Column({ name: 'country', type: 'varchar', length: 50 })
|
||||
country!: string;
|
||||
country!: `${YardCountry}`;
|
||||
|
||||
@Column({ name: 'is_active', type: 'boolean', default: true })
|
||||
isActive!: boolean;
|
||||
|
||||
Reference in New Issue
Block a user