mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 12:41:04 +00:00
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import {
|
|
Body, Controller, Delete, Get, HttpCode, HttpStatus,
|
|
Param, ParseUUIDPipe, Patch, Post, Query,
|
|
} from '@nestjs/common';
|
|
import { RuleEngineCreate, RuleEngineDelete, RuleEngineUpdate } from '../../../common/rule-engine-guards';
|
|
import { StaffReference } from '../../../common/booking-guards';
|
|
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
import { CreateShippingLineDto } from '../dto/create-shipping-line.dto';
|
|
import { ListRuleEngineQueryDto } from '../dto/list-rule-engine-query.dto';
|
|
import { UpdateShippingLineDto } from '../dto/update-shipping-line.dto';
|
|
import { ShippingLinesService } from '../services/shipping-lines.service';
|
|
|
|
@ApiTags('shipping-lines')
|
|
@Controller('shipping-lines')
|
|
@ApiBearerAuth()
|
|
export class ShippingLinesController {
|
|
constructor(private readonly service: ShippingLinesService) {}
|
|
|
|
@Get()
|
|
@StaffReference()
|
|
@ApiOperation({ summary: 'List shipping lines' })
|
|
findAll(@Query() query: ListRuleEngineQueryDto) {
|
|
return this.service.findAll(query);
|
|
}
|
|
|
|
@Get(':id')
|
|
@StaffReference()
|
|
@ApiOperation({ summary: 'Get a shipping line by ID' })
|
|
findOne(@Param('id', ParseUUIDPipe) id: string) {
|
|
return this.service.findById(id);
|
|
}
|
|
|
|
@Post()
|
|
@RuleEngineCreate('shipping-lines')
|
|
@ApiOperation({ summary: 'Create a shipping line' })
|
|
create(@Body() dto: CreateShippingLineDto) {
|
|
return this.service.create(dto);
|
|
}
|
|
|
|
@Patch(':id')
|
|
@RuleEngineUpdate('shipping-lines')
|
|
@ApiOperation({ summary: 'Update a shipping line' })
|
|
update(@Param('id', ParseUUIDPipe) id: string, @Body() dto: UpdateShippingLineDto) {
|
|
return this.service.update(id, dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
@RuleEngineDelete('shipping-lines')
|
|
@HttpCode(HttpStatus.NO_CONTENT)
|
|
@ApiOperation({ summary: 'Soft-delete a shipping line' })
|
|
remove(@Param('id', ParseUUIDPipe) id: string) {
|
|
return this.service.remove(id);
|
|
}
|
|
}
|