chore: add crude for admin
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Get, HttpCode, HttpStatus, Param, Patch, Post, Query, Res } from "@nestjs/common";
|
||||
import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Patch, Post, Query, Res } from "@nestjs/common";
|
||||
import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
||||
import { FastifyReply } from "fastify";
|
||||
|
||||
@@ -12,6 +12,7 @@ import { CreateRoleDto } from "./DTO/create-role.dto";
|
||||
import { SearchAdminQueryDto } from "./DTO/search-admins-query.dto";
|
||||
import { SearchCustomersDto } from "./DTO/search-customers.dto";
|
||||
import { SearchRolesQueryDto } from "./DTO/search-roles.dto";
|
||||
import { UpdateAdminDto } from "./DTO/update-admin.dto";
|
||||
import { UpdateCustomerDto } from "./DTO/update-customer.dto";
|
||||
import { UpdateProfileDto } from "./DTO/update-profile.dto";
|
||||
import { CreateUserGroupDto } from "./DTO/user-group.dto";
|
||||
@@ -183,6 +184,30 @@ export class UsersController {
|
||||
return this.adminsService.getAdmins(queryDto);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "get admin by id ==> admin route" })
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.ADMINS, PermissionEnum.CUSTOMERS)
|
||||
@Get("admins/:id")
|
||||
getAdminById(@Param() paramDto: ParamDto) {
|
||||
return this.adminsService.getAdminById(paramDto.id);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "update admin ==> admin route" })
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.ADMINS, PermissionEnum.CUSTOMERS)
|
||||
@Patch("admins/:id")
|
||||
updateAdmin(@Param() paramDto: ParamDto, @Body() updateDto: UpdateAdminDto) {
|
||||
return this.adminsService.updateAdmin(paramDto.id, updateDto);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "delete admin ==> admin route" })
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.ADMINS, PermissionEnum.CUSTOMERS)
|
||||
@Delete("admins/:id")
|
||||
deleteAdmin(@Param() paramDto: ParamDto) {
|
||||
return this.adminsService.deleteAdmin(paramDto.id);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "create admin ==> admin route" })
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.ADMINS, PermissionEnum.CUSTOMERS)
|
||||
|
||||
Reference in New Issue
Block a user