mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-22 13:19:08 +00:00
FEAT: Roles WIP
This commit is contained in:
@@ -1,30 +1,39 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
||||
import { Permission } from 'src/modules/permissions/dto/entities';
|
||||
import { UserWithoutRoles } from 'src/modules/users/dtos/entities';
|
||||
import {
|
||||
Customer,
|
||||
UserNoRolesAndCustomer,
|
||||
} from 'src/modules/users/dtos/entities';
|
||||
export class Role {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
@ApiProperty()
|
||||
description: string;
|
||||
@ApiPropertyOptional({ type: () => [Permission] })
|
||||
permissions: Permission[];
|
||||
@ApiPropertyOptional({ type: () => [UserWithoutRoles] })
|
||||
users: UserWithoutRoles[];
|
||||
@ApiPropertyOptional({ type: () => [UserNoRolesAndCustomer] })
|
||||
users: UserNoRolesAndCustomer[];
|
||||
@ApiProperty()
|
||||
createdAt: string;
|
||||
@ApiProperty()
|
||||
updatedAt: string;
|
||||
@ApiProperty({ type: () => Customer })
|
||||
customer?: Customer;
|
||||
}
|
||||
|
||||
export class CustomerRole extends OmitType(Role, ['customer']) {}
|
||||
|
||||
export enum TrueOrFalseEnum {
|
||||
true = 'true',
|
||||
false = 'false',
|
||||
}
|
||||
export class GetRolesByCustomerReq {
|
||||
@ApiPropertyOptional()
|
||||
permission_id: string[];
|
||||
permissionIds: string[];
|
||||
@ApiPropertyOptional({ enum: TrueOrFalseEnum })
|
||||
get_users: TrueOrFalseEnum;
|
||||
getUsers: TrueOrFalseEnum;
|
||||
}
|
||||
|
||||
export class GetRolesByCustomerRes {
|
||||
@@ -35,7 +44,7 @@ export class CreateRoleReq {
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
@ApiProperty()
|
||||
permissionIds: string[];
|
||||
permissionIds: number[];
|
||||
@ApiPropertyOptional()
|
||||
userIds: string[];
|
||||
@ApiProperty()
|
||||
@@ -43,7 +52,7 @@ export class CreateRoleReq {
|
||||
}
|
||||
export class CreateRoleRes {
|
||||
@ApiProperty()
|
||||
role: Role;
|
||||
role: CustomerRole;
|
||||
}
|
||||
|
||||
export class AssignPermissionsToRoleReq {
|
||||
|
||||
Reference in New Issue
Block a user