add swagger

This commit is contained in:
2025-06-14 23:32:15 +08:00
parent 5a5306b10d
commit 73e5a897c6
6 changed files with 2335 additions and 1616 deletions
@@ -11,23 +11,33 @@ import {
SerializeOptions,
} from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Depends } from '@/modules/restful/decorators/depend.decorator';
import { ContentModule } from '../content.module';
import { CreateCategoryDto, QueryCategoryDto, UpdateCategoryDto } from '../dtos/category.dto';
import { CategoryService } from '../services';
@ApiTags('Category Operate')
@Depends(ContentModule)
@Controller('category')
export class CategoryController {
constructor(protected service: CategoryService) {}
/**
* Search category tree
*/
@Get('tree')
@SerializeOptions({ groups: ['category-tree'] })
async tree() {
return this.service.findTrees();
}
/**
* 分页查询分类列表
* @param options
*/
@Get()
@SerializeOptions({ groups: ['category-list'] })
async list(
@@ -37,6 +47,10 @@ export class CategoryController {
return this.service.paginate(options);
}
/**
* 查询分类明细
* @param id
*/
@Get(':id')
@SerializeOptions({ groups: ['category-detail'] })
async detail(@Param('id', new ParseUUIDPipe()) id: string) {