storemw-core-client 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,6 @@ import { BuildApiListParamsProps, BuildApiGetParamsProps } from '../../lib';
|
|
|
3
3
|
export declare const userTypes: {
|
|
4
4
|
readonly administrator: "administrator";
|
|
5
5
|
readonly worker: "worker";
|
|
6
|
-
readonly supplier: "supplier";
|
|
7
6
|
readonly customer: "customer";
|
|
8
7
|
readonly driver: "driver";
|
|
9
8
|
readonly retailer: "retailer";
|
|
@@ -14,7 +13,6 @@ export declare const userTypes: {
|
|
|
14
13
|
export declare const userTargetTypes: {
|
|
15
14
|
readonly administrator: "administrator";
|
|
16
15
|
readonly worker: "worker";
|
|
17
|
-
readonly supplier: "supplier";
|
|
18
16
|
readonly customer: "customer";
|
|
19
17
|
readonly driver: "driver";
|
|
20
18
|
readonly retailer: "retailer";
|
|
@@ -36,25 +34,31 @@ export type GetUserProps = BuildApiGetParamsProps & {
|
|
|
36
34
|
id: number | string;
|
|
37
35
|
userType?: UserType;
|
|
38
36
|
};
|
|
39
|
-
type Gender = "male" | "female";
|
|
40
|
-
type AssignSupplierType = "admin" | "retail";
|
|
37
|
+
type Gender = "male" | "female" | "other";
|
|
41
38
|
type UserCredential = {
|
|
42
39
|
username: string;
|
|
43
40
|
password: string;
|
|
44
41
|
firstname: string;
|
|
45
42
|
lastname: string;
|
|
46
43
|
contact: string;
|
|
44
|
+
address?: string;
|
|
47
45
|
email: string;
|
|
48
46
|
status: boolean;
|
|
49
|
-
|
|
47
|
+
};
|
|
48
|
+
type UserCredentialWithoutPassword = Omit<UserCredential, "password"> & {
|
|
49
|
+
password?: string;
|
|
50
50
|
};
|
|
51
51
|
export type CreateUserProps = {
|
|
52
52
|
userTargetType?: UserTargetType;
|
|
53
53
|
userType?: UserType;
|
|
54
54
|
data: {
|
|
55
|
+
operator: {
|
|
56
|
+
credential: UserCredential;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
55
59
|
administrator: {
|
|
56
60
|
credential: UserCredential;
|
|
57
|
-
locationIds:
|
|
61
|
+
locationIds: string[];
|
|
58
62
|
};
|
|
59
63
|
} | {
|
|
60
64
|
customer: {
|
|
@@ -64,11 +68,11 @@ export type CreateUserProps = {
|
|
|
64
68
|
companyName: string;
|
|
65
69
|
regNo: string;
|
|
66
70
|
secondaryRegNo: string;
|
|
71
|
+
gstNo: string;
|
|
67
72
|
taxIdentificationNo: string;
|
|
68
73
|
taxRegistrationNo: string;
|
|
69
74
|
remark: string;
|
|
70
75
|
salesperson: string;
|
|
71
|
-
excludeTaxRate: number[];
|
|
72
76
|
};
|
|
73
77
|
} | {
|
|
74
78
|
retailer: {
|
|
@@ -76,48 +80,45 @@ export type CreateUserProps = {
|
|
|
76
80
|
code: string;
|
|
77
81
|
accountCode: string;
|
|
78
82
|
companyName: string;
|
|
83
|
+
gstNo: string;
|
|
79
84
|
regNo: string;
|
|
80
85
|
remark: string;
|
|
81
|
-
isDifferentBusiness: boolean;
|
|
82
|
-
businessId: number;
|
|
83
86
|
};
|
|
84
87
|
} | {
|
|
85
88
|
worker: {
|
|
86
89
|
credential: UserCredential;
|
|
87
90
|
remark: string;
|
|
88
|
-
locationIds:
|
|
91
|
+
locationIds: string[];
|
|
89
92
|
};
|
|
90
93
|
} | {
|
|
91
94
|
driver: {
|
|
92
95
|
credential: UserCredential;
|
|
93
96
|
companyName: string;
|
|
94
97
|
remark: string;
|
|
95
|
-
locationIds:
|
|
98
|
+
locationIds: string[];
|
|
96
99
|
};
|
|
97
100
|
} | {
|
|
98
|
-
|
|
101
|
+
member: {
|
|
99
102
|
credential: UserCredential;
|
|
100
|
-
|
|
103
|
+
ownerUserId: number;
|
|
104
|
+
code?: string;
|
|
101
105
|
companyName: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
remark: string;
|
|
106
|
+
identityNo: string;
|
|
107
|
+
gender: Gender;
|
|
108
|
+
dob: string;
|
|
106
109
|
address1: string;
|
|
107
110
|
address2: string;
|
|
108
|
-
postcode: string;
|
|
109
111
|
countryId: number;
|
|
110
112
|
stateId: number;
|
|
111
113
|
areaId: number;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
itemIds: number[];
|
|
115
|
-
retailerId?: number;
|
|
114
|
+
postcode: string;
|
|
115
|
+
remark: string;
|
|
116
116
|
};
|
|
117
117
|
} & {
|
|
118
|
-
|
|
118
|
+
agent: {
|
|
119
119
|
credential: UserCredential;
|
|
120
|
-
ownerUserId: number
|
|
120
|
+
ownerUserId: number;
|
|
121
|
+
code?: string;
|
|
121
122
|
companyName: string;
|
|
122
123
|
identityNo: string;
|
|
123
124
|
gender: Gender;
|
|
@@ -137,86 +138,69 @@ export type UpdateUserProps = {
|
|
|
137
138
|
userTargetType?: UserTargetType;
|
|
138
139
|
userType?: UserType;
|
|
139
140
|
data: {
|
|
141
|
+
operator: {
|
|
142
|
+
credential: UserCredentialWithoutPassword;
|
|
143
|
+
};
|
|
144
|
+
} | {
|
|
140
145
|
administrator: {
|
|
141
|
-
credential:
|
|
142
|
-
|
|
143
|
-
};
|
|
144
|
-
locationIds: number[];
|
|
146
|
+
credential: UserCredentialWithoutPassword;
|
|
147
|
+
locationIds: string[];
|
|
145
148
|
};
|
|
146
149
|
} | {
|
|
147
150
|
customer: {
|
|
148
|
-
credential:
|
|
149
|
-
password?: string;
|
|
150
|
-
};
|
|
151
|
+
credential: UserCredentialWithoutPassword;
|
|
151
152
|
code: string;
|
|
152
153
|
accountCode: string;
|
|
153
154
|
companyName: string;
|
|
154
155
|
regNo: string;
|
|
155
156
|
secondaryRegNo: string;
|
|
157
|
+
gstNo: string;
|
|
156
158
|
taxIdentificationNo: string;
|
|
157
159
|
taxRegistrationNo: string;
|
|
158
160
|
remark: string;
|
|
159
161
|
salesperson: string;
|
|
160
|
-
excludeTaxRate: number[];
|
|
161
162
|
};
|
|
162
163
|
} | {
|
|
163
164
|
retailer: {
|
|
164
|
-
credential:
|
|
165
|
-
password?: string;
|
|
166
|
-
};
|
|
165
|
+
credential: UserCredentialWithoutPassword;
|
|
167
166
|
code: string;
|
|
168
167
|
accountCode: string;
|
|
169
168
|
companyName: string;
|
|
170
169
|
regNo: string;
|
|
170
|
+
gstNo: string;
|
|
171
171
|
remark: string;
|
|
172
|
-
isDifferentBusiness: boolean;
|
|
173
|
-
businessId: number;
|
|
174
172
|
};
|
|
175
173
|
} | {
|
|
176
174
|
worker: {
|
|
177
|
-
credential:
|
|
178
|
-
password?: string;
|
|
179
|
-
};
|
|
175
|
+
credential: UserCredentialWithoutPassword;
|
|
180
176
|
remark: string;
|
|
181
|
-
locationIds:
|
|
177
|
+
locationIds: string[];
|
|
182
178
|
};
|
|
183
179
|
} | {
|
|
184
180
|
driver: {
|
|
185
|
-
credential:
|
|
186
|
-
password?: string;
|
|
187
|
-
};
|
|
181
|
+
credential: UserCredentialWithoutPassword;
|
|
188
182
|
companyName: string;
|
|
189
183
|
remark: string;
|
|
190
|
-
locationIds:
|
|
184
|
+
locationIds: string[];
|
|
191
185
|
};
|
|
192
186
|
} | {
|
|
193
|
-
|
|
194
|
-
credential:
|
|
195
|
-
password?: string;
|
|
196
|
-
};
|
|
197
|
-
type: AssignSupplierType;
|
|
187
|
+
member: {
|
|
188
|
+
credential: UserCredentialWithoutPassword;
|
|
198
189
|
companyName: string;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
remark: string;
|
|
190
|
+
identityNo: string;
|
|
191
|
+
gender: Gender;
|
|
192
|
+
dob: string;
|
|
203
193
|
address1: string;
|
|
204
194
|
address2: string;
|
|
205
|
-
postcode: string;
|
|
206
195
|
countryId: number;
|
|
207
196
|
stateId: number;
|
|
208
197
|
areaId: number;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
itemIds: number[];
|
|
212
|
-
retailerId?: number;
|
|
198
|
+
postcode: string;
|
|
199
|
+
remark: string;
|
|
213
200
|
};
|
|
214
201
|
} | {
|
|
215
|
-
|
|
216
|
-
credential:
|
|
217
|
-
password?: string;
|
|
218
|
-
};
|
|
219
|
-
ownerUserId: number;
|
|
202
|
+
agent: {
|
|
203
|
+
credential: UserCredentialWithoutPassword;
|
|
220
204
|
companyName: string;
|
|
221
205
|
identityNo: string;
|
|
222
206
|
gender: Gender;
|
|
@@ -5,7 +5,7 @@ const lib_1 = require("../../lib");
|
|
|
5
5
|
exports.userTypes = {
|
|
6
6
|
administrator: "administrator",
|
|
7
7
|
worker: "worker",
|
|
8
|
-
supplier: "supplier",
|
|
8
|
+
// supplier: "supplier",
|
|
9
9
|
customer: "customer",
|
|
10
10
|
driver: "driver",
|
|
11
11
|
retailer: "retailer",
|
|
@@ -16,7 +16,7 @@ exports.userTypes = {
|
|
|
16
16
|
exports.userTargetTypes = {
|
|
17
17
|
administrator: "administrator",
|
|
18
18
|
worker: "worker",
|
|
19
|
-
supplier: "supplier",
|
|
19
|
+
// supplier: "supplier",
|
|
20
20
|
customer: "customer",
|
|
21
21
|
driver: "driver",
|
|
22
22
|
retailer: "retailer",
|
|
@@ -25,175 +25,132 @@ exports.userTargetTypes = {
|
|
|
25
25
|
agent: "agent",
|
|
26
26
|
};
|
|
27
27
|
const getCreatePayload = (userType, data) => {
|
|
28
|
-
|
|
28
|
+
const getCredentialPayload = (values) => {
|
|
29
29
|
return {
|
|
30
30
|
credential: {
|
|
31
|
-
username:
|
|
32
|
-
password:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
username: values.username,
|
|
32
|
+
password: values.password,
|
|
33
|
+
firstname: values.firstname,
|
|
34
|
+
lastname: values.lastname,
|
|
35
|
+
contact: values.contact,
|
|
36
|
+
email: values.email,
|
|
37
|
+
status: Boolean(values.status),
|
|
38
|
+
address: values.address
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
if (userType === "operator" && "operator" in data) {
|
|
43
|
+
return {
|
|
44
|
+
...getCredentialPayload(data.operator.credential),
|
|
45
|
+
operator: {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (userType === "administrator" && "administrator" in data) {
|
|
49
|
+
return {
|
|
50
|
+
...getCredentialPayload(data.administrator.credential),
|
|
41
51
|
administrator: [],
|
|
42
52
|
props: {
|
|
43
|
-
|
|
53
|
+
location_ids: data.administrator.locationIds
|
|
44
54
|
}
|
|
45
55
|
};
|
|
46
56
|
}
|
|
47
57
|
if (userType === "customer" && "customer" in data) {
|
|
48
58
|
return {
|
|
49
|
-
credential
|
|
50
|
-
username: data.customer.credential.username,
|
|
51
|
-
password: data.customer.credential.password,
|
|
52
|
-
user_type: userType,
|
|
53
|
-
firstname: data.customer.credential.firstname,
|
|
54
|
-
lastname: data.customer.credential.lastname,
|
|
55
|
-
contact: data.customer.credential.contact,
|
|
56
|
-
email: data.customer.credential.email,
|
|
57
|
-
status: (data.customer.credential.status === true) ? 1 : 0,
|
|
58
|
-
address: data.customer.credential.address
|
|
59
|
-
},
|
|
59
|
+
...getCredentialPayload(data.customer.credential),
|
|
60
60
|
customer: {
|
|
61
61
|
code: data.customer.code,
|
|
62
62
|
account_code: data.customer.accountCode,
|
|
63
63
|
company_name: data.customer.companyName,
|
|
64
64
|
reg_no: data.customer.regNo,
|
|
65
65
|
secondary_reg_no: data.customer.secondaryRegNo,
|
|
66
|
+
gst_no: data.customer.gstNo,
|
|
66
67
|
remark: data.customer.remark,
|
|
67
68
|
tax_identification_no: data.customer.taxIdentificationNo,
|
|
68
69
|
tax_registration_no: data.customer.taxRegistrationNo,
|
|
69
70
|
},
|
|
70
71
|
props: {
|
|
71
72
|
salesperson: data.customer.salesperson,
|
|
72
|
-
exclude_tax_rate: data.customer.excludeTaxRate
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
if (userType === "retailer" && "retailer" in data) {
|
|
77
77
|
return {
|
|
78
|
-
credential
|
|
79
|
-
username: data.retailer.credential.username,
|
|
80
|
-
password: data.retailer.credential.password,
|
|
81
|
-
user_type: userType,
|
|
82
|
-
firstname: data.retailer.credential.firstname,
|
|
83
|
-
lastname: data.retailer.credential.lastname,
|
|
84
|
-
contact: data.retailer.credential.contact,
|
|
85
|
-
email: data.retailer.credential.email,
|
|
86
|
-
status: (data.retailer.credential.status === true) ? 1 : 0,
|
|
87
|
-
address: data.retailer.credential.address
|
|
88
|
-
},
|
|
78
|
+
...getCredentialPayload(data.retailer.credential),
|
|
89
79
|
retailer: {
|
|
90
80
|
code: data.retailer.code,
|
|
91
81
|
account_code: data.retailer.accountCode,
|
|
92
82
|
company_name: data.retailer.companyName,
|
|
93
83
|
reg_no: data.retailer.regNo,
|
|
84
|
+
gst_no: data.retailer.gstNo,
|
|
94
85
|
remark: data.retailer.remark
|
|
95
86
|
},
|
|
96
|
-
props: {
|
|
97
|
-
business_id: data.retailer.businessId
|
|
98
|
-
},
|
|
99
|
-
status: {
|
|
100
|
-
is_different_business: (data.retailer.isDifferentBusiness === true) ? 1 : 0
|
|
101
|
-
}
|
|
87
|
+
props: {}
|
|
102
88
|
};
|
|
103
89
|
}
|
|
104
90
|
if (userType === "worker" && "worker" in data) {
|
|
105
91
|
return {
|
|
106
|
-
credential
|
|
107
|
-
username: data.worker.credential.username,
|
|
108
|
-
password: data.worker.credential.password,
|
|
109
|
-
user_type: userType,
|
|
110
|
-
firstname: data.worker.credential.firstname,
|
|
111
|
-
lastname: data.worker.credential.lastname,
|
|
112
|
-
contact: data.worker.credential.contact,
|
|
113
|
-
email: data.worker.credential.email,
|
|
114
|
-
status: (data.worker.credential.status === true) ? 1 : 0,
|
|
115
|
-
address: data.worker.credential.address
|
|
116
|
-
},
|
|
92
|
+
...getCredentialPayload(data.worker.credential),
|
|
117
93
|
worker: {
|
|
118
94
|
remark: data.worker.remark
|
|
119
95
|
},
|
|
120
96
|
props: {
|
|
121
|
-
|
|
97
|
+
location_ids: data.worker.locationIds
|
|
122
98
|
}
|
|
123
99
|
};
|
|
124
100
|
}
|
|
125
101
|
if (userType === "driver" && "driver" in data) {
|
|
126
102
|
return {
|
|
127
|
-
credential
|
|
128
|
-
username: data.driver.credential.username,
|
|
129
|
-
password: data.driver.credential.password,
|
|
130
|
-
user_type: userType,
|
|
131
|
-
firstname: data.driver.credential.firstname,
|
|
132
|
-
lastname: data.driver.credential.lastname,
|
|
133
|
-
contact: data.driver.credential.contact,
|
|
134
|
-
email: data.driver.credential.email,
|
|
135
|
-
status: (data.driver.credential.status === true) ? 1 : 0,
|
|
136
|
-
address: data.driver.credential.address
|
|
137
|
-
},
|
|
103
|
+
...getCredentialPayload(data.driver.credential),
|
|
138
104
|
driver: {
|
|
139
105
|
company_name: data.driver.companyName,
|
|
140
106
|
remark: data.driver.remark
|
|
141
107
|
},
|
|
142
108
|
props: {
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
if (userType === "supplier" && "supplier" in data) {
|
|
148
|
-
return {
|
|
149
|
-
credential: {
|
|
150
|
-
username: data.supplier.credential.username,
|
|
151
|
-
password: data.supplier.credential.password,
|
|
152
|
-
user_type: userType,
|
|
153
|
-
firstname: data.supplier.credential.firstname,
|
|
154
|
-
lastname: data.supplier.credential.lastname,
|
|
155
|
-
contact: data.supplier.credential.contact,
|
|
156
|
-
email: data.supplier.credential.email,
|
|
157
|
-
status: (data.supplier.credential.status === true) ? 1 : 0,
|
|
158
|
-
address: data.supplier.credential.address
|
|
159
|
-
},
|
|
160
|
-
supplier: {
|
|
161
|
-
type: data.supplier.type,
|
|
162
|
-
company_name: data.supplier.companyName,
|
|
163
|
-
contact: data.supplier.contact,
|
|
164
|
-
code: data.supplier.code,
|
|
165
|
-
reg_no: data.supplier.regNo,
|
|
166
|
-
remark: data.supplier.remark,
|
|
167
|
-
address_1: data.supplier.address1,
|
|
168
|
-
address_2: data.supplier.address2,
|
|
169
|
-
postcode: data.supplier.postcode,
|
|
170
|
-
country_id: data.supplier.countryId,
|
|
171
|
-
state_id: data.supplier.stateId,
|
|
172
|
-
area_id: data.supplier.areaId,
|
|
173
|
-
bank_name: data.supplier.bankName,
|
|
174
|
-
bank_acc: data.supplier.bankAcc
|
|
175
|
-
},
|
|
176
|
-
props: {
|
|
177
|
-
item_id: data.supplier.itemIds,
|
|
178
|
-
retailer_id: data.supplier.retailerId
|
|
109
|
+
location_ids: data.driver.locationIds
|
|
179
110
|
}
|
|
180
111
|
};
|
|
181
112
|
}
|
|
113
|
+
// if (userType === "supplier" && "supplier" in data) {
|
|
114
|
+
// return {
|
|
115
|
+
// credential: {
|
|
116
|
+
// username: data.supplier.credential.username,
|
|
117
|
+
// password: data.supplier.credential.password,
|
|
118
|
+
// user_type: userType,
|
|
119
|
+
// firstname: data.supplier.credential.firstname,
|
|
120
|
+
// lastname: data.supplier.credential.lastname,
|
|
121
|
+
// contact: data.supplier.credential.contact,
|
|
122
|
+
// email: data.supplier.credential.email,
|
|
123
|
+
// status: (data.supplier.credential.status === true) ? 1 : 0,
|
|
124
|
+
// address: data.supplier.credential.address
|
|
125
|
+
// },
|
|
126
|
+
// supplier: {
|
|
127
|
+
// type: data.supplier.type,
|
|
128
|
+
// company_name: data.supplier.companyName,
|
|
129
|
+
// contact: data.supplier.contact,
|
|
130
|
+
// code: data.supplier.code,
|
|
131
|
+
// reg_no: data.supplier.regNo,
|
|
132
|
+
// remark: data.supplier.remark,
|
|
133
|
+
// address_1: data.supplier.address1,
|
|
134
|
+
// address_2: data.supplier.address2,
|
|
135
|
+
// postcode: data.supplier.postcode,
|
|
136
|
+
// country_id: data.supplier.countryId,
|
|
137
|
+
// state_id: data.supplier.stateId,
|
|
138
|
+
// area_id: data.supplier.areaId,
|
|
139
|
+
// bank_name: data.supplier.bankName,
|
|
140
|
+
// bank_acc: data.supplier.bankAcc
|
|
141
|
+
// },
|
|
142
|
+
// props: {
|
|
143
|
+
// item_id: data.supplier.itemIds,
|
|
144
|
+
// retailer_id: data.supplier.retailerId
|
|
145
|
+
// }
|
|
146
|
+
// }
|
|
147
|
+
// }
|
|
182
148
|
if (userType === "member" && "member" in data) {
|
|
183
149
|
return {
|
|
184
|
-
credential
|
|
185
|
-
username: data.member.credential.username,
|
|
186
|
-
password: data.member.credential.password,
|
|
187
|
-
user_type: userType,
|
|
188
|
-
firstname: data.member.credential.firstname,
|
|
189
|
-
lastname: data.member.credential.lastname,
|
|
190
|
-
contact: data.member.credential.contact,
|
|
191
|
-
email: data.member.credential.email,
|
|
192
|
-
status: (data.member.credential.status === true) ? 1 : 0,
|
|
193
|
-
address: data.member.credential.address
|
|
194
|
-
},
|
|
150
|
+
...getCredentialPayload(data.member.credential),
|
|
195
151
|
member: {
|
|
196
|
-
|
|
152
|
+
...(data?.member?.code ? { code: data.member.code } : {}),
|
|
153
|
+
owner_user_id: Number(data.member.ownerUserId),
|
|
197
154
|
company_name: data.member.companyName,
|
|
198
155
|
identity_no: data.member.identityNo,
|
|
199
156
|
gender: data.member.gender,
|
|
@@ -208,163 +165,150 @@ const getCreatePayload = (userType, data) => {
|
|
|
208
165
|
}
|
|
209
166
|
};
|
|
210
167
|
}
|
|
168
|
+
if (userType === "agent" && "agent" in data) {
|
|
169
|
+
return {
|
|
170
|
+
...getCredentialPayload(data.agent.credential),
|
|
171
|
+
agent: {
|
|
172
|
+
...(data?.agent?.code ? { code: data.agent.code } : {}),
|
|
173
|
+
owner_user_id: Number(data.agent.ownerUserId),
|
|
174
|
+
company_name: data.agent.companyName,
|
|
175
|
+
identity_no: data.agent.identityNo,
|
|
176
|
+
gender: data.agent.gender,
|
|
177
|
+
dob: data.agent.dob,
|
|
178
|
+
address_1: data.agent.address1,
|
|
179
|
+
address_2: data.agent.address2,
|
|
180
|
+
country_id: data.agent.countryId,
|
|
181
|
+
state_id: data.agent.stateId,
|
|
182
|
+
area_id: data.agent.areaId,
|
|
183
|
+
postcode: data.agent.postcode,
|
|
184
|
+
remark: data.agent.remark
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
211
188
|
};
|
|
212
189
|
const getUpdatePayload = (userType, data) => {
|
|
213
|
-
|
|
190
|
+
const getCredentialPayload = (values) => {
|
|
214
191
|
return {
|
|
215
192
|
credential: {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
193
|
+
username: values.username,
|
|
194
|
+
...(values?.password ? { password: values.password } : {}),
|
|
195
|
+
firstname: values.firstname,
|
|
196
|
+
lastname: values.lastname,
|
|
197
|
+
contact: values.contact,
|
|
198
|
+
email: values.email,
|
|
199
|
+
status: values.status,
|
|
200
|
+
address: values.address
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
if (userType === "operator" && "operator" in data) {
|
|
205
|
+
return {
|
|
206
|
+
...getCredentialPayload(data.operator.credential),
|
|
207
|
+
operator: {}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (userType === "administrator" && "administrator" in data) {
|
|
211
|
+
return {
|
|
212
|
+
...getCredentialPayload(data.administrator.credential),
|
|
213
|
+
administrator: {},
|
|
225
214
|
props: {
|
|
226
|
-
|
|
215
|
+
location_ids: data.administrator.locationIds
|
|
227
216
|
}
|
|
228
217
|
};
|
|
229
218
|
}
|
|
230
219
|
if (userType === "customer" && "customer" in data) {
|
|
231
220
|
return {
|
|
232
|
-
credential
|
|
233
|
-
...(data.customer.credential.password ? { password: data.customer.credential.password } : {}),
|
|
234
|
-
firstname: data.customer.credential.firstname,
|
|
235
|
-
lastname: data.customer.credential.lastname,
|
|
236
|
-
contact: data.customer.credential.contact,
|
|
237
|
-
email: data.customer.credential.email,
|
|
238
|
-
status: (data.customer.credential.status === true) ? 1 : 0,
|
|
239
|
-
address: data.customer.credential.address
|
|
240
|
-
},
|
|
221
|
+
...getCredentialPayload(data.customer.credential),
|
|
241
222
|
customer: {
|
|
242
223
|
code: data.customer.code,
|
|
243
224
|
account_code: data.customer.accountCode,
|
|
244
225
|
company_name: data.customer.companyName,
|
|
245
226
|
reg_no: data.customer.regNo,
|
|
246
227
|
secondary_reg_no: data.customer.secondaryRegNo,
|
|
228
|
+
gst_no: data.customer.gstNo,
|
|
247
229
|
remark: data.customer.remark,
|
|
248
230
|
tax_identification_no: data.customer.taxIdentificationNo,
|
|
249
231
|
tax_registration_no: data.customer.taxRegistrationNo,
|
|
250
232
|
},
|
|
251
233
|
props: {
|
|
252
|
-
salesperson: data.customer.salesperson
|
|
253
|
-
exclude_tax_rate: data.customer.excludeTaxRate
|
|
234
|
+
salesperson: data.customer.salesperson
|
|
254
235
|
}
|
|
255
236
|
};
|
|
256
237
|
}
|
|
257
238
|
if (userType === "retailer" && "retailer" in data) {
|
|
258
239
|
return {
|
|
259
|
-
credential
|
|
260
|
-
...(data.retailer.credential.password ? { password: data.retailer.credential.password } : {}),
|
|
261
|
-
firstname: data.retailer.credential.firstname,
|
|
262
|
-
lastname: data.retailer.credential.lastname,
|
|
263
|
-
contact: data.retailer.credential.contact,
|
|
264
|
-
email: data.retailer.credential.email,
|
|
265
|
-
status: (data.retailer.credential.status === true) ? 1 : 0,
|
|
266
|
-
address: data.retailer.credential.address
|
|
267
|
-
},
|
|
240
|
+
...getCredentialPayload(data.retailer.credential),
|
|
268
241
|
retailer: {
|
|
269
242
|
code: data.retailer.code,
|
|
270
243
|
account_code: data.retailer.accountCode,
|
|
271
244
|
company_name: data.retailer.companyName,
|
|
272
245
|
reg_no: data.retailer.regNo,
|
|
246
|
+
gst_no: data.retailer.gstNo,
|
|
273
247
|
remark: data.retailer.remark
|
|
274
248
|
},
|
|
275
|
-
props: {
|
|
276
|
-
business_id: data.retailer.businessId
|
|
277
|
-
},
|
|
278
|
-
status: {
|
|
279
|
-
is_different_business: (data.retailer.isDifferentBusiness === true) ? 1 : 0
|
|
280
|
-
}
|
|
249
|
+
props: {}
|
|
281
250
|
};
|
|
282
251
|
}
|
|
283
252
|
if (userType === "worker" && "worker" in data) {
|
|
284
253
|
return {
|
|
285
|
-
credential
|
|
286
|
-
...(data.worker.credential.password ? { password: data.worker.credential.password } : {}),
|
|
287
|
-
firstname: data.worker.credential.firstname,
|
|
288
|
-
lastname: data.worker.credential.lastname,
|
|
289
|
-
contact: data.worker.credential.contact,
|
|
290
|
-
email: data.worker.credential.email,
|
|
291
|
-
status: (data.worker.credential.status === true) ? 1 : 0,
|
|
292
|
-
address: data.worker.credential.address
|
|
293
|
-
},
|
|
254
|
+
...getCredentialPayload(data.worker.credential),
|
|
294
255
|
worker: {
|
|
295
256
|
remark: data.worker.remark
|
|
296
257
|
},
|
|
297
258
|
props: {
|
|
298
|
-
|
|
259
|
+
location_ids: data.worker.locationIds
|
|
299
260
|
}
|
|
300
261
|
};
|
|
301
262
|
}
|
|
302
263
|
if (userType === "driver" && "driver" in data) {
|
|
303
264
|
return {
|
|
304
|
-
credential
|
|
305
|
-
...(data.driver.credential.password ? { password: data.driver.credential.password } : {}),
|
|
306
|
-
firstname: data.driver.credential.firstname,
|
|
307
|
-
lastname: data.driver.credential.lastname,
|
|
308
|
-
contact: data.driver.credential.contact,
|
|
309
|
-
email: data.driver.credential.email,
|
|
310
|
-
status: (data.driver.credential.status === true) ? 1 : 0,
|
|
311
|
-
address: data.driver.credential.address
|
|
312
|
-
},
|
|
265
|
+
...getCredentialPayload(data.driver.credential),
|
|
313
266
|
driver: {
|
|
314
267
|
company_name: data.driver.companyName,
|
|
315
268
|
remark: data.driver.remark
|
|
316
269
|
},
|
|
317
270
|
props: {
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
if (userType === "supplier" && "supplier" in data) {
|
|
323
|
-
return {
|
|
324
|
-
credential: {
|
|
325
|
-
...(data.supplier.credential.password ? { password: data.supplier.credential.password } : {}),
|
|
326
|
-
firstname: data.supplier.credential.firstname,
|
|
327
|
-
lastname: data.supplier.credential.lastname,
|
|
328
|
-
contact: data.supplier.credential.contact,
|
|
329
|
-
email: data.supplier.credential.email,
|
|
330
|
-
status: (data.supplier.credential.status === true) ? 1 : 0,
|
|
331
|
-
address: data.supplier.credential.address
|
|
332
|
-
},
|
|
333
|
-
supplier: {
|
|
334
|
-
type: data.supplier.type,
|
|
335
|
-
company_name: data.supplier.companyName,
|
|
336
|
-
contact: data.supplier.contact,
|
|
337
|
-
code: data.supplier.code,
|
|
338
|
-
reg_no: data.supplier.regNo,
|
|
339
|
-
remark: data.supplier.remark,
|
|
340
|
-
address_1: data.supplier.address1,
|
|
341
|
-
address_2: data.supplier.address2,
|
|
342
|
-
postcode: data.supplier.postcode,
|
|
343
|
-
country_id: data.supplier.countryId,
|
|
344
|
-
state_id: data.supplier.stateId,
|
|
345
|
-
area_id: data.supplier.areaId,
|
|
346
|
-
bank_name: data.supplier.bankName,
|
|
347
|
-
bank_acc: data.supplier.bankAcc
|
|
348
|
-
},
|
|
349
|
-
props: {
|
|
350
|
-
item_id: data.supplier.itemIds,
|
|
351
|
-
retailer_id: data.supplier.retailerId
|
|
271
|
+
location_ids: data.driver.locationIds
|
|
352
272
|
}
|
|
353
273
|
};
|
|
354
274
|
}
|
|
275
|
+
// if (userType === "supplier" && "supplier" in data) {
|
|
276
|
+
// return {
|
|
277
|
+
// credential: {
|
|
278
|
+
// ...(data.supplier.credential.password ? { password: data.supplier.credential.password } : {}),
|
|
279
|
+
// firstname: data.supplier.credential.firstname,
|
|
280
|
+
// lastname: data.supplier.credential.lastname,
|
|
281
|
+
// contact: data.supplier.credential.contact,
|
|
282
|
+
// email: data.supplier.credential.email,
|
|
283
|
+
// status: (data.supplier.credential.status === true) ? 1 : 0,
|
|
284
|
+
// address: data.supplier.credential.address
|
|
285
|
+
// },
|
|
286
|
+
// supplier: {
|
|
287
|
+
// type: data.supplier.type,
|
|
288
|
+
// company_name: data.supplier.companyName,
|
|
289
|
+
// contact: data.supplier.contact,
|
|
290
|
+
// code: data.supplier.code,
|
|
291
|
+
// reg_no: data.supplier.regNo,
|
|
292
|
+
// remark: data.supplier.remark,
|
|
293
|
+
// address_1: data.supplier.address1,
|
|
294
|
+
// address_2: data.supplier.address2,
|
|
295
|
+
// postcode: data.supplier.postcode,
|
|
296
|
+
// country_id: data.supplier.countryId,
|
|
297
|
+
// state_id: data.supplier.stateId,
|
|
298
|
+
// area_id: data.supplier.areaId,
|
|
299
|
+
// bank_name: data.supplier.bankName,
|
|
300
|
+
// bank_acc: data.supplier.bankAcc
|
|
301
|
+
// },
|
|
302
|
+
// props: {
|
|
303
|
+
// item_id: data.supplier.itemIds,
|
|
304
|
+
// retailer_id: data.supplier.retailerId
|
|
305
|
+
// }
|
|
306
|
+
// }
|
|
307
|
+
// }
|
|
355
308
|
if (userType === "member" && "member" in data) {
|
|
356
309
|
return {
|
|
357
|
-
credential
|
|
358
|
-
...(data.member.credential.password ? { password: data.member.credential.password } : {}),
|
|
359
|
-
firstname: data.member.credential.firstname,
|
|
360
|
-
lastname: data.member.credential.lastname,
|
|
361
|
-
contact: data.member.credential.contact,
|
|
362
|
-
email: data.member.credential.email,
|
|
363
|
-
status: (data.member.credential.status === true) ? 1 : 0,
|
|
364
|
-
address: data.member.credential.address
|
|
365
|
-
},
|
|
310
|
+
...getCredentialPayload(data.member.credential),
|
|
366
311
|
member: {
|
|
367
|
-
owner_user_id: (data.member.ownerUserId === 0) ? "" : data.member.ownerUserId, /* retailer_user_id or empty if global */
|
|
368
312
|
company_name: data.member.companyName,
|
|
369
313
|
identity_no: data.member.identityNo,
|
|
370
314
|
gender: data.member.gender,
|
|
@@ -379,6 +323,24 @@ const getUpdatePayload = (userType, data) => {
|
|
|
379
323
|
}
|
|
380
324
|
};
|
|
381
325
|
}
|
|
326
|
+
if (userType === "agent" && "agent" in data) {
|
|
327
|
+
return {
|
|
328
|
+
...getCredentialPayload(data.agent.credential),
|
|
329
|
+
agent: {
|
|
330
|
+
company_name: data.agent.companyName,
|
|
331
|
+
identity_no: data.agent.identityNo,
|
|
332
|
+
gender: data.agent.gender,
|
|
333
|
+
dob: data.agent.dob,
|
|
334
|
+
address_1: data.agent.address1,
|
|
335
|
+
address_2: data.agent.address2,
|
|
336
|
+
country_id: data.agent.countryId,
|
|
337
|
+
state_id: data.agent.stateId,
|
|
338
|
+
area_id: data.agent.areaId,
|
|
339
|
+
postcode: data.agent.postcode,
|
|
340
|
+
remark: data.agent.remark
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}
|
|
382
344
|
};
|
|
383
345
|
const UserService = (props) => {
|
|
384
346
|
const { userType = "administrator", userTargetType, ...rest } = props ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/user/UserService.ts"],"names":[],"mappings":";;;AAEA,+BAMe;AAEF,QAAA,SAAS,GAAG;IACrB,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACR,CAAA;AAEG,QAAA,eAAe,GAAG;IAC3B,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACR,CAAA;AAoPV,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,IAA6B,EAAE,EAAE;IAE3E,IAAI,QAAQ,KAAK,eAAe,IAAI,eAAe,IAAI,IAAI,EAAE,CAAC;QAE1D,OAAO;YACH,UAAU,EAAE;gBACR,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ;gBAChD,QAAQ,E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AAM;QACN,MAAM;QACN,YAAY;KACf,CAAC;AACN,CAAC,CAAA;AApJY,QAAA,WAAW,eAoJvB","sourcesContent":["import { DefaultServiceProps } from '@/lib';\n\nimport {\n buildApiListUrl,\n BuildApiListParamsProps,\n buildApiGetUrl,\n BuildApiGetParamsProps,\n filterOperatorTypes\n} from '@/lib';\n\nexport const userTypes = {\n administrator: \"administrator\",\n worker: \"worker\",\n supplier: \"supplier\",\n customer: \"customer\",\n driver: \"driver\",\n retailer: \"retailer\",\n member: \"member\",\n operator: \"operator\",\n agent: \"agent\",\n} as const\n\nexport const userTargetTypes = {\n administrator: \"administrator\",\n worker: \"worker\",\n supplier: \"supplier\",\n customer: \"customer\",\n driver: \"driver\",\n retailer: \"retailer\",\n member: \"member\",\n operator: \"operator\",\n agent: \"agent\",\n} as const\n\nexport type UserType = typeof userTypes[keyof typeof userTypes]\nexport type UserTargetType = typeof userTargetTypes[keyof typeof userTargetTypes]\nexport type UserTargetKey = keyof typeof userTargetTypes\n\nexport type UserServiceProps = DefaultServiceProps & {\n userTargetType?: UserTargetType\n userType?: UserType\n};\n\nexport type ListUserProps = BuildApiListParamsProps & {\n userType?: UserType\n}\n\nexport type GetUserProps = BuildApiGetParamsProps & {\n id: number | string\n userType?: UserType\n}\n\ntype Gender = \"male\" | \"female\"\ntype AssignSupplierType = \"admin\" | \"retail\"\n\ntype UserCredential = {\n username: string\n password: string\n // userType: UserTargetType\n firstname: string\n lastname: string\n contact: string\n email: string\n status: boolean\n address: string\n}\n\nexport type CreateUserProps = {\n userTargetType?: UserTargetType\n userType?: UserType\n data:\n // administrator\n {\n administrator: {\n credential: UserCredential,\n locationIds: number[]\n }\n } |\n // customer\n {\n customer: {\n credential: UserCredential,\n code: string\n accountCode: string\n companyName: string\n regNo: string\n secondaryRegNo: string\n taxIdentificationNo: string,\n taxRegistrationNo: string,\n remark: string\n salesperson: string\n excludeTaxRate: number[]\n }\n } |\n // retailer\n {\n retailer: {\n credential: UserCredential,\n code: string\n accountCode: string\n companyName: string\n regNo: string\n remark: string\n isDifferentBusiness: boolean\n businessId: number\n }\n } |\n // worker\n {\n worker: {\n credential: UserCredential,\n remark: string\n locationIds: number[]\n }\n } |\n // driver\n {\n driver: {\n credential: UserCredential,\n companyName: string\n remark: string\n locationIds: number[]\n }\n } |\n // supplier\n {\n supplier: {\n credential: UserCredential,\n // supplier: {\n type: AssignSupplierType\n companyName: string\n contact: string\n code: string\n regNo: string\n remark: string\n address1: string\n address2: string\n postcode: string\n countryId: number\n stateId: number\n areaId: number\n bankName: string\n bankAcc: string\n itemIds: number[],\n retailerId?: number /* Optional */\n }\n } &\n // member\n {\n member: {\n credential: UserCredential,\n ownerUserId: number | 0 /* retailer_user_id or empty if global */\n companyName: string\n identityNo: string\n gender: Gender,\n dob: string\n address1: string\n address2: string\n countryId: number\n stateId: number\n areaId: number\n postcode: string\n remark: string\n }\n }\n}\n\nexport type UpdateUserProps = {\n id: number\n userTargetType?: UserTargetType\n userType?: UserType\n data:\n // administatrator\n {\n administrator: {\n credential: Omit<UserCredential, \"username\" | \"password\"> & { password?: string },\n locationIds: number[]\n }\n } |\n // customer\n {\n customer: {\n credential: Omit<UserCredential, \"username\" | \"password\"> & { password?: string },\n code: string\n accountCode: string\n companyName: string\n regNo: string\n secondaryRegNo: string\n taxIdentificationNo: string,\n taxRegistrationNo: string,\n remark: string\n salesperson: string\n excludeTaxRate: number[]\n }\n } |\n // retailer\n {\n retailer: {\n credential: Omit<UserCredential, \"username\" | \"password\"> & { password?: string },\n code: string\n accountCode: string\n companyName: string\n regNo: string\n remark: string\n isDifferentBusiness: boolean\n businessId: number\n }\n } |\n // worker\n {\n worker: {\n credential: Omit<UserCredential, \"username\" | \"password\"> & { password?: string },\n remark: string\n locationIds: number[]\n }\n } |\n // driver\n {\n driver: {\n credential: Omit<UserCredential, \"username\" | \"password\"> & { password?: string },\n companyName: string\n remark: string\n locationIds: number[]\n }\n } |\n // supplier\n {\n supplier: {\n credential: Omit<UserCredential, \"username\" | \"password\"> & { password?: string },\n type: AssignSupplierType\n companyName: string\n contact: string\n code: string\n regNo: string\n remark: string\n address1: string\n address2: string\n postcode: string\n countryId: number\n stateId: number\n areaId: number\n bankName: string\n bankAcc: string\n itemIds: number[],\n retailerId?: number /* Optional */\n }\n } |\n // member\n {\n member: {\n credential: Omit<UserCredential, \"username\" | \"password\"> & { password?: string },\n ownerUserId: number /* retailer_user_id or empty if global */\n companyName: string\n identityNo: string\n gender: Gender,\n dob: string\n address1: string\n address2: string\n countryId: number\n stateId: number\n areaId: number\n postcode: string\n remark: string\n }\n }\n}\n\nexport type RemoveUserProps = {\n userTargetType?: UserTargetType\n ids: number[]\n}\n\nexport type GetDataTypeUserProps = {\n userType?: UserType\n}\n\nconst getCreatePayload = (userType: UserType, data: CreateUserProps[\"data\"]) => {\n\n if (userType === \"administrator\" && \"administrator\" in data) {\n\n return {\n credential: {\n username: data.administrator.credential.username,\n password: data.administrator.credential.password,\n user_type: userType,\n firstname: data.administrator.credential.firstname,\n lastname: data.administrator.credential.lastname,\n contact: data.administrator.credential.contact,\n email: data.administrator.credential.email,\n status: (data.administrator.credential.status === true) ? 1 : 0,\n address: data.administrator.credential.address\n },\n administrator: [],\n props: {\n location_id: data.administrator.locationIds\n }\n }\n }\n\n if (userType === \"customer\" && \"customer\" in data) {\n\n return {\n credential: {\n username: data.customer.credential.username,\n password: data.customer.credential.password,\n user_type: userType,\n firstname: data.customer.credential.firstname,\n lastname: data.customer.credential.lastname,\n contact: data.customer.credential.contact,\n email: data.customer.credential.email,\n status: (data.customer.credential.status === true) ? 1 : 0,\n address: data.customer.credential.address\n },\n customer: {\n code: data.customer.code,\n account_code: data.customer.accountCode,\n company_name: data.customer.companyName,\n reg_no: data.customer.regNo,\n secondary_reg_no: data.customer.secondaryRegNo,\n remark: data.customer.remark,\n tax_identification_no: data.customer.taxIdentificationNo,\n tax_registration_no: data.customer.taxRegistrationNo,\n },\n props: {\n salesperson: data.customer.salesperson,\n exclude_tax_rate: data.customer.excludeTaxRate\n }\n }\n }\n\n if (userType === \"retailer\" && \"retailer\" in data) {\n\n return {\n credential: {\n username: data.retailer.credential.username,\n password: data.retailer.credential.password,\n user_type: userType,\n firstname: data.retailer.credential.firstname,\n lastname: data.retailer.credential.lastname,\n contact: data.retailer.credential.contact,\n email: data.retailer.credential.email,\n status: (data.retailer.credential.status === true) ? 1 : 0,\n address: data.retailer.credential.address\n },\n retailer: {\n code: data.retailer.code,\n account_code: data.retailer.accountCode,\n company_name: data.retailer.companyName,\n reg_no: data.retailer.regNo,\n remark: data.retailer.remark\n },\n props: {\n business_id: data.retailer.businessId\n },\n status: {\n is_different_business: (data.retailer.isDifferentBusiness === true) ? 1 : 0\n }\n }\n }\n\n if (userType === \"worker\" && \"worker\" in data) {\n\n return {\n credential: {\n username: data.worker.credential.username,\n password: data.worker.credential.password,\n user_type: userType,\n firstname: data.worker.credential.firstname,\n lastname: data.worker.credential.lastname,\n contact: data.worker.credential.contact,\n email: data.worker.credential.email,\n status: (data.worker.credential.status === true) ? 1 : 0,\n address: data.worker.credential.address\n },\n worker: {\n remark: data.worker.remark\n },\n props: {\n location_id: data.worker.locationIds\n }\n }\n }\n\n if (userType === \"driver\" && \"driver\" in data) {\n\n return {\n credential: {\n username: data.driver.credential.username,\n password: data.driver.credential.password,\n user_type: userType,\n firstname: data.driver.credential.firstname,\n lastname: data.driver.credential.lastname,\n contact: data.driver.credential.contact,\n email: data.driver.credential.email,\n status: (data.driver.credential.status === true) ? 1 : 0,\n address: data.driver.credential.address\n },\n driver: {\n company_name: data.driver.companyName,\n remark: data.driver.remark\n },\n props: {\n location_id: data.driver.locationIds\n }\n }\n }\n\n if (userType === \"supplier\" && \"supplier\" in data) {\n\n return {\n credential: {\n username: data.supplier.credential.username,\n password: data.supplier.credential.password,\n user_type: userType,\n firstname: data.supplier.credential.firstname,\n lastname: data.supplier.credential.lastname,\n contact: data.supplier.credential.contact,\n email: data.supplier.credential.email,\n status: (data.supplier.credential.status === true) ? 1 : 0,\n address: data.supplier.credential.address\n },\n supplier: {\n type: data.supplier.type,\n company_name: data.supplier.companyName,\n contact: data.supplier.contact,\n code: data.supplier.code,\n reg_no: data.supplier.regNo,\n remark: data.supplier.remark,\n address_1: data.supplier.address1,\n address_2: data.supplier.address2,\n postcode: data.supplier.postcode,\n country_id: data.supplier.countryId,\n state_id: data.supplier.stateId,\n area_id: data.supplier.areaId,\n bank_name: data.supplier.bankName,\n bank_acc: data.supplier.bankAcc\n },\n props: {\n item_id: data.supplier.itemIds,\n retailer_id: data.supplier.retailerId\n }\n }\n }\n\n if (userType === \"member\" && \"member\" in data) {\n\n return {\n credential: {\n username: data.member.credential.username,\n password: data.member.credential.password,\n user_type: userType,\n firstname: data.member.credential.firstname,\n lastname: data.member.credential.lastname,\n contact: data.member.credential.contact,\n email: data.member.credential.email,\n status: (data.member.credential.status === true) ? 1 : 0,\n address: data.member.credential.address\n },\n member: {\n owner_user_id: (data.member.ownerUserId === 0) ? \"\" : data.member.ownerUserId, /* retailer_user_id or empty if global */\n company_name: data.member.companyName,\n identity_no: data.member.identityNo,\n gender: data.member.gender,\n dob: data.member.dob,\n address_1: data.member.address1,\n address_2: data.member.address2,\n country_id: data.member.countryId,\n state_id: data.member.stateId,\n area_id: data.member.areaId,\n postcode: data.member.postcode,\n remark: data.member.remark\n }\n }\n }\n}\n\nconst getUpdatePayload = (userType: UserType, data: UpdateUserProps[\"data\"]) => {\n\n if (userType === \"administrator\" && \"administrator\" in data) {\n\n return {\n credential: {\n ...(data.administrator.credential.password ? { password: data.administrator.credential.password } : {}),\n firstname: data.administrator.credential.firstname,\n lastname: data.administrator.credential.lastname,\n contact: data.administrator.credential.contact,\n email: data.administrator.credential.email,\n status: (data.administrator.credential.status === true) ? 1 : 0,\n address: data.administrator.credential.address\n },\n administrator: [],\n props: {\n location_id: data.administrator.locationIds\n }\n }\n }\n\n if (userType === \"customer\" && \"customer\" in data) {\n\n return {\n credential: {\n ...(data.customer.credential.password ? { password: data.customer.credential.password } : {}),\n firstname: data.customer.credential.firstname,\n lastname: data.customer.credential.lastname,\n contact: data.customer.credential.contact,\n email: data.customer.credential.email,\n status: (data.customer.credential.status === true) ? 1 : 0,\n address: data.customer.credential.address\n },\n customer: {\n code: data.customer.code,\n account_code: data.customer.accountCode,\n company_name: data.customer.companyName,\n reg_no: data.customer.regNo,\n secondary_reg_no: data.customer.secondaryRegNo,\n remark: data.customer.remark,\n tax_identification_no: data.customer.taxIdentificationNo,\n tax_registration_no: data.customer.taxRegistrationNo,\n },\n props: {\n salesperson: data.customer.salesperson,\n exclude_tax_rate: data.customer.excludeTaxRate\n }\n }\n\n }\n\n if (userType === \"retailer\" && \"retailer\" in data) {\n\n return {\n credential: {\n ...(data.retailer.credential.password ? { password: data.retailer.credential.password } : {}),\n firstname: data.retailer.credential.firstname,\n lastname: data.retailer.credential.lastname,\n contact: data.retailer.credential.contact,\n email: data.retailer.credential.email,\n status: (data.retailer.credential.status === true) ? 1 : 0,\n address: data.retailer.credential.address\n },\n retailer: {\n code: data.retailer.code,\n account_code: data.retailer.accountCode,\n company_name: data.retailer.companyName,\n reg_no: data.retailer.regNo,\n remark: data.retailer.remark\n },\n props: {\n business_id: data.retailer.businessId\n },\n status: {\n is_different_business: (data.retailer.isDifferentBusiness === true) ? 1 : 0\n }\n }\n }\n\n if (userType === \"worker\" && \"worker\" in data) {\n\n return {\n credential: {\n ...(data.worker.credential.password ? { password: data.worker.credential.password } : {}),\n firstname: data.worker.credential.firstname,\n lastname: data.worker.credential.lastname,\n contact: data.worker.credential.contact,\n email: data.worker.credential.email,\n status: (data.worker.credential.status === true) ? 1 : 0,\n address: data.worker.credential.address\n },\n worker: {\n remark: data.worker.remark\n },\n props: {\n location_id: data.worker.locationIds\n }\n }\n }\n\n if (userType === \"driver\" && \"driver\" in data) {\n\n return {\n credential: {\n ...(data.driver.credential.password ? { password: data.driver.credential.password } : {}),\n firstname: data.driver.credential.firstname,\n lastname: data.driver.credential.lastname,\n contact: data.driver.credential.contact,\n email: data.driver.credential.email,\n status: (data.driver.credential.status === true) ? 1 : 0,\n address: data.driver.credential.address\n },\n driver: {\n company_name: data.driver.companyName,\n remark: data.driver.remark\n },\n props: {\n location_id: data.driver.locationIds\n }\n }\n }\n\n if (userType === \"supplier\" && \"supplier\" in data) {\n\n return {\n credential: {\n ...(data.supplier.credential.password ? { password: data.supplier.credential.password } : {}),\n firstname: data.supplier.credential.firstname,\n lastname: data.supplier.credential.lastname,\n contact: data.supplier.credential.contact,\n email: data.supplier.credential.email,\n status: (data.supplier.credential.status === true) ? 1 : 0,\n address: data.supplier.credential.address\n },\n supplier: {\n type: data.supplier.type,\n company_name: data.supplier.companyName,\n contact: data.supplier.contact,\n code: data.supplier.code,\n reg_no: data.supplier.regNo,\n remark: data.supplier.remark,\n address_1: data.supplier.address1,\n address_2: data.supplier.address2,\n postcode: data.supplier.postcode,\n country_id: data.supplier.countryId,\n state_id: data.supplier.stateId,\n area_id: data.supplier.areaId,\n bank_name: data.supplier.bankName,\n bank_acc: data.supplier.bankAcc\n },\n props: {\n item_id: data.supplier.itemIds,\n retailer_id: data.supplier.retailerId\n }\n }\n }\n\n if (userType === \"member\" && \"member\" in data) {\n\n return {\n credential: {\n ...(data.member.credential.password ? { password: data.member.credential.password } : {}),\n firstname: data.member.credential.firstname,\n lastname: data.member.credential.lastname,\n contact: data.member.credential.contact,\n email: data.member.credential.email,\n status: (data.member.credential.status === true) ? 1 : 0,\n address: data.member.credential.address\n },\n member: {\n owner_user_id: (data.member.ownerUserId === 0) ? \"\" : data.member.ownerUserId, /* retailer_user_id or empty if global */\n company_name: data.member.companyName,\n identity_no: data.member.identityNo,\n gender: data.member.gender,\n dob: data.member.dob,\n address_1: data.member.address1,\n address_2: data.member.address2,\n country_id: data.member.countryId,\n state_id: data.member.stateId,\n area_id: data.member.areaId,\n postcode: data.member.postcode,\n remark: data.member.remark\n }\n }\n }\n\n}\n\nexport const UserService = (props: UserServiceProps) => {\n\n const { userType = \"administrator\", userTargetType, ...rest } = props ?? {};\n\n // const { makeCall } = ApiService(rest?.customToken ? { customToken: rest.customToken } : {})\n\n const { makeCall } = props.apiService\n\n const endpoint1 = \"user\";\n const endpoint2 = \"users\"\n\n const list = async (props: ListUserProps) => {\n\n const { userType: overrideUserType } = props;\n\n const url = buildApiListUrl(\n `${endpoint2}/${overrideUserType || userType}`,\n props\n );\n\n const response = await makeCall({\n url,\n method: \"get\",\n payload: {},\n // configuration\n });\n\n return response;\n\n }\n\n const get = async (props: GetUserProps) => {\n\n const { id, userType: overrideUserType } = props;\n\n const url = buildApiGetUrl(\n `${endpoint1}/${overrideUserType || userType}/${id}`,\n props\n );\n\n const response = await makeCall({\n url,\n method: \"get\",\n payload: {},\n // configuration\n });\n\n return response;\n\n }\n\n const create = async ({ data, userType: overrideUserType, userTargetType: overrideUserTargetType }: CreateUserProps) => {\n\n let _userType = overrideUserType || userType\n\n let payload: any = getCreatePayload(_userType, data)\n\n let url = `${endpoint1}`;\n\n let postData = {\n scope: {\n target: overrideUserTargetType || userTargetType,\n action: \"\",\n },\n payload\n }\n\n const response = await makeCall({\n url,\n method: \"post\",\n payload: postData\n });\n\n return response;\n\n }\n\n const update = async ({ id, data, userType: overrideUserType, userTargetType: overrideUserTargetType }: UpdateUserProps) => {\n\n let url = `${endpoint1}/${id}`\n\n let _userType = overrideUserType || userType\n\n let payload: any = getUpdatePayload(_userType, data)\n\n\n const postData = {\n scope: {\n target: overrideUserTargetType || userTargetType,\n action: \"\",\n },\n payload\n }\n\n const response = await makeCall({\n url,\n method: \"put\",\n payload: postData\n });\n\n return response;\n\n }\n\n const remove = async ({ ids, userTargetType: overrideUserTargetType }: RemoveUserProps) => {\n\n let url = `${endpoint2}/delete`\n\n const postData = {\n scope: {\n target: overrideUserTargetType || userTargetType,\n },\n payload: {\n ids\n }\n }\n\n const response = await makeCall({\n url,\n method: \"post\",\n payload: postData\n });\n\n return response;\n\n }\n\n const getDataTypes = async ({ userType: overrideUserType }: GetDataTypeUserProps) => {\n\n let url = `${endpoint2}/data_types/${overrideUserType || userType}`\n\n const response = await makeCall({\n url,\n method: \"get\",\n });\n\n return response;\n\n }\n\n return {\n list,\n get,\n create,\n update,\n remove,\n getDataTypes\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/user/UserService.ts"],"names":[],"mappings":";;;AAEA,+BAMe;AAEF,QAAA,SAAS,GAAG;IACrB,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;IAChB,wBAAwB;IACxB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACR,CAAA;AAEG,QAAA,eAAe,GAAG;IAC3B,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;IAChB,wBAAwB;IACxB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACR,CAAA;AAmSV,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,IAA6B,EAAE,EAAE;IAE3E,MAAM,oBAAoB,GAAG,CAAC,MAAsB,EAAE,EAAE;QACpD,OAAO;YACH,UAAU,EAAE;gBACR,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC9B,OAAO,EAAE,MAAM,CAAC,OAAO;aAC1B;SACJ,CAAA;IACL,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AAK,EAAE;gBACH,MAAM,EAAE,sBAAsB,IAAI,cAAc;aACnD;YACD,OAAO,EAAE;gBACL,GAAG;aACN;SACJ,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,QAAQ;SACpB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAEpB,CAAC,CAAA;IAED,MAAM,YAAY,GAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAwB,EAAE,EAAE;QAEhF,IAAI,GAAG,GAAG,GAAG,SAAS,eAAe,gBAAgB,IAAI,QAAQ,EAAE,CAAA;QAEnE,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,KAAK;SAChB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAEpB,CAAC,CAAA;IAED,OAAO;QACH,IAAI;QACJ,GAAG;QACH,MAAM;QACN,MAAM;QACN,MAAM;QACN,YAAY;KACf,CAAC;AACN,CAAC,CAAA;AAnJY,QAAA,WAAW,eAmJvB","sourcesContent":["import { DefaultServiceProps } from '@/lib';\n\nimport {\n buildApiListUrl,\n BuildApiListParamsProps,\n buildApiGetUrl,\n BuildApiGetParamsProps,\n filterOperatorTypes\n} from '@/lib';\n\nexport const userTypes = {\n administrator: \"administrator\",\n worker: \"worker\",\n // supplier: \"supplier\",\n customer: \"customer\",\n driver: \"driver\",\n retailer: \"retailer\",\n member: \"member\",\n operator: \"operator\",\n agent: \"agent\",\n} as const\n\nexport const userTargetTypes = {\n administrator: \"administrator\",\n worker: \"worker\",\n // supplier: \"supplier\",\n customer: \"customer\",\n driver: \"driver\",\n retailer: \"retailer\",\n member: \"member\",\n operator: \"operator\",\n agent: \"agent\",\n} as const\n\nexport type UserType = typeof userTypes[keyof typeof userTypes]\nexport type UserTargetType = typeof userTargetTypes[keyof typeof userTargetTypes]\nexport type UserTargetKey = keyof typeof userTargetTypes\n\nexport type UserServiceProps = DefaultServiceProps & {\n userTargetType?: UserTargetType\n userType?: UserType\n};\n\nexport type ListUserProps = BuildApiListParamsProps & {\n userType?: UserType\n}\n\nexport type GetUserProps = BuildApiGetParamsProps & {\n id: number | string\n userType?: UserType\n}\n\ntype Gender = \"male\" | \"female\" | \"other\"\n// type AssignSupplierType = \"admin\" | \"retail\"\n\ntype UserCredential = {\n username: string;\n password: string;\n firstname: string;\n lastname: string;\n contact: string;\n address?: string;\n email: string;\n status: boolean;\n}\n\ntype UserCredentialWithoutPassword = Omit<UserCredential, \"password\"> & { password?: string }\n\nexport type CreateUserProps = {\n userTargetType?: UserTargetType\n userType?: UserType\n data:\n // operator\n {\n operator: {\n credential: UserCredential,\n }\n } |\n // administrator\n {\n administrator: {\n credential: UserCredential,\n locationIds: string[]\n }\n } |\n // customer\n {\n customer: {\n credential: UserCredential,\n code: string;\n accountCode: string;\n companyName: string;\n regNo: string;\n secondaryRegNo: string;\n gstNo: string;\n taxIdentificationNo: string;\n taxRegistrationNo: string;\n remark: string;\n salesperson: string\n }\n } |\n // retailer\n {\n retailer: {\n credential: UserCredential,\n code: string;\n accountCode: string;\n companyName: string;\n gstNo: string;\n regNo: string;\n remark: string;\n }\n } |\n // worker\n {\n worker: {\n credential: UserCredential,\n remark: string\n locationIds: string[]\n }\n } |\n // driver\n {\n driver: {\n credential: UserCredential,\n companyName: string\n remark: string\n locationIds: string[]\n }\n } |\n // supplier\n // {\n // supplier: {\n // credential: UserCredential,\n // // supplier: {\n // type: AssignSupplierType\n // companyName: string\n // contact: string\n // code: string\n // regNo: string\n // remark: string\n // address1: string\n // address2: string\n // postcode: string\n // countryId: number\n // stateId: number\n // areaId: number\n // bankName: string\n // bankAcc: string\n // itemIds: number[],\n // retailerId?: number /* Optional */\n // }\n // } |\n // member\n {\n member: {\n credential: UserCredential,\n ownerUserId: number;\n code?: string;\n companyName: string;\n identityNo: string;\n gender: Gender;\n dob: string; // YYYY-MM-DD format enforced by regex\n address1: string;\n address2: string;\n countryId: number;\n stateId: number;\n areaId: number;\n postcode: string;\n remark: string;\n }\n } &\n // agent\n {\n agent: {\n credential: UserCredential,\n ownerUserId: number;\n code?: string;\n companyName: string;\n identityNo: string;\n gender: Gender;\n dob: string; // YYYY-MM-DD format enforced by regex\n address1: string;\n address2: string;\n countryId: number;\n stateId: number;\n areaId: number;\n postcode: string;\n remark: string;\n }\n }\n}\n\nexport type UpdateUserProps = {\n id: number\n userTargetType?: UserTargetType\n userType?: UserType\n data:\n // operator\n {\n operator: {\n credential: UserCredentialWithoutPassword,\n }\n } |\n // administatrator\n {\n administrator: {\n credential: UserCredentialWithoutPassword,\n locationIds: string[]\n }\n } |\n // customer\n {\n customer: {\n credential: UserCredentialWithoutPassword,\n code: string\n accountCode: string\n companyName: string\n regNo: string\n secondaryRegNo: string\n gstNo: string;\n taxIdentificationNo: string,\n taxRegistrationNo: string,\n remark: string\n salesperson: string\n }\n } |\n // retailer\n {\n retailer: {\n credential: UserCredentialWithoutPassword,\n code: string\n accountCode: string\n companyName: string\n regNo: string\n gstNo: string;\n remark: string\n }\n } |\n // worker\n {\n worker: {\n credential: UserCredentialWithoutPassword,\n remark: string\n locationIds: string[]\n }\n } |\n // driver\n {\n driver: {\n credential: UserCredentialWithoutPassword,\n companyName: string\n remark: string\n locationIds: string[]\n }\n } |\n // // supplier\n // {\n // supplier: {\n // credential: UserCredentialWithoutPassword,\n // type: AssignSupplierType\n // companyName: string\n // contact: string\n // code: string\n // regNo: string\n // remark: string\n // address1: string\n // address2: string\n // postcode: string\n // countryId: number\n // stateId: number\n // areaId: number\n // bankName: string\n // bankAcc: string\n // itemIds: number[],\n // retailerId?: number /* Optional */\n // }\n // } |\n // member\n {\n member: {\n credential: UserCredentialWithoutPassword,\n companyName: string\n identityNo: string\n gender: Gender,\n dob: string\n address1: string\n address2: string\n countryId: number\n stateId: number\n areaId: number\n postcode: string\n remark: string\n }\n } |\n // agent\n {\n agent: {\n credential: UserCredentialWithoutPassword,\n companyName: string\n identityNo: string\n gender: Gender,\n dob: string\n address1: string\n address2: string\n countryId: number\n stateId: number\n areaId: number\n postcode: string\n remark: string\n }\n }\n}\n\nexport type RemoveUserProps = {\n userTargetType?: UserTargetType\n ids: number[]\n}\n\nexport type GetDataTypeUserProps = {\n userType?: UserType\n}\n\nconst getCreatePayload = (userType: UserType, data: CreateUserProps[\"data\"]) => {\n\n const getCredentialPayload = (values: UserCredential) => {\n return {\n credential: {\n username: values.username,\n password: values.password,\n firstname: values.firstname,\n lastname: values.lastname,\n contact: values.contact,\n email: values.email,\n status: Boolean(values.status),\n address: values.address\n }\n }\n }\n\n if (userType === \"operator\" && \"operator\" in data) {\n\n return {\n ...getCredentialPayload(data.operator.credential),\n operator: {}\n }\n }\n\n if (userType === \"administrator\" && \"administrator\" in data) {\n\n return {\n ...getCredentialPayload(data.administrator.credential),\n administrator: [],\n props: {\n location_ids: data.administrator.locationIds\n }\n }\n }\n\n if (userType === \"customer\" && \"customer\" in data) {\n\n return {\n ...getCredentialPayload(data.customer.credential),\n customer: {\n code: data.customer.code,\n account_code: data.customer.accountCode,\n company_name: data.customer.companyName,\n reg_no: data.customer.regNo,\n secondary_reg_no: data.customer.secondaryRegNo,\n gst_no: data.customer.gstNo,\n remark: data.customer.remark,\n tax_identification_no: data.customer.taxIdentificationNo,\n tax_registration_no: data.customer.taxRegistrationNo,\n },\n props: {\n salesperson: data.customer.salesperson,\n }\n }\n }\n\n if (userType === \"retailer\" && \"retailer\" in data) {\n\n return {\n ...getCredentialPayload(data.retailer.credential),\n retailer: {\n code: data.retailer.code,\n account_code: data.retailer.accountCode,\n company_name: data.retailer.companyName,\n reg_no: data.retailer.regNo,\n gst_no: data.retailer.gstNo,\n remark: data.retailer.remark\n },\n props: {\n\n }\n }\n }\n\n if (userType === \"worker\" && \"worker\" in data) {\n\n return {\n ...getCredentialPayload(data.worker.credential),\n worker: {\n remark: data.worker.remark\n },\n props: {\n location_ids: data.worker.locationIds\n }\n }\n }\n\n if (userType === \"driver\" && \"driver\" in data) {\n\n return {\n ...getCredentialPayload(data.driver.credential),\n driver: {\n company_name: data.driver.companyName,\n remark: data.driver.remark\n },\n props: {\n location_ids: data.driver.locationIds\n }\n }\n }\n\n // if (userType === \"supplier\" && \"supplier\" in data) {\n\n // return {\n // credential: {\n // username: data.supplier.credential.username,\n // password: data.supplier.credential.password,\n // user_type: userType,\n // firstname: data.supplier.credential.firstname,\n // lastname: data.supplier.credential.lastname,\n // contact: data.supplier.credential.contact,\n // email: data.supplier.credential.email,\n // status: (data.supplier.credential.status === true) ? 1 : 0,\n // address: data.supplier.credential.address\n // },\n // supplier: {\n // type: data.supplier.type,\n // company_name: data.supplier.companyName,\n // contact: data.supplier.contact,\n // code: data.supplier.code,\n // reg_no: data.supplier.regNo,\n // remark: data.supplier.remark,\n // address_1: data.supplier.address1,\n // address_2: data.supplier.address2,\n // postcode: data.supplier.postcode,\n // country_id: data.supplier.countryId,\n // state_id: data.supplier.stateId,\n // area_id: data.supplier.areaId,\n // bank_name: data.supplier.bankName,\n // bank_acc: data.supplier.bankAcc\n // },\n // props: {\n // item_id: data.supplier.itemIds,\n // retailer_id: data.supplier.retailerId\n // }\n // }\n // }\n\n if (userType === \"member\" && \"member\" in data) {\n\n return {\n ...getCredentialPayload(data.member.credential),\n member: {\n ...(data?.member?.code ? { code: data.member.code } : {}),\n owner_user_id: Number(data.member.ownerUserId),\n company_name: data.member.companyName,\n identity_no: data.member.identityNo,\n gender: data.member.gender,\n dob: data.member.dob,\n address_1: data.member.address1,\n address_2: data.member.address2,\n country_id: data.member.countryId,\n state_id: data.member.stateId,\n area_id: data.member.areaId,\n postcode: data.member.postcode,\n remark: data.member.remark\n }\n }\n }\n\n if (userType === \"agent\" && \"agent\" in data) {\n\n return {\n ...getCredentialPayload(data.agent.credential),\n agent: {\n ...(data?.agent?.code ? { code: data.agent.code } : {}),\n owner_user_id: Number(data.agent.ownerUserId),\n company_name: data.agent.companyName,\n identity_no: data.agent.identityNo,\n gender: data.agent.gender,\n dob: data.agent.dob,\n address_1: data.agent.address1,\n address_2: data.agent.address2,\n country_id: data.agent.countryId,\n state_id: data.agent.stateId,\n area_id: data.agent.areaId,\n postcode: data.agent.postcode,\n remark: data.agent.remark\n }\n }\n }\n}\n\nconst getUpdatePayload = (userType: UserType, data: UpdateUserProps[\"data\"]) => {\n\n const getCredentialPayload = (values: UserCredentialWithoutPassword) => {\n return {\n credential: {\n username: values.username,\n ...(values?.password ? { password: values.password } : {}),\n firstname: values.firstname,\n lastname: values.lastname,\n contact: values.contact,\n email: values.email,\n status: values.status,\n address: values.address\n }\n }\n }\n\n if (userType === \"operator\" && \"operator\" in data) {\n\n return {\n ...getCredentialPayload(data.operator.credential),\n operator: {}\n }\n }\n\n if (userType === \"administrator\" && \"administrator\" in data) {\n\n return {\n ...getCredentialPayload(data.administrator.credential),\n administrator: {},\n props: {\n location_ids: data.administrator.locationIds\n }\n }\n }\n\n if (userType === \"customer\" && \"customer\" in data) {\n\n return {\n ...getCredentialPayload(data.customer.credential),\n customer: {\n code: data.customer.code,\n account_code: data.customer.accountCode,\n company_name: data.customer.companyName,\n reg_no: data.customer.regNo,\n secondary_reg_no: data.customer.secondaryRegNo,\n gst_no: data.customer.gstNo,\n remark: data.customer.remark,\n tax_identification_no: data.customer.taxIdentificationNo,\n tax_registration_no: data.customer.taxRegistrationNo,\n },\n props: {\n salesperson: data.customer.salesperson\n }\n }\n\n }\n\n if (userType === \"retailer\" && \"retailer\" in data) {\n\n return {\n ...getCredentialPayload(data.retailer.credential),\n retailer: {\n code: data.retailer.code,\n account_code: data.retailer.accountCode,\n company_name: data.retailer.companyName,\n reg_no: data.retailer.regNo,\n gst_no: data.retailer.gstNo,\n remark: data.retailer.remark\n },\n props: {\n }\n }\n }\n\n if (userType === \"worker\" && \"worker\" in data) {\n\n return {\n ...getCredentialPayload(data.worker.credential),\n worker: {\n remark: data.worker.remark\n },\n props: {\n location_ids: data.worker.locationIds\n }\n }\n }\n\n if (userType === \"driver\" && \"driver\" in data) {\n\n return {\n ...getCredentialPayload(data.driver.credential),\n driver: {\n company_name: data.driver.companyName,\n remark: data.driver.remark\n },\n props: {\n location_ids: data.driver.locationIds\n }\n }\n }\n\n // if (userType === \"supplier\" && \"supplier\" in data) {\n\n // return {\n // credential: {\n // ...(data.supplier.credential.password ? { password: data.supplier.credential.password } : {}),\n // firstname: data.supplier.credential.firstname,\n // lastname: data.supplier.credential.lastname,\n // contact: data.supplier.credential.contact,\n // email: data.supplier.credential.email,\n // status: (data.supplier.credential.status === true) ? 1 : 0,\n // address: data.supplier.credential.address\n // },\n // supplier: {\n // type: data.supplier.type,\n // company_name: data.supplier.companyName,\n // contact: data.supplier.contact,\n // code: data.supplier.code,\n // reg_no: data.supplier.regNo,\n // remark: data.supplier.remark,\n // address_1: data.supplier.address1,\n // address_2: data.supplier.address2,\n // postcode: data.supplier.postcode,\n // country_id: data.supplier.countryId,\n // state_id: data.supplier.stateId,\n // area_id: data.supplier.areaId,\n // bank_name: data.supplier.bankName,\n // bank_acc: data.supplier.bankAcc\n // },\n // props: {\n // item_id: data.supplier.itemIds,\n // retailer_id: data.supplier.retailerId\n // }\n // }\n // }\n\n if (userType === \"member\" && \"member\" in data) {\n\n return {\n ...getCredentialPayload(data.member.credential),\n member: {\n company_name: data.member.companyName,\n identity_no: data.member.identityNo,\n gender: data.member.gender,\n dob: data.member.dob,\n address_1: data.member.address1,\n address_2: data.member.address2,\n country_id: data.member.countryId,\n state_id: data.member.stateId,\n area_id: data.member.areaId,\n postcode: data.member.postcode,\n remark: data.member.remark\n }\n }\n }\n\n if (userType === \"agent\" && \"agent\" in data) {\n\n return {\n ...getCredentialPayload(data.agent.credential),\n agent: {\n company_name: data.agent.companyName,\n identity_no: data.agent.identityNo,\n gender: data.agent.gender,\n dob: data.agent.dob,\n address_1: data.agent.address1,\n address_2: data.agent.address2,\n country_id: data.agent.countryId,\n state_id: data.agent.stateId,\n area_id: data.agent.areaId,\n postcode: data.agent.postcode,\n remark: data.agent.remark\n }\n }\n }\n\n}\n\nexport const UserService = (props: UserServiceProps) => {\n\n const { userType = \"administrator\", userTargetType, ...rest } = props ?? {};\n\n // const { makeCall } = ApiService(rest?.customToken ? { customToken: rest.customToken } : {})\n\n const { makeCall } = props.apiService\n\n const endpoint1 = \"user\";\n const endpoint2 = \"users\"\n\n const list = async (props: ListUserProps) => {\n\n const { userType: overrideUserType } = props;\n\n const url = buildApiListUrl(\n `${endpoint2}/${overrideUserType || userType}`,\n props\n );\n\n const response = await makeCall({\n url,\n method: \"get\",\n payload: {},\n // configuration\n });\n\n return response;\n\n }\n\n const get = async (props: GetUserProps) => {\n\n const { id, userType: overrideUserType } = props;\n\n const url = buildApiGetUrl(\n `${endpoint1}/${overrideUserType || userType}/${id}`,\n props\n );\n\n const response = await makeCall({\n url,\n method: \"get\",\n payload: {},\n // configuration\n });\n\n return response;\n\n }\n\n const create = async ({ data, userType: overrideUserType, userTargetType: overrideUserTargetType }: CreateUserProps) => {\n\n let _userType = overrideUserType || userType\n\n let payload: any = getCreatePayload(_userType, data)\n\n let url = `${endpoint1}`;\n\n let postData = {\n scope: {\n target: overrideUserTargetType || userTargetType,\n action: \"\",\n },\n payload\n }\n\n const response = await makeCall({\n url,\n method: \"post\",\n payload: postData\n });\n\n return response;\n\n }\n\n const update = async ({ id, data, userType: overrideUserType, userTargetType: overrideUserTargetType }: UpdateUserProps) => {\n\n let url = `${endpoint1}/${id}`\n\n let _userType = overrideUserType || userType\n\n let payload: any = getUpdatePayload(_userType, data)\n\n const postData = {\n scope: {\n target: overrideUserTargetType || userTargetType,\n action: \"\",\n },\n payload\n }\n\n const response = await makeCall({\n url,\n method: \"put\",\n payload: postData\n });\n\n return response;\n\n }\n\n const remove = async ({ ids, userTargetType: overrideUserTargetType }: RemoveUserProps) => {\n\n let url = `${endpoint2}/delete`\n\n const postData = {\n scope: {\n target: overrideUserTargetType || userTargetType,\n },\n payload: {\n ids\n }\n }\n\n const response = await makeCall({\n url,\n method: \"post\",\n payload: postData\n });\n\n return response;\n\n }\n\n const getDataTypes = async ({ userType: overrideUserType }: GetDataTypeUserProps) => {\n\n let url = `${endpoint2}/data_types/${overrideUserType || userType}`\n\n const response = await makeCall({\n url,\n method: \"get\",\n });\n\n return response;\n\n }\n\n return {\n list,\n get,\n create,\n update,\n remove,\n getDataTypes\n };\n}\n"]}
|