import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common'; import { CreateDictItemDto, UpdateDictItemDto } from './dto.js'; import { DictItemsService } from './dict-items.service.js'; @Controller('dict-items') export class DictItemsController { constructor(private readonly service: DictItemsService) {} @Get() list(@Query('dictTypeCode') dictTypeCode?: string) { return this.service.listByType(dictTypeCode); } @Get(':id') get(@Param('id') id: string) { return this.service.findById(id); } @Post() create(@Body() dto: CreateDictItemDto) { return this.service.createItem(dto); } @Patch(':id') update(@Param('id') id: string, @Body() dto: UpdateDictItemDto) { return this.service.updateItem(id, dto); } @Delete(':id') remove(@Param('id') id: string) { return this.service.softRemove(id); } }