mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
- Create migration for booking_requests table with necessary fields and indexes. - Implement BookingRequestRepository for database operations related to booking requests. - Develop BookingRequestService to handle business logic for submitting, accepting, rejecting, and canceling booking requests. - Create DTOs for creating booking requests and reviewing them. - Define BookingRequest entity to map to the booking_requests table. - Add UI components for managing shipment requests, including detail and list pages. - Implement OperationDatePicker component for selecting available shipment days.
116 lines
2.5 KiB
TypeScript
116 lines
2.5 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import {
|
|
IsDateString,
|
|
IsIn,
|
|
IsInt,
|
|
IsOptional,
|
|
IsString,
|
|
Max,
|
|
Min,
|
|
MinLength,
|
|
} from 'class-validator';
|
|
|
|
export class RequestChangesDto {
|
|
@ApiProperty({ description: 'Staff note explaining what the customer must fix' })
|
|
@IsString()
|
|
@MinLength(1)
|
|
note!: string;
|
|
}
|
|
|
|
export class AcceptIntakeDto {
|
|
@ApiProperty({
|
|
description:
|
|
'How many days the contract stays valid, counted from the accept date. ' +
|
|
'The contract is valid from now through now + validityDays.',
|
|
minimum: 1,
|
|
maximum: 365,
|
|
example: 30,
|
|
})
|
|
@IsInt()
|
|
@Min(1)
|
|
@Max(365)
|
|
validityDays!: number;
|
|
}
|
|
|
|
export class StaffRejectDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(1)
|
|
reason!: string;
|
|
}
|
|
|
|
export class ApproveStepDto {
|
|
@ApiProperty({ description: 'LINE_STAFF | DIRECTOR | CEO' })
|
|
@IsString()
|
|
requiredRole!: string;
|
|
}
|
|
|
|
export class RejectStepDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(1)
|
|
reason!: string;
|
|
}
|
|
|
|
export class CancelBookingDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(1)
|
|
reason!: string;
|
|
}
|
|
|
|
export class RejectBookingDto {
|
|
@ApiPropertyOptional({
|
|
description: 'Optional reason the customer rejected the price estimate',
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
reason?: string;
|
|
}
|
|
|
|
export class ReviewDocumentDto {
|
|
@ApiProperty({ description: 'The document fileKey being reviewed' })
|
|
@IsString()
|
|
@MinLength(1)
|
|
fileKey!: string;
|
|
|
|
@ApiProperty({ enum: ['APPROVED', 'QUERIED'] })
|
|
@IsIn(['APPROVED', 'QUERIED'])
|
|
status!: 'APPROVED' | 'QUERIED';
|
|
|
|
@ApiPropertyOptional({ description: 'Required when querying a document' })
|
|
@IsOptional()
|
|
@IsString()
|
|
note?: string;
|
|
}
|
|
|
|
export class RequestOperationDto {
|
|
@ApiProperty({
|
|
description:
|
|
'The schedule day (train departure day) the customer selects for this ' +
|
|
'shipment. ISO date — the booking enters the batch pool for this route + day.',
|
|
example: '2026-07-15',
|
|
})
|
|
@IsDateString()
|
|
scheduledDate!: string;
|
|
}
|
|
|
|
export class OperationReviewDto {
|
|
@ApiProperty({
|
|
description:
|
|
'The operations decision: ACCEPT enters the batch pool; REQUEST_CHANGES ' +
|
|
'returns it to the customer with a note. The booking price is computed ' +
|
|
'from the contract and cannot be adjusted by staff.',
|
|
enum: ['ACCEPT', 'REQUEST_CHANGES'],
|
|
})
|
|
@IsIn(['ACCEPT', 'REQUEST_CHANGES'])
|
|
decision!: 'ACCEPT' | 'REQUEST_CHANGES';
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Required for REQUEST_CHANGES (what the customer must fix).',
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
note?: string;
|
|
}
|