mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 07:51:02 +00:00
Merge freight/develop into Warehouses
This commit is contained in:
@@ -1,17 +1,27 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
ParseUUIDPipe,
|
||||
Patch,
|
||||
Post,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
import { TrainSchedulingManage, TrainSchedulingView } from '../../common/booking-guards';
|
||||
import { AssignBookingsDto } from './dto/assign-bookings.dto';
|
||||
import { CreateContainerTrainScheduleDto } from './dto/create-container-train-schedule.dto';
|
||||
import { GetEligibleBookingsDto } from './dto/get-eligible-bookings.dto';
|
||||
import { GetEligibleBulkBookingsDto } from './dto/get-eligible-bulk-bookings.dto';
|
||||
import { GetEligibleContainerBookingsDto } from './dto/get-eligible-container-bookings.dto';
|
||||
import { PinWagonsDto } from './dto/pin-wagons.dto';
|
||||
import { PreviewBulkTrainScheduleDto } from './dto/preview-bulk-train-schedule.dto';
|
||||
import { PreviewContainerTrainScheduleDto } from './dto/preview-container-train-schedule.dto';
|
||||
import { PreviewTrainScheduleDto } from './dto/preview-train-schedule.dto';
|
||||
import { UpdateTrainSchedulingGlobalRulesDto } from './dto/update-train-scheduling-global-rules.dto';
|
||||
import { TrainSchedulingService } from './train-scheduling.service';
|
||||
|
||||
@ApiTags('train-scheduling')
|
||||
@@ -20,45 +30,183 @@ import { TrainSchedulingService } from './train-scheduling.service';
|
||||
export class TrainSchedulingController {
|
||||
constructor(private readonly trainSchedulingService: TrainSchedulingService) {}
|
||||
|
||||
@Get('global-rules')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'Get global train scheduling rules (singleton)' })
|
||||
getGlobalRules() {
|
||||
return this.trainSchedulingService.getTrainSchedulingGlobalRules();
|
||||
}
|
||||
|
||||
@Patch('global-rules')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Update global train scheduling rules (singleton)' })
|
||||
updateGlobalRules(@Body() dto: UpdateTrainSchedulingGlobalRulesDto) {
|
||||
return this.trainSchedulingService.updateTrainSchedulingGlobalRules(dto);
|
||||
}
|
||||
|
||||
@Get('eligible-bookings')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'List eligible bookings (container and/or bulk)' })
|
||||
getEligibleBookings(@Query() query: GetEligibleBookingsDto) {
|
||||
return this.trainSchedulingService.getEligibleBookings(query);
|
||||
}
|
||||
|
||||
@Get('container/eligible-bookings')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'List eligible container bookings' })
|
||||
getEligibleContainerBookings(@Query() query: GetEligibleContainerBookingsDto) {
|
||||
return this.trainSchedulingService.getEligibleContainerBookings(query);
|
||||
}
|
||||
|
||||
@Get('bulk/eligible-bookings')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'List eligible bulk bookings' })
|
||||
getEligibleBulkBookings(@Query() query: GetEligibleBulkBookingsDto) {
|
||||
return this.trainSchedulingService.getEligibleBulkBookings(query);
|
||||
}
|
||||
|
||||
@Post('preview')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'Preview a mixed-capable train schedule' })
|
||||
previewTrainSchedule(@Body() dto: PreviewTrainScheduleDto) {
|
||||
return this.trainSchedulingService.previewTrainSchedule(dto);
|
||||
}
|
||||
|
||||
@Post('container/preview')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'Preview a container train schedule' })
|
||||
previewContainerTrainSchedule(@Body() dto: PreviewContainerTrainScheduleDto) {
|
||||
return this.trainSchedulingService.previewContainerTrainSchedule(dto);
|
||||
}
|
||||
|
||||
@Post('bulk/preview')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'Preview a bulk train schedule' })
|
||||
previewBulkTrainSchedule(@Body() dto: PreviewBulkTrainScheduleDto) {
|
||||
return this.trainSchedulingService.previewBulkTrainSchedule(dto);
|
||||
}
|
||||
|
||||
@Post('container/schedules')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Create a container train schedule' })
|
||||
createContainerTrainSchedule(@Body() dto: CreateContainerTrainScheduleDto) {
|
||||
return this.trainSchedulingService.createContainerTrainSchedule(dto);
|
||||
}
|
||||
|
||||
@Post('bulk/schedules')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Create a bulk train schedule' })
|
||||
createBulkTrainSchedule(@Body() dto: CreateContainerTrainScheduleDto) {
|
||||
return this.trainSchedulingService.createContainerTrainSchedule(dto);
|
||||
}
|
||||
|
||||
@Post('schedules/:id/assign-bookings')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Assign bookings to a train schedule (mixed-capable)' })
|
||||
assignBookings(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@Body() dto: AssignBookingsDto,
|
||||
) {
|
||||
return this.trainSchedulingService.assignBookingsToSchedule(id, dto);
|
||||
}
|
||||
|
||||
@Post('container/schedules/:id/assign-bookings')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Assign container bookings to a train schedule' })
|
||||
assignContainerBookings(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@Body() dto: AssignBookingsDto,
|
||||
) {
|
||||
return this.trainSchedulingService.assignBookingsToSchedule(id, dto, 'CONTAINER');
|
||||
}
|
||||
|
||||
@Post('bulk/schedules/:id/assign-bookings')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Assign bulk bookings to a train schedule' })
|
||||
assignBulkBookings(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@Body() dto: AssignBookingsDto,
|
||||
) {
|
||||
return this.trainSchedulingService.assignBookingsToSchedule(id, dto, 'BULK');
|
||||
}
|
||||
|
||||
@Delete('schedules/:id/bookings/:bookingId')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Unassign a booking from a train schedule' })
|
||||
unassignBooking(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@Param('bookingId', ParseUUIDPipe) bookingId: string,
|
||||
) {
|
||||
return this.trainSchedulingService.unassignBooking(id, bookingId);
|
||||
}
|
||||
|
||||
@Post('schedules/:id/pin-wagons')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Pin physical wagons to train set slots' })
|
||||
pinWagons(@Param('id', ParseUUIDPipe) id: string, @Body() dto: PinWagonsDto) {
|
||||
return this.trainSchedulingService.pinWagons(id, dto);
|
||||
}
|
||||
|
||||
@Post('schedules/:id/finalize')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Finalize a draft train schedule' })
|
||||
finalizeSchedule(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.trainSchedulingService.finalizeSchedule(id);
|
||||
}
|
||||
|
||||
@Post('schedules/:id/dispatch')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Dispatch a scheduled train' })
|
||||
dispatchSchedule(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.trainSchedulingService.dispatchSchedule(id);
|
||||
}
|
||||
|
||||
@Get('container/schedules')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'List container train schedules' })
|
||||
getContainerTrainSchedules() {
|
||||
return this.trainSchedulingService.getContainerTrainSchedules();
|
||||
}
|
||||
|
||||
@Get('bulk/schedules')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'List bulk train schedules' })
|
||||
getBulkTrainSchedules() {
|
||||
return this.trainSchedulingService.getContainerTrainSchedules();
|
||||
}
|
||||
|
||||
@Get('container/schedules/:id')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'Get container train schedule detail' })
|
||||
getContainerTrainScheduleById(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.trainSchedulingService.getContainerTrainScheduleById(id);
|
||||
}
|
||||
|
||||
@Get('bulk/schedules/:id')
|
||||
@TrainSchedulingView()
|
||||
@ApiOperation({ summary: 'Get bulk train schedule detail' })
|
||||
getBulkTrainScheduleById(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.trainSchedulingService.getContainerTrainScheduleById(id);
|
||||
}
|
||||
|
||||
@Post('container/schedules/:id/cancel')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Cancel container train schedule' })
|
||||
cancelTrainSchedule(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.trainSchedulingService.cancelTrainSchedule(id);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Post('container/schedules/:id/publish')
|
||||
@ApiOperation({ summary: 'Publish container train schedule' })
|
||||
publishTrainSchedule(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.trainSchedulingService.publishTrainSchedule(id);
|
||||
=======
|
||||
@Post('bulk/schedules/:id/cancel')
|
||||
@TrainSchedulingManage()
|
||||
@ApiOperation({ summary: 'Cancel bulk train schedule' })
|
||||
cancelBulkTrainSchedule(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.trainSchedulingService.cancelTrainSchedule(id);
|
||||
>>>>>>> 10b011de8feafce5c0bae21594df5b36596587db
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user