feat: user now responsible for multiple area
This commit is contained in:
parent
1a255b6046
commit
cd58a4bc36
2 changed files with 21 additions and 3 deletions
|
|
@ -392,7 +392,7 @@ model User {
|
|||
importNationality String?
|
||||
|
||||
trainingPlace String?
|
||||
responsibleArea String?
|
||||
responsibleArea UserResponsibleArea[]
|
||||
|
||||
birthDate DateTime? @db.Date
|
||||
|
||||
|
|
@ -454,6 +454,13 @@ model User {
|
|||
notificationRead Notification[]
|
||||
}
|
||||
|
||||
model UserResponsibleArea {
|
||||
id String @id @default(cuid())
|
||||
area String
|
||||
|
||||
user User[]
|
||||
}
|
||||
|
||||
enum CustomerType {
|
||||
CORP
|
||||
PERS
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ type UserCreate = {
|
|||
sourceNationality?: string | null;
|
||||
importNationality?: string | null;
|
||||
trainingPlace?: string | null;
|
||||
responsibleArea?: string | null;
|
||||
responsibleArea?: string[] | null;
|
||||
birthDate?: Date | null;
|
||||
|
||||
address: string;
|
||||
|
|
@ -153,7 +153,7 @@ type UserUpdate = {
|
|||
sourceNationality?: string | null;
|
||||
importNationality?: string | null;
|
||||
trainingPlace?: string | null;
|
||||
responsibleArea?: string | null;
|
||||
responsibleArea?: string[];
|
||||
birthDate?: Date | null;
|
||||
|
||||
address?: string;
|
||||
|
|
@ -432,6 +432,11 @@ export class UserController extends Controller {
|
|||
data: {
|
||||
id: userId,
|
||||
...rest,
|
||||
responsibleArea: rest.responsibleArea
|
||||
? {
|
||||
create: rest.responsibleArea.map((v) => ({ area: v })),
|
||||
}
|
||||
: undefined,
|
||||
statusOrder: +(rest.status === "INACTIVE"),
|
||||
username,
|
||||
userRole: role.name,
|
||||
|
|
@ -591,6 +596,12 @@ export class UserController extends Controller {
|
|||
},
|
||||
data: {
|
||||
...rest,
|
||||
responsibleArea: rest.responsibleArea
|
||||
? {
|
||||
deleteMany: {},
|
||||
create: rest.responsibleArea.map((v) => ({ area: v })),
|
||||
}
|
||||
: undefined,
|
||||
statusOrder: +(rest.status === "INACTIVE"),
|
||||
userRole,
|
||||
province: connectOrDisconnect(provinceId),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue