mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 15:18:11 +00:00
fix
This commit is contained in:
@@ -65,6 +65,12 @@ export class FirstMileController {
|
|||||||
return this.firstMileService.findById(id);
|
return this.firstMileService.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('acceptitem/:id')
|
||||||
|
@ApiOperation({ summary: 'Get a first-mile accep by ID' })
|
||||||
|
acceptItem(@Param('id', ParseUUIDPipe) id: string) {
|
||||||
|
return this.firstMileService.acceptBooking(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Post('accept/:reference')
|
@Post('accept/:reference')
|
||||||
@TrainSchedulingManage()
|
@TrainSchedulingManage()
|
||||||
@ApiOperation({ summary: 'Accept a paid booking and create a first-mile leg' })
|
@ApiOperation({ summary: 'Accept a paid booking and create a first-mile leg' })
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class FirstMileService {
|
|||||||
private readonly vehiclesService: VehiclesService,
|
private readonly vehiclesService: VehiclesService,
|
||||||
private readonly driversService: DriversService,
|
private readonly driversService: DriversService,
|
||||||
private readonly smsClient: SmsClientService,
|
private readonly smsClient: SmsClientService,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look up a booking by its human-readable reference and confirm it has been
|
* Look up a booking by its human-readable reference and confirm it has been
|
||||||
@@ -95,7 +95,7 @@ export class FirstMileService {
|
|||||||
if (booking.paymentStatus !== 'PAID') {
|
if (booking.paymentStatus !== 'PAID') {
|
||||||
throw new BadRequestException(`Booking ${label} is not paid`);
|
throw new BadRequestException(`Booking ${label} is not paid`);
|
||||||
}
|
}
|
||||||
|
console.log("-------------------", booking)
|
||||||
if (!this.bookingRequestsFirstMile(booking)) {
|
if (!this.bookingRequestsFirstMile(booking)) {
|
||||||
throw new BadRequestException(`Booking ${label} does not require a first mile`);
|
throw new BadRequestException(`Booking ${label} does not require a first mile`);
|
||||||
}
|
}
|
||||||
@@ -212,11 +212,8 @@ export class FirstMileService {
|
|||||||
}): boolean {
|
}): boolean {
|
||||||
// Export bookings always need a first mile (pickup → origin yard); the
|
// Export bookings always need a first mile (pickup → origin yard); the
|
||||||
// pickup address is captured at assignment time, not required upfront.
|
// pickup address is captured at assignment time, not required upfront.
|
||||||
return Boolean(
|
return Boolean(booking.firstMilePickupAddress?.trim() ||
|
||||||
booking.tradeDirection === 'EXPORT' ||
|
booking.serviceType?.includesFirstMile);
|
||||||
booking.firstMilePickupAddress?.trim() ||
|
|
||||||
booking.serviceType?.includesFirstMile,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, dto: UpdateFirstMileDto): Promise<FirstMile> {
|
async update(id: string, dto: UpdateFirstMileDto): Promise<FirstMile> {
|
||||||
|
|||||||
Reference in New Issue
Block a user