FEAT: Roles WIP

This commit is contained in:
Gabriel Rosa
2022-07-14 10:23:04 -03:00
parent d5cd562860
commit 14cfc46492
15 changed files with 247 additions and 116 deletions
+16 -34
View File
@@ -1,4 +1,4 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
import { Role } from 'src/modules/roles/dto/entities';
export class Customer {
@ApiProperty()
@@ -26,35 +26,13 @@ export class User {
@ApiProperty({ type: [Role] })
roles: Role[];
@ApiProperty()
jobTitle: string;
jobTitle?: string;
@ApiProperty()
department: string;
department?: string;
@ApiProperty()
hierarchy: string;
@ApiProperty()
customer: Customer;
@ApiProperty()
mfaStatus: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class UserWithoutRoles {
@ApiProperty()
id: string;
@ApiProperty()
name: string;
@ApiProperty()
email: string;
@ApiProperty()
jobTitle: string;
@ApiProperty()
department: string;
@ApiProperty()
hierarchy: string;
@ApiProperty()
customer: Customer;
hierarchy?: string;
@ApiPropertyOptional()
customer?: Customer;
@ApiProperty()
mfaStatus: string;
@ApiProperty()
@@ -62,6 +40,10 @@ export class UserWithoutRoles {
@ApiProperty()
updatedAt: string;
}
export class UserNoRoles extends OmitType(User, ['roles']) {}
export class UserNoRolesAndCustomer extends OmitType(UserNoRoles, [
'customer',
]) {}
export class UserByCustomer {
@ApiProperty({ type: [Role] })
roles: Role[];
@@ -80,17 +62,17 @@ export class UserByCustomer {
}
export class CreateUserReq {
@ApiPropertyOptional()
name: string;
name?: string;
@ApiProperty()
email: string;
@ApiPropertyOptional()
roles: string[];
roles?: string[];
@ApiPropertyOptional()
jobTitle: string;
jobTitle?: string;
@ApiPropertyOptional()
department: string;
department?: string;
@ApiPropertyOptional()
hierarchy: string;
hierarchy?: string;
}
export class CreateUserRes {
@ApiProperty()
@@ -107,7 +89,7 @@ export class BatchCreateUserRes {
export class GetAllUsersByCustomerIdReq {
@ApiPropertyOptional()
s: string;
s?: string;
}
export class GetAllUsersByCustomerIdRes {
@ApiProperty({ type: [UserByCustomer] })