Update role guards to differentiate between admin and super admin roles

This commit is contained in:
faris Aljohari
2024-05-11 21:19:53 +03:00
parent e7024a5cb8
commit ea19361a59
6 changed files with 43 additions and 19 deletions

View File

@ -16,7 +16,7 @@ import { ResponseMessage } from '../../../libs/common/src/response/response.deco
import { UserLoginDto } from '../dtos/user-login.dto';
import { ForgetPasswordDto, UserOtpDto, VerifyOtpDto } from '../dtos';
import { RefreshTokenGuard } from '@app/common/guards/jwt-refresh.auth.guard';
import { AdminRoleGuard } from 'src/guards/admin.role.guard';
import { SuperAdminRoleGuard } from 'src/guards/super.admin.role.guard';
@Controller({
version: '1',
@ -52,7 +52,7 @@ export class UserAuthController {
}
@ApiBearerAuth()
@UseGuards(AdminRoleGuard)
@UseGuards(SuperAdminRoleGuard)
@Delete('user/delete/:id')
async userDelete(@Param('id') id: string) {
await this.userAuthService.deleteUser(id);
@ -98,7 +98,7 @@ export class UserAuthController {
}
@ApiBearerAuth()
@UseGuards(AdminRoleGuard)
@UseGuards(SuperAdminRoleGuard)
@Get('user/list')
async userList() {
const userList = await this.userAuthService.userList();