diff --git a/backend/src/api/categories/categories.controller.ts b/backend/src/api/categories/categories.controller.ts index 0a9302e6df6d2e0ec8a50a37f37e862fec7f298a..c59f95a6d1dcb4fbea7544c9ce386ba88df1beaa 100644 --- a/backend/src/api/categories/categories.controller.ts +++ b/backend/src/api/categories/categories.controller.ts @@ -7,10 +7,11 @@ import { Param, Delete, } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; +import { ApiCreatedResponse, ApiOkResponse, ApiTags } from '@nestjs/swagger'; import { CategoriesService } from './categories.service'; import { CreateCategoryDto } from './dto/create-category.dto'; import { UpdateCategoryDto } from './dto/update-category.dto'; +import { CategoryEntity } from './entities/category.entity'; @ApiTags('categories') @Controller('categories') @@ -18,26 +19,31 @@ export class CategoriesController { constructor(private readonly categoriesService: CategoriesService) {} @Post() + @ApiCreatedResponse({ type: CategoryEntity }) async create(@Body() createCategoryDto: CreateCategoryDto) { return await this.categoriesService.create(createCategoryDto); } @Get() + @ApiOkResponse({ type: [CategoryEntity] }) async findAll() { return await this.categoriesService.findAll(); } @Get(':id') + @ApiOkResponse({ type: CategoryEntity }) async findOne(@Param('id') id: string) { return await this.categoriesService.findOne(id); } @Patch(':id') + @ApiOkResponse({ type: CategoryEntity }) async update(@Param('id') id: string, @Body() updateCategoryDto: UpdateCategoryDto) { return await this.categoriesService.update(id, updateCategoryDto); } @Delete(':id') + @ApiOkResponse({ type: CategoryEntity }) async remove(@Param('id') id: string) { return await this.categoriesService.remove(id); }