mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-10 23:49:08 +00:00
FEAT: new route for updating Roles and changed hierarchy to string
This commit is contained in:
@@ -67,3 +67,19 @@ export class UnassignPermissionsToRoleRes {
|
||||
@ApiProperty()
|
||||
role: Role;
|
||||
}
|
||||
|
||||
export class UpdateRoleReq {
|
||||
@ApiPropertyOptional()
|
||||
name: string;
|
||||
@ApiPropertyOptional()
|
||||
description: string;
|
||||
@ApiPropertyOptional()
|
||||
userIds: string;
|
||||
@ApiPropertyOptional()
|
||||
permissionIds: string;
|
||||
}
|
||||
|
||||
export class UpdateRoleRes {
|
||||
@ApiProperty()
|
||||
role: Role;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
Get,
|
||||
Inject,
|
||||
Param,
|
||||
Patch,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
@@ -22,6 +23,7 @@ import {
|
||||
GetRolesByCustomerRes,
|
||||
UnassignPermissionsToRoleReq,
|
||||
UnassignPermissionsToRoleRes,
|
||||
UpdateRoleReq,
|
||||
} from './dto/entities';
|
||||
|
||||
@ApiTags('Roles')
|
||||
@@ -72,4 +74,13 @@ export class RolesController {
|
||||
) {
|
||||
this.logger.info('unassignPermissionsToRole', { user });
|
||||
}
|
||||
@Patch(':id')
|
||||
@ApiResponse({ type: UpdateRoleRes })
|
||||
async updateRole(
|
||||
@User() user,
|
||||
@Param('id') id: string,
|
||||
@Body() body: UpdateRoleReq,
|
||||
) {
|
||||
this.logger.info('updateRole', { user });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class User {
|
||||
@ApiProperty()
|
||||
department: string;
|
||||
@ApiProperty()
|
||||
hierarchy: number;
|
||||
hierarchy: string;
|
||||
@ApiProperty()
|
||||
customer: Customer;
|
||||
@ApiProperty()
|
||||
@@ -52,7 +52,7 @@ export class UserWithoutRoles {
|
||||
@ApiProperty()
|
||||
department: string;
|
||||
@ApiProperty()
|
||||
hierarchy: number;
|
||||
hierarchy: string;
|
||||
@ApiProperty()
|
||||
customer: Customer;
|
||||
@ApiProperty()
|
||||
@@ -90,7 +90,7 @@ export class CreateUserReq {
|
||||
@ApiPropertyOptional()
|
||||
department: string;
|
||||
@ApiPropertyOptional()
|
||||
hierarchy: number;
|
||||
hierarchy: string;
|
||||
}
|
||||
export class CreateUserRes {
|
||||
@ApiProperty()
|
||||
|
||||
Reference in New Issue
Block a user