mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 07:22:53 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Get,
|
|
Param,
|
|
ParseUUIDPipe,
|
|
Post,
|
|
Query,
|
|
} from "@nestjs/common";
|
|
import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
|
|
|
import { ConsignmentsService } from "./consignments.service";
|
|
import { CreateConsignmentDto } from "./dto/create-consignment.dto";
|
|
import { FilterConsignmentDto } from "./dto/filter-consignment.dto";
|
|
|
|
@ApiTags("consignments")
|
|
// @UseGuards(JwtAuthGuard) — TODO: integrate @edr/auth
|
|
@Controller("consignments")
|
|
export class ConsignmentsController {
|
|
constructor(private readonly consignmentsService: ConsignmentsService) {}
|
|
|
|
@Post()
|
|
@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);
|
|
}
|
|
}
|