sysmgr-nest/src/dicts/dict-items.controller.ts
2026-10-10 21:13:35 +08:00

34 lines
881 B
TypeScript

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);
}
}