Files
edr-platform/apps/edr-freight-api/src/modules/train-scheduling/dto/batch-board-query.dto.ts
Marshal 4b7f6d2548 enhance contract and booking services with server-side search and validation improvements
- Added  parameter to  and  for server-side free-text search on contract reference, company name, and booking details.
- Introduced new validation errors in  for container clashes and space issues when creating bookings.
- Implemented paginated dropdown settings retrieval in .
- Updated  to fetch active yards using a new method that handles pagination.
- Enhanced  with a  method to fetch all records by walking through pages.
- Refactored  to support filtering and pagination in schedule listings.
- Improved  to return a paginated list of facilities.
- Updated UI components in  and  to utilize debounced search inputs for better performance.
- Added alerts in  to inform users about booking constraints related to splits and capacity.
- Enhanced  to display notifications for split bookings and capacity usage.
2026-07-12 10:51:31 +00:00

68 lines
2.0 KiB
TypeScript

import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsIn, IsISO8601, IsOptional, IsString } from 'class-validator';
import { PaginationQueryDto } from '../../../common/dto/pagination-query.dto';
export const BATCH_BOARD_STATUSES = [
'DRAFT',
'SCHEDULED',
'DISPATCHED',
'ARRIVED',
'CANCELLED',
] as const;
export const BATCH_BOARD_SORT_FIELDS = [
'createdAt',
'scheduledDepartureDate',
'trainNumber',
'status',
] as const;
export type BatchBoardSortField = (typeof BATCH_BOARD_SORT_FIELDS)[number];
/**
* Filters for the batch monitoring board list (import schedules, all statuses).
* `page`/`pageSize`/`search`/`sortOrder` come from the shared
* {@link PaginationQueryDto}; search matches train number, route yards,
* stations, or locomotive code (case-insensitive).
*/
export class BatchBoardQueryDto extends PaginationQueryDto {
@ApiPropertyOptional({
description:
'Comma-separated schedule statuses (DRAFT,SCHEDULED,DISPATCHED,ARRIVED,CANCELLED). Omit for all.',
example: 'DISPATCHED,ARRIVED',
})
@IsOptional()
@IsString()
statuses?: string;
@ApiPropertyOptional({ enum: ['OPEN', 'FULL', 'CLOSED'] })
@IsOptional()
@IsIn(['OPEN', 'FULL', 'CLOSED'])
bookingWindowStatus?: 'OPEN' | 'FULL' | 'CLOSED';
@ApiPropertyOptional({ description: 'Departure date lower bound (ISO 8601).' })
@IsOptional()
@IsISO8601()
departureFrom?: string;
@ApiPropertyOptional({ description: 'Departure date upper bound (ISO 8601).' })
@IsOptional()
@IsISO8601()
departureTo?: string;
@ApiPropertyOptional({ description: 'Created-at lower bound (ISO 8601).' })
@IsOptional()
@IsISO8601()
createdFrom?: string;
@ApiPropertyOptional({ description: 'Created-at upper bound (ISO 8601).' })
@IsOptional()
@IsISO8601()
createdTo?: string;
@ApiPropertyOptional({ enum: BATCH_BOARD_SORT_FIELDS, default: 'createdAt' })
@IsOptional()
@IsIn(BATCH_BOARD_SORT_FIELDS as unknown as string[])
sortBy?: BatchBoardSortField;
}