feat: complete admin panel and backend admin api migration
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { Body, Controller, Delete, Get, HttpCode, Param, Post, Put } from '@nestjs/common';
|
||||
import { AdminPreOrdersService } from './admin-preorders.service';
|
||||
import { TableQueryDto } from '../admin-table/table-query.dto';
|
||||
import { RequirePermission } from '../auth/guards';
|
||||
|
||||
/**
|
||||
* Legacy endpoints (CustomOrderController):
|
||||
* POST get-custom-orders -> the "سفارش های ساختنی" grid
|
||||
* GET get-custom-order/{id}
|
||||
* PUT custom-order/{id}
|
||||
* DELETE custom-order/{id}
|
||||
*/
|
||||
@Controller('admin/pre-orders')
|
||||
export class AdminPreOrdersController {
|
||||
constructor(private readonly preOrders: AdminPreOrdersService) {}
|
||||
|
||||
@Post('list')
|
||||
@HttpCode(200)
|
||||
@RequirePermission('order.makeOrder')
|
||||
list(@Body() query: TableQueryDto) {
|
||||
return this.preOrders.list(query);
|
||||
}
|
||||
|
||||
@Get('status-options')
|
||||
@RequirePermission('order.makeOrder')
|
||||
statusOptions() {
|
||||
return this.preOrders.statusOptions();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@RequirePermission('order.makeOrder')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.preOrders.findOne(id);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
@RequirePermission('order.makeOrder')
|
||||
update(@Param('id') id: string, @Body() data: Record<string, unknown>) {
|
||||
return this.preOrders.update(id, data);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@RequirePermission('order.makeOrder')
|
||||
remove(@Param('id') id: string) {
|
||||
return this.preOrders.remove(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user