mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 04:20:55 +00:00
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Delete,
|
|
Get,
|
|
HttpCode,
|
|
Param,
|
|
ParseUUIDPipe,
|
|
Post,
|
|
Query,
|
|
} from "@nestjs/common";
|
|
import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
|
|
|
import { BookingsService } from "./bookings.service";
|
|
import { CreateBookingDto } from "./dto/create-booking.dto";
|
|
import { FilterBookingDto } from "./dto/filter-booking.dto";
|
|
|
|
@ApiTags("bookings")
|
|
@Controller("bookings")
|
|
export class BookingsController {
|
|
constructor(private readonly bookingsService: BookingsService) {}
|
|
|
|
@Post()
|
|
@ApiOperation({ summary: "Create a new freight booking" })
|
|
create(@Body() dto: CreateBookingDto) {
|
|
return this.bookingsService.create(dto);
|
|
}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: "List freight bookings (paginated)" })
|
|
findAll(@Query() filter: FilterBookingDto) {
|
|
return this.bookingsService.findAll(filter);
|
|
}
|
|
|
|
@Get(":id")
|
|
@ApiOperation({ summary: "Get a freight booking by ID" })
|
|
findOne(@Param("id", ParseUUIDPipe) id: string) {
|
|
return this.bookingsService.findById(id);
|
|
}
|
|
|
|
@Delete(":id")
|
|
@HttpCode(204)
|
|
@ApiOperation({ summary: "Soft-delete a freight booking" })
|
|
remove(@Param("id", ParseUUIDPipe) id: string) {
|
|
return this.bookingsService.remove(id);
|
|
}
|
|
}
|