clean
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Controller, Get, Post, Body, Param, Patch, Delete, UseGuards } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBody, ApiResponse, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { ApiTags, ApiOperation, ApiBody, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { RolesService } from '../providers/roles.service';
|
||||
import { PermissionsService } from '../providers/permissions.service';
|
||||
import { CreateRoleDto } from '../dto/create-role.dto';
|
||||
@@ -21,14 +21,12 @@ export class RolesController {
|
||||
|
||||
@Get()
|
||||
@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.getAdminFullPermissions(adminId, restId);
|
||||
|
||||
@@ -39,15 +37,12 @@ export class RolesController {
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'Create a new role' })
|
||||
@ApiBody({ type: CreateRoleDto })
|
||||
@ApiResponse({ status: 201, description: 'Role created successfully' })
|
||||
create(@Body() dto: CreateRoleDto, @RestId() restId: string) {
|
||||
return this.roleService.createRestaurantRole(dto, restId);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@ApiOperation({ summary: 'Get a specific role by ID' })
|
||||
@ApiResponse({ status: 200, description: 'Role retrieved successfully' })
|
||||
@ApiResponse({ status: 404, description: 'Role not found' })
|
||||
findOne(@Param('id') id: string, @RestId() restId: string) {
|
||||
return this.roleService.findOne(restId, id);
|
||||
}
|
||||
@@ -55,16 +50,12 @@ export class RolesController {
|
||||
@Patch(':id')
|
||||
@ApiOperation({ summary: 'Update a role' })
|
||||
@ApiBody({ type: UpdateRoleDto })
|
||||
@ApiResponse({ status: 200, description: 'Role updated successfully' })
|
||||
@ApiResponse({ status: 404, description: 'Role not found' })
|
||||
update(@Param('id') id: string, @Body() dto: UpdateRoleDto, @RestId() restId: string) {
|
||||
return this.roleService.update(restId, id, dto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@ApiOperation({ summary: 'Delete a role' })
|
||||
@ApiResponse({ status: 200, description: 'Role deleted successfully' })
|
||||
@ApiResponse({ status: 404, description: 'Role not found' })
|
||||
remove(@Param('id') id: string, @RestId() restId: string) {
|
||||
return this.roleService.remove(restId, id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user