mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
- Introduced multi-route functionality in the booking process, allowing users to add additional routes for general contracts. - Updated the StepDocuments component to display onboarding documents automatically attached to bookings. - Refactored Step4Route to manage extra routes and quantities dynamically. - Improved Step8Review to reflect the new onboarding document handling and updated submission readiness checks. - Added new API endpoints and services for managing contract route lines and rejecting bookings. - Removed the allowConsolidation field from the booking model as it is now managed by the system. - Created migrations for the new contract route lines table and updated related entities.
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Get,
|
|
Param,
|
|
ParseUUIDPipe,
|
|
Post,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
import { CurrentUser } from '@edr/api-common';
|
|
import type { TCurrentUser } from '@tria-plc/api-common/modules/auth/types/current-user.type';
|
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
import { BookingOrdersService } from './booking-orders.service';
|
|
import { CreateBookingOrderDto } from './dto/create-booking-order.dto';
|
|
import { GeneralContractService } from './general-contract.service';
|
|
|
|
@ApiTags('Booking Orders')
|
|
@Controller('booking-orders')
|
|
export class BookingOrdersController {
|
|
constructor(
|
|
private readonly ordersService: BookingOrdersService,
|
|
private readonly generalContractService: GeneralContractService,
|
|
) {}
|
|
|
|
@Post()
|
|
@ApiOperation({ summary: 'Place a drawdown order against a general contract' })
|
|
async create(
|
|
@Body() dto: CreateBookingOrderDto,
|
|
@CurrentUser() user: TCurrentUser,
|
|
) {
|
|
return this.ordersService.create(dto, user?.id);
|
|
}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: 'List orders placed against a contract' })
|
|
async list(@Query('contractBookingId', ParseUUIDPipe) contractBookingId: string) {
|
|
return this.ordersService.listByContract(contractBookingId);
|
|
}
|
|
|
|
@Get('contract/:id/pool')
|
|
@ApiOperation({
|
|
summary: 'Contracted / ordered / remaining quantities for a general contract',
|
|
})
|
|
async pool(@Param('id', ParseUUIDPipe) id: string) {
|
|
return this.generalContractService.getQuantityLines(id);
|
|
}
|
|
|
|
@Get('contract/:id/routes')
|
|
@ApiOperation({
|
|
summary:
|
|
'Per-route contracted / ordered / remaining quantities (multi-route contracts). Empty for single-route.',
|
|
})
|
|
async routes(@Param('id', ParseUUIDPipe) id: string) {
|
|
return this.generalContractService.getRouteLines(id);
|
|
}
|
|
|
|
@Get(':id')
|
|
@ApiOperation({ summary: 'Get a single booking order' })
|
|
async findOne(@Param('id', ParseUUIDPipe) id: string) {
|
|
return this.ordersService.findById(id);
|
|
}
|
|
}
|