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

fix: category API endpoints response Swagger docs will be generated with the Nest CLI

parent 9754c45d
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ import {
Param,
Delete,
} from '@nestjs/common';
import { ApiCreatedResponse, ApiOkResponse, ApiTags } from '@nestjs/swagger';
import { ApiTags } from '@nestjs/swagger';
import { CategoriesService } from './categories.service';
import { CreateCategoryDto } from './dto/create-category.dto';
import { UpdateCategoryDto } from './dto/update-category.dto';
......@@ -19,32 +19,27 @@ export class CategoriesController {
constructor(private readonly categoriesService: CategoriesService) {}
@Post()
@ApiCreatedResponse({ type: CategoryEntity })
async create(@Body() createCategoryDto: CreateCategoryDto) {
async create(@Body() createCategoryDto: CreateCategoryDto): Promise<CategoryEntity> {
return await this.categoriesService.create(createCategoryDto);
}
@Get()
@ApiOkResponse({ type: [CategoryEntity] })
async findAll() {
async findAll(): Promise<CategoryEntity[]> {
return await this.categoriesService.findAll();
}
@Get(':id')
@ApiOkResponse({ type: CategoryEntity })
async findOne(@Param('id') id: string) {
async findOne(@Param('id') id: string): Promise<CategoryEntity> {
return await this.categoriesService.findOne(id);
}
@Patch(':id')
@ApiOkResponse({ type: CategoryEntity })
async update(@Param('id') id: string, @Body() updateCategoryDto: UpdateCategoryDto) {
async update(@Param('id') id: string, @Body() updateCategoryDto: UpdateCategoryDto): Promise<CategoryEntity> {
return await this.categoriesService.update(id, updateCategoryDto);
}
@Delete(':id')
@ApiOkResponse({ type: CategoryEntity })
async remove(@Param('id') id: string) {
async remove(@Param('id') id: string): Promise<CategoryEntity> {
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