@blackcode_sa/metaestetics-api 1.5.1 → 1.5.2
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.js +0 -19
- package/dist/index.mjs +0 -19
- package/package.json +1 -1
- package/src/services/user.service.ts +2 -22
package/dist/index.js
CHANGED
|
@@ -3976,25 +3976,6 @@ var UserService = class extends BaseService {
|
|
|
3976
3976
|
...updates,
|
|
3977
3977
|
updatedAt: (0, import_firestore14.serverTimestamp)()
|
|
3978
3978
|
};
|
|
3979
|
-
updatedUser.roles.forEach((role) => {
|
|
3980
|
-
switch (role) {
|
|
3981
|
-
case "patient" /* PATIENT */:
|
|
3982
|
-
if (!updatedUser.patientProfile) {
|
|
3983
|
-
throw new Error(`Missing patient profile for role ${role}`);
|
|
3984
|
-
}
|
|
3985
|
-
break;
|
|
3986
|
-
case "practitioner" /* PRACTITIONER */:
|
|
3987
|
-
if (!updatedUser.practitionerProfile) {
|
|
3988
|
-
throw new Error(`Missing practitioner profile for role ${role}`);
|
|
3989
|
-
}
|
|
3990
|
-
break;
|
|
3991
|
-
case "clinic_admin" /* CLINIC_ADMIN */:
|
|
3992
|
-
if (!updatedUser.adminProfile) {
|
|
3993
|
-
throw new Error(`Missing admin profile for role ${role}`);
|
|
3994
|
-
}
|
|
3995
|
-
break;
|
|
3996
|
-
}
|
|
3997
|
-
});
|
|
3998
3979
|
userSchema.parse(updatedUser);
|
|
3999
3980
|
await (0, import_firestore14.updateDoc)(userRef, {
|
|
4000
3981
|
...updates,
|
package/dist/index.mjs
CHANGED
|
@@ -3888,25 +3888,6 @@ var UserService = class extends BaseService {
|
|
|
3888
3888
|
...updates,
|
|
3889
3889
|
updatedAt: serverTimestamp10()
|
|
3890
3890
|
};
|
|
3891
|
-
updatedUser.roles.forEach((role) => {
|
|
3892
|
-
switch (role) {
|
|
3893
|
-
case "patient" /* PATIENT */:
|
|
3894
|
-
if (!updatedUser.patientProfile) {
|
|
3895
|
-
throw new Error(`Missing patient profile for role ${role}`);
|
|
3896
|
-
}
|
|
3897
|
-
break;
|
|
3898
|
-
case "practitioner" /* PRACTITIONER */:
|
|
3899
|
-
if (!updatedUser.practitionerProfile) {
|
|
3900
|
-
throw new Error(`Missing practitioner profile for role ${role}`);
|
|
3901
|
-
}
|
|
3902
|
-
break;
|
|
3903
|
-
case "clinic_admin" /* CLINIC_ADMIN */:
|
|
3904
|
-
if (!updatedUser.adminProfile) {
|
|
3905
|
-
throw new Error(`Missing admin profile for role ${role}`);
|
|
3906
|
-
}
|
|
3907
|
-
break;
|
|
3908
|
-
}
|
|
3909
|
-
});
|
|
3910
3891
|
userSchema.parse(updatedUser);
|
|
3911
3892
|
await updateDoc9(userRef, {
|
|
3912
3893
|
...updates,
|
package/package.json
CHANGED
|
@@ -343,30 +343,10 @@ export class UserService extends BaseService {
|
|
|
343
343
|
updatedAt: serverTimestamp(),
|
|
344
344
|
};
|
|
345
345
|
|
|
346
|
-
//
|
|
347
|
-
// Ovo je samo provera - kreiranje profila se radi kroz addRole metodu
|
|
348
|
-
updatedUser.roles.forEach((role: UserRole) => {
|
|
349
|
-
switch (role) {
|
|
350
|
-
case UserRole.PATIENT:
|
|
351
|
-
if (!updatedUser.patientProfile) {
|
|
352
|
-
throw new Error(`Missing patient profile for role ${role}`);
|
|
353
|
-
}
|
|
354
|
-
break;
|
|
355
|
-
case UserRole.PRACTITIONER:
|
|
356
|
-
if (!updatedUser.practitionerProfile) {
|
|
357
|
-
throw new Error(`Missing practitioner profile for role ${role}`);
|
|
358
|
-
}
|
|
359
|
-
break;
|
|
360
|
-
case UserRole.CLINIC_ADMIN:
|
|
361
|
-
if (!updatedUser.adminProfile) {
|
|
362
|
-
throw new Error(`Missing admin profile for role ${role}`);
|
|
363
|
-
}
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
|
|
346
|
+
// Validate the complete updated user object
|
|
368
347
|
userSchema.parse(updatedUser);
|
|
369
348
|
|
|
349
|
+
// Update only the specified fields plus updatedAt
|
|
370
350
|
await updateDoc(userRef, {
|
|
371
351
|
...updates,
|
|
372
352
|
updatedAt: serverTimestamp(),
|