FEAT: User module init

This commit is contained in:
Gabriel Rosa
2022-07-07 15:57:40 -03:00
parent 59ffb24985
commit 4356adea65
7 changed files with 286 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class Customer {
@ApiProperty()
id: string;
@ApiProperty()
name: string;
@ApiProperty()
domain: string;
@ApiProperty()
tier: string;
@ApiProperty()
info: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class Permission {
@ApiProperty()
id: string;
@ApiProperty()
seqid: number;
@ApiProperty()
name: string;
@ApiProperty()
claim: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class Role {
@ApiProperty({ type: [Permission] })
permissions: Permission[];
@ApiProperty()
id: string;
@ApiProperty()
name: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class UserByCustomer {
@ApiProperty({ type: [Role] })
roles: Role[];
@ApiProperty()
id: string;
@ApiProperty()
name: string;
@ApiProperty()
username: string;
@ApiProperty()
mfaStatus: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class User {
@ApiProperty()
id: string;
@ApiProperty()
name: string;
@ApiProperty()
username: string;
@ApiProperty()
UserRole: string[];
@ApiProperty()
customer: Customer;
@ApiProperty()
mfaStatus: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class GetAllUsersByCustomerIdReq {
@ApiPropertyOptional()
s: string;
}
export class GetAllUsersByCustomerIdRes {
@ApiProperty({ type: [UserByCustomer] })
users: UserByCustomer[];
}
export class AssignRoleToUserReq {
@ApiProperty()
userId: string;
@ApiProperty()
roleId: string;
}
export class UnassignRoleToUserReq {
@ApiProperty()
userId: string;
@ApiProperty()
roleId: string;
}
export class SearchUserReq {
@ApiProperty()
s: string;
}
export class SearchUserRes extends GetAllUsersByCustomerIdRes {}