Skip to content
Snippets Groups Projects
Commit 9754c45d authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

feat: added category API endpoints response Swagger docs

parent 46b79247
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment