mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 14:20:58 +00:00
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Get,
|
|
Param,
|
|
ParseUUIDPipe,
|
|
Post,
|
|
Query,
|
|
} from "@nestjs/common";
|
|
import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
|
|
|
import { FleetManage, FleetView } from "../../common/booking-guards";
|
|
import { FREIGHT_PERMS } from "../../seed/freight-permissions.registry";
|
|
import { ConsignmentsService } from "./consignments.service";
|
|
import { CreateConsignmentDto } from "./dto/create-consignment.dto";
|
|
import { FilterConsignmentDto } from "./dto/filter-consignment.dto";
|
|
|
|
@ApiTags("consignments")
|
|
@Controller("consignments")
|
|
@FleetView(FREIGHT_PERMS.consignments.view)
|
|
export class ConsignmentsController {
|
|
constructor(private readonly consignmentsService: ConsignmentsService) {}
|
|
|
|
@Post()
|
|
@FleetManage(FREIGHT_PERMS.consignments.create)
|
|
@ApiOperation({ summary: "Create a new consignment" })
|
|
create(@Body() dto: CreateConsignmentDto) {
|
|
return this.consignmentsService.create(dto);
|
|
}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: "List consignments (paginated)" })
|
|
findAll(@Query() filter: FilterConsignmentDto) {
|
|
return this.consignmentsService.findAll(filter);
|
|
}
|
|
|
|
@Get(":id")
|
|
@ApiOperation({ summary: "Get a consignment by ID" })
|
|
findOne(@Param("id", ParseUUIDPipe) id: string) {
|
|
return this.consignmentsService.findById(id);
|
|
}
|
|
}
|