refactor: Split category management into separate public and admin controllers, adjusting routes and tags accordingly.
This commit is contained in:
parent
4c9ad1cea7
commit
e379ed83c8
1 changed files with 9 additions and 3 deletions
|
|
@ -3,9 +3,9 @@ import { ValidationError } from '../middleware/errorHandler';
|
||||||
import { CategoryService } from '../services/categories.service';
|
import { CategoryService } from '../services/categories.service';
|
||||||
import { createCategory, createCategoryResponse, deleteCategoryResponse, updateCategory, updateCategoryResponse, listCategoriesResponse } from '../types/categories.type';
|
import { createCategory, createCategoryResponse, deleteCategoryResponse, updateCategory, updateCategoryResponse, listCategoriesResponse } from '../types/categories.type';
|
||||||
|
|
||||||
@Route('api/admin/categories')
|
@Route('api/categories')
|
||||||
@Tags('Admin/Categories')
|
@Tags('Categories')
|
||||||
export class CategoriesController extends Controller {
|
export class CategoriesController {
|
||||||
private categoryService = new CategoryService();
|
private categoryService = new CategoryService();
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
|
@ -14,6 +14,12 @@ export class CategoriesController extends Controller {
|
||||||
public async listCategories(): Promise<listCategoriesResponse> {
|
public async listCategories(): Promise<listCategoriesResponse> {
|
||||||
return await this.categoryService.listCategories();
|
return await this.categoryService.listCategories();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Route('api/admin/categories')
|
||||||
|
@Tags('Admin/Categories')
|
||||||
|
export class CategoriesAdminController {
|
||||||
|
private categoryService = new CategoryService();
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@Security('jwt', ['admin'])
|
@Security('jwt', ['admin'])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue