@blackcode_sa/metaestetics-api 1.4.3 → 1.4.4
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.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -3
- package/dist/index.mjs +10 -3
- package/package.json +1 -1
- package/src/services/auth.service.ts +7 -3
- package/src/services/user.service.ts +8 -0
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3389,6 +3389,9 @@ var UserService = class extends BaseService {
|
|
|
3389
3389
|
profiles.patientProfile = patientProfile.id;
|
|
3390
3390
|
break;
|
|
3391
3391
|
case "clinic_admin" /* CLINIC_ADMIN */:
|
|
3392
|
+
if (options == null ? void 0 : options.skipProfileCreation) {
|
|
3393
|
+
break;
|
|
3394
|
+
}
|
|
3392
3395
|
if (((_a = options == null ? void 0 : options.clinicAdminData) == null ? void 0 : _a.groupToken) && ((_b = options == null ? void 0 : options.clinicAdminData) == null ? void 0 : _b.groupId)) {
|
|
3393
3396
|
const isValid = await this.getClinicAdminService().getClinicGroupService().verifyAndUseAdminToken(
|
|
3394
3397
|
options.clinicAdminData.groupId,
|
|
@@ -4474,9 +4477,13 @@ var AuthService = class extends BaseService {
|
|
|
4474
4477
|
data.email,
|
|
4475
4478
|
data.password
|
|
4476
4479
|
);
|
|
4477
|
-
const user = await this.userService.createUser(
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
+
const user = await this.userService.createUser(
|
|
4481
|
+
firebaseUser,
|
|
4482
|
+
["clinic_admin" /* CLINIC_ADMIN */],
|
|
4483
|
+
{
|
|
4484
|
+
skipProfileCreation: true
|
|
4485
|
+
}
|
|
4486
|
+
);
|
|
4480
4487
|
const contactPerson = {
|
|
4481
4488
|
firstName: data.firstName,
|
|
4482
4489
|
lastName: data.lastName,
|
package/dist/index.mjs
CHANGED
|
@@ -3334,6 +3334,9 @@ var UserService = class extends BaseService {
|
|
|
3334
3334
|
profiles.patientProfile = patientProfile.id;
|
|
3335
3335
|
break;
|
|
3336
3336
|
case "clinic_admin" /* CLINIC_ADMIN */:
|
|
3337
|
+
if (options == null ? void 0 : options.skipProfileCreation) {
|
|
3338
|
+
break;
|
|
3339
|
+
}
|
|
3337
3340
|
if (((_a = options == null ? void 0 : options.clinicAdminData) == null ? void 0 : _a.groupToken) && ((_b = options == null ? void 0 : options.clinicAdminData) == null ? void 0 : _b.groupId)) {
|
|
3338
3341
|
const isValid = await this.getClinicAdminService().getClinicGroupService().verifyAndUseAdminToken(
|
|
3339
3342
|
options.clinicAdminData.groupId,
|
|
@@ -4449,9 +4452,13 @@ var AuthService = class extends BaseService {
|
|
|
4449
4452
|
data.email,
|
|
4450
4453
|
data.password
|
|
4451
4454
|
);
|
|
4452
|
-
const user = await this.userService.createUser(
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
+
const user = await this.userService.createUser(
|
|
4456
|
+
firebaseUser,
|
|
4457
|
+
["clinic_admin" /* CLINIC_ADMIN */],
|
|
4458
|
+
{
|
|
4459
|
+
skipProfileCreation: true
|
|
4460
|
+
}
|
|
4461
|
+
);
|
|
4455
4462
|
const contactPerson = {
|
|
4456
4463
|
firstName: data.firstName,
|
|
4457
4464
|
lastName: data.lastName,
|
package/package.json
CHANGED
|
@@ -119,9 +119,13 @@ export class AuthService extends BaseService {
|
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
// Create user with CLINIC_ADMIN role
|
|
122
|
-
const user = await this.userService.createUser(
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const user = await this.userService.createUser(
|
|
123
|
+
firebaseUser,
|
|
124
|
+
[UserRole.CLINIC_ADMIN],
|
|
125
|
+
{
|
|
126
|
+
skipProfileCreation: true,
|
|
127
|
+
}
|
|
128
|
+
);
|
|
125
129
|
|
|
126
130
|
// Create contact person object
|
|
127
131
|
const contactPerson: ContactPerson = {
|
|
@@ -86,6 +86,7 @@ export class UserService extends BaseService {
|
|
|
86
86
|
groupToken?: string;
|
|
87
87
|
groupId?: string;
|
|
88
88
|
};
|
|
89
|
+
skipProfileCreation?: boolean;
|
|
89
90
|
}
|
|
90
91
|
): Promise<User> {
|
|
91
92
|
const userData: CreateUserData = {
|
|
@@ -142,6 +143,7 @@ export class UserService extends BaseService {
|
|
|
142
143
|
groupToken?: string;
|
|
143
144
|
groupId?: string;
|
|
144
145
|
};
|
|
146
|
+
skipProfileCreation?: boolean;
|
|
145
147
|
}
|
|
146
148
|
): Promise<{
|
|
147
149
|
patientProfile?: string;
|
|
@@ -172,6 +174,12 @@ export class UserService extends BaseService {
|
|
|
172
174
|
profiles.patientProfile = patientProfile.id;
|
|
173
175
|
break;
|
|
174
176
|
case UserRole.CLINIC_ADMIN:
|
|
177
|
+
// Skip profile creation if explicitly requested
|
|
178
|
+
// This is used when we know the profile will be created elsewhere (e.g. in signUpClinicAdmin)
|
|
179
|
+
if (options?.skipProfileCreation) {
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
|
|
175
183
|
// Ako imamo token, verifikujemo ga i dodajemo admina u postojeću grupu
|
|
176
184
|
if (
|
|
177
185
|
options?.clinicAdminData?.groupToken &&
|