Fix Admin panel categories modal, add error handling, enforce cursor-pointer globally
This commit is contained in:
1 parent
69502fc380
commit
82ab454647
47 files changed
+2968
-653
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { Controller, Get, Post, Put, Delete, Body, Param, Query, UseGuards } from '@nestjs/common';
|
||||
import { CategoriesService } from './categories.service';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Controller('admin/categories')
|
||||
export class CategoriesController {
|
||||
constructor(private readonly categoriesService: CategoriesService) {}
|
||||
|
||||
@Get()
|
||||
async getCategories(@Query() query: any) {
|
||||
return this.categoriesService.getCategories(query);
|
||||
}
|
||||
|
||||
@Get('all')
|
||||
async getAllCategoriesRaw() {
|
||||
const data = await this.categoriesService.getAllCategoriesRaw();
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
@Post()
|
||||
async createCategory(@Body() body: any) {
|
||||
const data = await this.categoriesService.createCategory(body);
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
async updateCategory(@Param('id') id: string, @Body() body: any) {
|
||||
const data = await this.categoriesService.updateCategory(id, body);
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async deleteCategory(@Param('id') id: string) {
|
||||
await this.categoriesService.deleteCategory(id);
|
||||
return { success: true };
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user