roles
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { Controller, Get, Post, Body, Param, Patch, Delete, Query, UseGuards } from '@nestjs/common';
|
||||
import { Controller, Get, Post, Body, Param, Patch, Delete, UseGuards } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBody, ApiResponse, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { RolesService } from '../providers/roles.service';
|
||||
import { PermissionsService } from '../providers/permissions.service';
|
||||
import { CreateRoleDto } from '../dto/create-role.dto';
|
||||
import { UpdateRoleDto } from '../dto/update-role.dto';
|
||||
import { FindRolesDto } from '../dto/find-roles.dto';
|
||||
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
||||
import { Permissions } from 'src/modules/auth/decorators/permissions.decorator';
|
||||
import { RestId } from 'src/common/decorators';
|
||||
@@ -21,17 +20,17 @@ export class RolesController {
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'Get all roles with pagination and filters' })
|
||||
@ApiResponse({ status: 200, description: 'Roles retrieved successfully' })
|
||||
findAll(@Query() dto: FindRolesDto, @RestId() restId: string) {
|
||||
return this.roleService.findAll(restId, dto);
|
||||
@ApiOperation({ summary: 'Get all through restaurant roles with pagination and filters' })
|
||||
@ApiResponse({ status: 200, description: 'Restaurant roles retrieved successfully' })
|
||||
findAll(@RestId() restId: string) {
|
||||
return this.roleService.findAllGeneralAndRestaurantRoles(restId);
|
||||
}
|
||||
|
||||
@Get('permissions')
|
||||
@ApiOperation({ summary: 'Get all permissions that the admin has' })
|
||||
@ApiResponse({ status: 200, description: 'Permissions retrieved successfully' })
|
||||
async findAllPermissions(@AdminId() adminId: string, @RestId() restId: string) {
|
||||
const adminPermissionNames = await this.permissionService.getFullAdminPermissions(adminId, restId);
|
||||
const adminPermissionNames = await this.permissionService.getAdminFullPermissions(adminId, restId);
|
||||
|
||||
return adminPermissionNames;
|
||||
}
|
||||
@@ -42,7 +41,7 @@ export class RolesController {
|
||||
@ApiBody({ type: CreateRoleDto })
|
||||
@ApiResponse({ status: 201, description: 'Role created successfully' })
|
||||
create(@Body() dto: CreateRoleDto, @RestId() restId: string) {
|
||||
return this.roleService.create(restId, dto);
|
||||
return this.roleService.createRestaurantRole(dto, restId);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
|
||||
Reference in New Issue
Block a user