@blackcode_sa/metaestetics-api 1.8.7 → 1.8.9
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/backoffice/index.d.mts +273 -364
- package/dist/backoffice/index.d.ts +273 -364
- package/dist/index.d.mts +313 -16255
- package/dist/index.d.ts +313 -16255
- package/dist/index.js +184 -1012
- package/dist/index.mjs +85 -768
- package/package.json +2 -2
- package/src/config/index.ts +9 -0
- package/src/index.ts +3 -3
- package/src/services/calendar/index.ts +1 -0
- package/src/services/clinic/clinic-admin.service.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -120,166 +120,21 @@ __export(index_exports, {
|
|
|
120
120
|
SubcategoryService: () => SubcategoryService,
|
|
121
121
|
SubscriptionModel: () => SubscriptionModel,
|
|
122
122
|
SyncedCalendarProvider: () => SyncedCalendarProvider,
|
|
123
|
+
SyncedCalendarsService: () => SyncedCalendarsService,
|
|
123
124
|
TechnologyService: () => TechnologyService,
|
|
124
125
|
TimeUnit: () => TimeUnit,
|
|
125
|
-
TimestampUtils: () => TimestampUtils,
|
|
126
126
|
TreatmentBenefit: () => TreatmentBenefit,
|
|
127
127
|
USERS_COLLECTION: () => USERS_COLLECTION,
|
|
128
128
|
USER_FORMS_SUBCOLLECTION: () => USER_FORMS_SUBCOLLECTION,
|
|
129
129
|
UserRole: () => UserRole,
|
|
130
130
|
UserService: () => UserService,
|
|
131
|
-
addAllergySchema: () => addAllergySchema,
|
|
132
|
-
addBlockingConditionSchema: () => addBlockingConditionSchema,
|
|
133
|
-
addContraindicationSchema: () => addContraindicationSchema,
|
|
134
|
-
addMedicationSchema: () => addMedicationSchema,
|
|
135
|
-
addressDataSchema: () => addressDataSchema,
|
|
136
|
-
adminInfoSchema: () => adminInfoSchema,
|
|
137
|
-
adminTokenSchema: () => adminTokenSchema,
|
|
138
|
-
allergySchema: () => allergySchema,
|
|
139
|
-
allergySubtypeSchema: () => allergySubtypeSchema,
|
|
140
|
-
appointmentMediaItemSchema: () => appointmentMediaItemSchema,
|
|
141
|
-
appointmentMetadataSchema: () => appointmentMetadataSchema,
|
|
142
|
-
appointmentNotificationSchema: () => appointmentNotificationSchema,
|
|
143
|
-
appointmentReminderNotificationSchema: () => appointmentReminderNotificationSchema,
|
|
144
|
-
appointmentStatusSchema: () => appointmentStatusSchema,
|
|
145
|
-
baseNotificationSchema: () => baseNotificationSchema,
|
|
146
|
-
beforeAfterPerZoneSchema: () => beforeAfterPerZoneSchema,
|
|
147
|
-
billingPerZoneSchema: () => billingPerZoneSchema,
|
|
148
|
-
blockingConditionSchema: () => blockingConditionSchema,
|
|
149
|
-
calendarEventSchema: () => calendarEventSchema,
|
|
150
|
-
calendarEventTimeSchema: () => calendarEventTimeSchema,
|
|
151
|
-
clinicAdminOptionsSchema: () => clinicAdminOptionsSchema,
|
|
152
|
-
clinicAdminSchema: () => clinicAdminSchema,
|
|
153
|
-
clinicAdminSignupSchema: () => clinicAdminSignupSchema,
|
|
154
|
-
clinicBranchInfoSchema: () => clinicBranchInfoSchema,
|
|
155
|
-
clinicBranchSetupSchema: () => clinicBranchSetupSchema,
|
|
156
|
-
clinicContactInfoSchema: () => clinicContactInfoSchema,
|
|
157
|
-
clinicGroupSchema: () => clinicGroupSchema,
|
|
158
|
-
clinicGroupSetupSchema: () => clinicGroupSetupSchema,
|
|
159
|
-
clinicInfoSchema: () => clinicInfoSchema,
|
|
160
|
-
clinicLocationSchema: () => clinicLocationSchema,
|
|
161
|
-
clinicReviewInfoSchema: () => clinicReviewInfoSchema,
|
|
162
|
-
clinicReviewSchema: () => clinicReviewSchema,
|
|
163
|
-
clinicSchema: () => clinicSchema,
|
|
164
|
-
clinicTagsSchema: () => clinicTagsSchema,
|
|
165
|
-
contactPersonSchema: () => contactPersonSchema,
|
|
166
|
-
contraindicationSchema: () => contraindicationSchema,
|
|
167
|
-
createAdminTokenSchema: () => createAdminTokenSchema,
|
|
168
|
-
createAppointmentSchema: () => createAppointmentSchema,
|
|
169
|
-
createBlockingEventSchema: () => createBlockingEventSchema,
|
|
170
|
-
createCalendarEventSchema: () => createCalendarEventSchema,
|
|
171
|
-
createClinicAdminSchema: () => createClinicAdminSchema,
|
|
172
|
-
createClinicGroupSchema: () => createClinicGroupSchema,
|
|
173
|
-
createClinicReviewSchema: () => createClinicReviewSchema,
|
|
174
|
-
createClinicSchema: () => createClinicSchema,
|
|
175
|
-
createDefaultClinicGroupSchema: () => createDefaultClinicGroupSchema,
|
|
176
|
-
createDocumentTemplateSchema: () => createDocumentTemplateSchema,
|
|
177
|
-
createDraftPractitionerSchema: () => createDraftPractitionerSchema,
|
|
178
|
-
createFilledDocumentDataSchema: () => createFilledDocumentDataSchema,
|
|
179
|
-
createManualPatientSchema: () => createManualPatientSchema,
|
|
180
|
-
createPatientLocationInfoSchema: () => createPatientLocationInfoSchema,
|
|
181
|
-
createPatientMedicalInfoSchema: () => createPatientMedicalInfoSchema,
|
|
182
|
-
createPatientProfileSchema: () => createPatientProfileSchema,
|
|
183
|
-
createPatientSensitiveInfoSchema: () => createPatientSensitiveInfoSchema,
|
|
184
|
-
createPatientTokenSchema: () => createPatientTokenSchema,
|
|
185
|
-
createPractitionerReviewSchema: () => createPractitionerReviewSchema,
|
|
186
|
-
createPractitionerSchema: () => createPractitionerSchema,
|
|
187
|
-
createPractitionerTokenSchema: () => createPractitionerTokenSchema,
|
|
188
|
-
createProcedureReviewSchema: () => createProcedureReviewSchema,
|
|
189
|
-
createProcedureSchema: () => createProcedureSchema,
|
|
190
|
-
createReviewSchema: () => createReviewSchema,
|
|
191
|
-
createUserOptionsSchema: () => createUserOptionsSchema,
|
|
192
|
-
doctorInfoSchema: () => doctorInfoSchema,
|
|
193
|
-
documentElementSchema: () => documentElementSchema,
|
|
194
|
-
documentElementWithoutIdSchema: () => documentElementWithoutIdSchema,
|
|
195
|
-
documentTemplateSchema: () => documentTemplateSchema,
|
|
196
|
-
emailSchema: () => emailSchema,
|
|
197
|
-
emergencyContactSchema: () => emergencyContactSchema,
|
|
198
|
-
filledDocumentSchema: () => filledDocumentSchema,
|
|
199
|
-
filledDocumentStatusSchema: () => filledDocumentStatusSchema,
|
|
200
|
-
finalBillingSchema: () => finalBillingSchema,
|
|
201
|
-
finalizedDetailsSchema: () => finalizedDetailsSchema,
|
|
202
|
-
gamificationSchema: () => gamificationSchema,
|
|
203
131
|
getFirebaseApp: () => getFirebaseApp,
|
|
204
132
|
getFirebaseAuth: () => getFirebaseAuth,
|
|
205
133
|
getFirebaseDB: () => getFirebaseDB,
|
|
206
134
|
getFirebaseFunctions: () => getFirebaseFunctions,
|
|
207
135
|
getFirebaseInstance: () => getFirebaseInstance,
|
|
208
136
|
getFirebaseStorage: () => getFirebaseStorage,
|
|
209
|
-
initializeFirebase: () => initializeFirebase
|
|
210
|
-
linkedFormInfoSchema: () => linkedFormInfoSchema,
|
|
211
|
-
locationDataSchema: () => locationDataSchema,
|
|
212
|
-
mediaResourceSchema: () => mediaResourceSchema,
|
|
213
|
-
mediaTypeSchema: () => mediaTypeSchema,
|
|
214
|
-
medicationSchema: () => medicationSchema,
|
|
215
|
-
notificationSchema: () => notificationSchema,
|
|
216
|
-
passwordSchema: () => passwordSchema,
|
|
217
|
-
patientClinicSchema: () => patientClinicSchema,
|
|
218
|
-
patientDoctorSchema: () => patientDoctorSchema,
|
|
219
|
-
patientInstructionStatusSchema: () => patientInstructionStatusSchema,
|
|
220
|
-
patientLocationInfoSchema: () => patientLocationInfoSchema,
|
|
221
|
-
patientMedicalInfoSchema: () => patientMedicalInfoSchema,
|
|
222
|
-
patientProfileInfoSchema: () => patientProfileInfoSchema,
|
|
223
|
-
patientProfileSchema: () => patientProfileSchema,
|
|
224
|
-
patientRequirementInstanceSchema: () => patientRequirementInstanceSchema,
|
|
225
|
-
patientRequirementInstructionSchema: () => patientRequirementInstructionSchema,
|
|
226
|
-
patientRequirementOverallStatusSchema: () => patientRequirementOverallStatusSchema,
|
|
227
|
-
patientReviewInfoSchema: () => patientReviewInfoSchema,
|
|
228
|
-
patientSensitiveInfoSchema: () => patientSensitiveInfoSchema,
|
|
229
|
-
patientTokenSchema: () => patientTokenSchema,
|
|
230
|
-
paymentStatusSchema: () => paymentStatusSchema,
|
|
231
|
-
postRequirementNotificationSchema: () => postRequirementNotificationSchema,
|
|
232
|
-
practitionerBasicInfoSchema: () => practitionerBasicInfoSchema,
|
|
233
|
-
practitionerCertificationSchema: () => practitionerCertificationSchema,
|
|
234
|
-
practitionerClinicWorkingHoursSchema: () => practitionerClinicWorkingHoursSchema,
|
|
235
|
-
practitionerProfileInfoSchema: () => practitionerProfileInfoSchema,
|
|
236
|
-
practitionerReviewInfoSchema: () => practitionerReviewInfoSchema,
|
|
237
|
-
practitionerReviewSchema: () => practitionerReviewSchema,
|
|
238
|
-
practitionerSchema: () => practitionerSchema,
|
|
239
|
-
practitionerSignupSchema: () => practitionerSignupSchema,
|
|
240
|
-
practitionerTokenSchema: () => practitionerTokenSchema,
|
|
241
|
-
practitionerWorkingHoursSchema: () => practitionerWorkingHoursSchema,
|
|
242
|
-
preRequirementNotificationSchema: () => preRequirementNotificationSchema,
|
|
243
|
-
procedureCategorizationSchema: () => procedureCategorizationSchema,
|
|
244
|
-
procedureExtendedInfoSchema: () => procedureExtendedInfoSchema,
|
|
245
|
-
procedureInfoSchema: () => procedureInfoSchema,
|
|
246
|
-
procedureReviewInfoSchema: () => procedureReviewInfoSchema,
|
|
247
|
-
procedureReviewSchema: () => procedureReviewSchema,
|
|
248
|
-
procedureSchema: () => procedureSchema,
|
|
249
|
-
procedureSummaryInfoSchema: () => procedureSummaryInfoSchema,
|
|
250
|
-
requesterInfoSchema: () => requesterInfoSchema,
|
|
251
|
-
requirementImportanceSchema: () => requirementImportanceSchema,
|
|
252
|
-
requirementInstructionDueNotificationSchema: () => requirementInstructionDueNotificationSchema,
|
|
253
|
-
rescheduleAppointmentSchema: () => rescheduleAppointmentSchema,
|
|
254
|
-
reviewSchema: () => reviewSchema,
|
|
255
|
-
searchAppointmentsSchema: () => searchAppointmentsSchema,
|
|
256
|
-
searchPatientsSchema: () => searchPatientsSchema,
|
|
257
|
-
sharedClinicContactInfoSchema: () => sharedClinicContactInfoSchema,
|
|
258
|
-
sharedClinicLocationSchema: () => sharedClinicLocationSchema,
|
|
259
|
-
syncedCalendarEventSchema: () => syncedCalendarEventSchema,
|
|
260
|
-
timeSlotSchema: () => timeSlotSchema2,
|
|
261
|
-
timestampSchema: () => timestampSchema,
|
|
262
|
-
updateAllergySchema: () => updateAllergySchema,
|
|
263
|
-
updateAppointmentSchema: () => updateAppointmentSchema,
|
|
264
|
-
updateBlockingConditionSchema: () => updateBlockingConditionSchema,
|
|
265
|
-
updateBlockingEventSchema: () => updateBlockingEventSchema,
|
|
266
|
-
updateCalendarEventSchema: () => updateCalendarEventSchema,
|
|
267
|
-
updateClinicAdminSchema: () => updateClinicAdminSchema,
|
|
268
|
-
updateClinicGroupSchema: () => updateClinicGroupSchema,
|
|
269
|
-
updateClinicSchema: () => updateClinicSchema,
|
|
270
|
-
updateContraindicationSchema: () => updateContraindicationSchema,
|
|
271
|
-
updateDocumentTemplateSchema: () => updateDocumentTemplateSchema,
|
|
272
|
-
updateFilledDocumentDataSchema: () => updateFilledDocumentDataSchema,
|
|
273
|
-
updateMedicationSchema: () => updateMedicationSchema,
|
|
274
|
-
updatePatientInstructionStatusSchema: () => updatePatientInstructionStatusSchema,
|
|
275
|
-
updatePatientMedicalInfoSchema: () => updatePatientMedicalInfoSchema,
|
|
276
|
-
updateProcedureSchema: () => updateProcedureSchema,
|
|
277
|
-
updateVitalStatsSchema: () => updateVitalStatsSchema,
|
|
278
|
-
userRoleSchema: () => userRoleSchema,
|
|
279
|
-
userRolesSchema: () => userRolesSchema,
|
|
280
|
-
userSchema: () => userSchema,
|
|
281
|
-
vitalStatsSchema: () => vitalStatsSchema,
|
|
282
|
-
workingHoursSchema: () => workingHoursSchema
|
|
137
|
+
initializeFirebase: () => initializeFirebase
|
|
283
138
|
});
|
|
284
139
|
module.exports = __toCommonJS(index_exports);
|
|
285
140
|
|
|
@@ -582,14 +437,14 @@ var updateFilledDocumentDataSchema = import_zod.z.object({
|
|
|
582
437
|
});
|
|
583
438
|
|
|
584
439
|
// src/backoffice/types/static/pricing.types.ts
|
|
585
|
-
var PricingMeasure = /* @__PURE__ */ ((
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
return
|
|
440
|
+
var PricingMeasure = /* @__PURE__ */ ((PricingMeasure2) => {
|
|
441
|
+
PricingMeasure2["PER_ML"] = "per_ml";
|
|
442
|
+
PricingMeasure2["PER_ZONE"] = "per_zone";
|
|
443
|
+
PricingMeasure2["PER_AREA"] = "per_area";
|
|
444
|
+
PricingMeasure2["PER_SESSION"] = "per_session";
|
|
445
|
+
PricingMeasure2["PER_TREATMENT"] = "per_treatment";
|
|
446
|
+
PricingMeasure2["PER_PACKAGE"] = "per_package";
|
|
447
|
+
return PricingMeasure2;
|
|
593
448
|
})(PricingMeasure || {});
|
|
594
449
|
var Currency = /* @__PURE__ */ ((Currency2) => {
|
|
595
450
|
Currency2["EUR"] = "EUR";
|
|
@@ -4054,8 +3909,8 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
|
|
|
4054
3909
|
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
4055
3910
|
}
|
|
4056
3911
|
async function updateClinicAdmin(db, adminId, data) {
|
|
4057
|
-
const
|
|
4058
|
-
if (!
|
|
3912
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3913
|
+
if (!admin) {
|
|
4059
3914
|
throw new Error("Clinic admin not found");
|
|
4060
3915
|
}
|
|
4061
3916
|
const updatedData = {
|
|
@@ -4070,15 +3925,15 @@ async function updateClinicAdmin(db, adminId, data) {
|
|
|
4070
3925
|
return updatedAdmin;
|
|
4071
3926
|
}
|
|
4072
3927
|
async function deleteClinicAdmin(db, adminId) {
|
|
4073
|
-
const
|
|
4074
|
-
if (!
|
|
3928
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3929
|
+
if (!admin) {
|
|
4075
3930
|
throw new Error("Clinic admin not found");
|
|
4076
3931
|
}
|
|
4077
3932
|
await (0, import_firestore10.deleteDoc)((0, import_firestore10.doc)(db, CLINIC_ADMINS_COLLECTION, adminId));
|
|
4078
3933
|
}
|
|
4079
3934
|
async function addClinicToManaged(db, adminId, clinicId, requesterId, clinicService) {
|
|
4080
|
-
const
|
|
4081
|
-
if (!
|
|
3935
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3936
|
+
if (!admin) {
|
|
4082
3937
|
throw new Error("Clinic admin not found");
|
|
4083
3938
|
}
|
|
4084
3939
|
if (requesterId && requesterId !== adminId) {
|
|
@@ -4086,22 +3941,22 @@ async function addClinicToManaged(db, adminId, clinicId, requesterId, clinicServ
|
|
|
4086
3941
|
if (!requester) {
|
|
4087
3942
|
throw new Error("Requester admin not found");
|
|
4088
3943
|
}
|
|
4089
|
-
if (!requester.isGroupOwner || requester.clinicGroupId !==
|
|
3944
|
+
if (!requester.isGroupOwner || requester.clinicGroupId !== admin.clinicGroupId) {
|
|
4090
3945
|
throw new Error("Only group owner can add clinics to other admins");
|
|
4091
3946
|
}
|
|
4092
3947
|
}
|
|
4093
|
-
if (
|
|
3948
|
+
if (admin.clinicsManaged.includes(clinicId)) {
|
|
4094
3949
|
return;
|
|
4095
3950
|
}
|
|
4096
3951
|
await updateClinicAdmin(db, adminId, {
|
|
4097
|
-
clinicsManaged: [...
|
|
3952
|
+
clinicsManaged: [...admin.clinicsManaged, clinicId]
|
|
4098
3953
|
});
|
|
4099
3954
|
if (clinicService) {
|
|
4100
3955
|
const clinic = await clinicService.getClinic(clinicId);
|
|
4101
3956
|
if (clinic) {
|
|
4102
3957
|
await updateClinicAdmin(db, adminId, {
|
|
4103
3958
|
clinicsManagedInfo: [
|
|
4104
|
-
...
|
|
3959
|
+
...admin.clinicsManagedInfo,
|
|
4105
3960
|
{
|
|
4106
3961
|
id: clinic.id,
|
|
4107
3962
|
featuredPhoto: clinic.featuredPhotos[0] || "",
|
|
@@ -4116,8 +3971,8 @@ async function addClinicToManaged(db, adminId, clinicId, requesterId, clinicServ
|
|
|
4116
3971
|
}
|
|
4117
3972
|
}
|
|
4118
3973
|
async function removeClinicFromManaged(db, adminId, clinicId, requesterId) {
|
|
4119
|
-
const
|
|
4120
|
-
if (!
|
|
3974
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3975
|
+
if (!admin) {
|
|
4121
3976
|
throw new Error("Clinic admin not found");
|
|
4122
3977
|
}
|
|
4123
3978
|
if (requesterId && requesterId !== adminId) {
|
|
@@ -4125,53 +3980,53 @@ async function removeClinicFromManaged(db, adminId, clinicId, requesterId) {
|
|
|
4125
3980
|
if (!requester) {
|
|
4126
3981
|
throw new Error("Requester admin not found");
|
|
4127
3982
|
}
|
|
4128
|
-
if (!requester.isGroupOwner || requester.clinicGroupId !==
|
|
3983
|
+
if (!requester.isGroupOwner || requester.clinicGroupId !== admin.clinicGroupId) {
|
|
4129
3984
|
throw new Error("Only group owner can remove clinics from other admins");
|
|
4130
3985
|
}
|
|
4131
3986
|
}
|
|
4132
|
-
if (!
|
|
3987
|
+
if (!admin.clinicsManaged.includes(clinicId)) {
|
|
4133
3988
|
return;
|
|
4134
3989
|
}
|
|
4135
3990
|
await updateClinicAdmin(db, adminId, {
|
|
4136
|
-
clinicsManaged:
|
|
4137
|
-
clinicsManagedInfo:
|
|
3991
|
+
clinicsManaged: admin.clinicsManaged.filter((id) => id !== clinicId),
|
|
3992
|
+
clinicsManagedInfo: admin.clinicsManagedInfo.filter(
|
|
4138
3993
|
(info) => info.id !== clinicId
|
|
4139
3994
|
)
|
|
4140
3995
|
});
|
|
4141
3996
|
}
|
|
4142
3997
|
async function getManagedClinics(db, adminId, clinicService) {
|
|
4143
|
-
const
|
|
4144
|
-
if (!
|
|
3998
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3999
|
+
if (!admin) {
|
|
4145
4000
|
throw new Error("Clinic admin not found");
|
|
4146
4001
|
}
|
|
4147
|
-
if (
|
|
4002
|
+
if (admin.clinicsManaged.length === 0) {
|
|
4148
4003
|
return [];
|
|
4149
4004
|
}
|
|
4150
4005
|
return clinicService.getClinicsByAdmin(adminId);
|
|
4151
4006
|
}
|
|
4152
4007
|
async function getActiveManagedClinics(db, adminId, clinicService) {
|
|
4153
|
-
const
|
|
4154
|
-
if (!
|
|
4008
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
4009
|
+
if (!admin) {
|
|
4155
4010
|
throw new Error("Clinic admin not found");
|
|
4156
4011
|
}
|
|
4157
|
-
if (
|
|
4012
|
+
if (admin.clinicsManaged.length === 0) {
|
|
4158
4013
|
return [];
|
|
4159
4014
|
}
|
|
4160
4015
|
return clinicService.getActiveClinicsByAdmin(adminId);
|
|
4161
4016
|
}
|
|
4162
4017
|
async function syncOwnerClinics(db, adminId, clinicService, clinicGroupService) {
|
|
4163
|
-
const
|
|
4164
|
-
if (!
|
|
4018
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
4019
|
+
if (!admin) {
|
|
4165
4020
|
throw new Error("Clinic admin not found");
|
|
4166
4021
|
}
|
|
4167
|
-
if (!
|
|
4022
|
+
if (!admin.isGroupOwner) {
|
|
4168
4023
|
return;
|
|
4169
4024
|
}
|
|
4170
|
-
const group = await clinicGroupService.getClinicGroup(
|
|
4025
|
+
const group = await clinicGroupService.getClinicGroup(admin.clinicGroupId);
|
|
4171
4026
|
if (!group) {
|
|
4172
4027
|
throw new Error("Clinic group not found");
|
|
4173
4028
|
}
|
|
4174
|
-
const clinics = await clinicService.getClinicsByGroup(
|
|
4029
|
+
const clinics = await clinicService.getClinicsByGroup(admin.clinicGroupId);
|
|
4175
4030
|
await updateClinicAdmin(db, adminId, {
|
|
4176
4031
|
clinicsManaged: clinics.map((clinic) => clinic.id),
|
|
4177
4032
|
clinicsManagedInfo: clinics.map((clinic) => ({
|
|
@@ -8307,20 +8162,20 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
8307
8162
|
}
|
|
8308
8163
|
try {
|
|
8309
8164
|
console.log("[CLINIC] Checking admin permissions");
|
|
8310
|
-
const
|
|
8311
|
-
if (!
|
|
8165
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8166
|
+
if (!admin) {
|
|
8312
8167
|
console.error("[CLINIC] Admin not found", { adminId });
|
|
8313
8168
|
throw new Error("Admin not found");
|
|
8314
8169
|
}
|
|
8315
|
-
const hasPermission =
|
|
8170
|
+
const hasPermission = admin.isGroupOwner && admin.clinicGroupId === clinic.clinicGroupId || admin.clinicsManaged.includes(clinicId) && clinic.admins && clinic.admins.includes(adminId);
|
|
8316
8171
|
if (!hasPermission) {
|
|
8317
8172
|
console.error(
|
|
8318
8173
|
"[CLINIC] Admin does not have permission to update this clinic",
|
|
8319
8174
|
{
|
|
8320
8175
|
adminId,
|
|
8321
8176
|
clinicId,
|
|
8322
|
-
isGroupOwner:
|
|
8323
|
-
clinicsManaged:
|
|
8177
|
+
isGroupOwner: admin.isGroupOwner,
|
|
8178
|
+
clinicsManaged: admin.clinicsManaged,
|
|
8324
8179
|
isClinicAdmin: clinic.admins && clinic.admins.includes(adminId)
|
|
8325
8180
|
}
|
|
8326
8181
|
);
|
|
@@ -8470,13 +8325,13 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
8470
8325
|
return updatedClinic;
|
|
8471
8326
|
}
|
|
8472
8327
|
async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService, clinicGroupService) {
|
|
8473
|
-
const
|
|
8474
|
-
if (!
|
|
8328
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8329
|
+
if (!admin) {
|
|
8475
8330
|
throw new Error("Admin not found");
|
|
8476
8331
|
}
|
|
8477
|
-
let clinicIds = [...
|
|
8478
|
-
if (
|
|
8479
|
-
const group = await clinicGroupService.getClinicGroup(
|
|
8332
|
+
let clinicIds = [...admin.clinicsManaged];
|
|
8333
|
+
if (admin.isGroupOwner && options.includeGroupClinics) {
|
|
8334
|
+
const group = await clinicGroupService.getClinicGroup(admin.clinicGroupId);
|
|
8480
8335
|
if (group) {
|
|
8481
8336
|
clinicIds = [.../* @__PURE__ */ new Set([...clinicIds, ...group.clinics])];
|
|
8482
8337
|
}
|
|
@@ -8611,11 +8466,11 @@ async function addTags(db, clinicId, adminId, newTags, clinicAdminService, app)
|
|
|
8611
8466
|
if (!clinic) {
|
|
8612
8467
|
throw new Error("Clinic not found");
|
|
8613
8468
|
}
|
|
8614
|
-
const
|
|
8615
|
-
if (!
|
|
8469
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8470
|
+
if (!admin) {
|
|
8616
8471
|
throw new Error("Admin not found");
|
|
8617
8472
|
}
|
|
8618
|
-
const hasPermission =
|
|
8473
|
+
const hasPermission = admin.isGroupOwner && admin.clinicGroupId === clinic.clinicGroupId || admin.clinicsManaged.includes(clinicId) && clinic.admins && clinic.admins.includes(adminId);
|
|
8619
8474
|
if (!hasPermission) {
|
|
8620
8475
|
throw new Error("Admin does not have permission to update this clinic");
|
|
8621
8476
|
}
|
|
@@ -8636,11 +8491,11 @@ async function removeTags(db, clinicId, adminId, tagsToRemove, clinicAdminServic
|
|
|
8636
8491
|
if (!clinic) {
|
|
8637
8492
|
throw new Error("Clinic not found");
|
|
8638
8493
|
}
|
|
8639
|
-
const
|
|
8640
|
-
if (!
|
|
8494
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8495
|
+
if (!admin) {
|
|
8641
8496
|
throw new Error("Admin not found");
|
|
8642
8497
|
}
|
|
8643
|
-
const hasPermission =
|
|
8498
|
+
const hasPermission = admin.isGroupOwner && admin.clinicGroupId === clinic.clinicGroupId || admin.clinicsManaged.includes(clinicId) && clinic.admins && clinic.admins.includes(adminId);
|
|
8644
8499
|
if (!hasPermission) {
|
|
8645
8500
|
throw new Error("Admin does not have permission to update this clinic");
|
|
8646
8501
|
}
|
|
@@ -15670,579 +15525,9 @@ var ReviewService = class extends BaseService {
|
|
|
15670
15525
|
}
|
|
15671
15526
|
};
|
|
15672
15527
|
|
|
15673
|
-
// src/validations/calendar.schema.ts
|
|
15674
|
-
var import_zod27 = require("zod");
|
|
15675
|
-
var import_firestore48 = require("firebase/firestore");
|
|
15676
|
-
|
|
15677
|
-
// src/validations/profile-info.schema.ts
|
|
15678
|
-
var import_zod26 = require("zod");
|
|
15679
|
-
var import_firestore47 = require("firebase/firestore");
|
|
15680
|
-
var clinicBranchInfoSchema = import_zod26.z.object({
|
|
15681
|
-
id: import_zod26.z.string(),
|
|
15682
|
-
featuredPhoto: import_zod26.z.string(),
|
|
15683
|
-
name: import_zod26.z.string(),
|
|
15684
|
-
description: import_zod26.z.string(),
|
|
15685
|
-
location: clinicLocationSchema,
|
|
15686
|
-
contactInfo: clinicContactInfoSchema
|
|
15687
|
-
});
|
|
15688
|
-
var practitionerProfileInfoSchema = import_zod26.z.object({
|
|
15689
|
-
id: import_zod26.z.string(),
|
|
15690
|
-
practitionerPhoto: import_zod26.z.string().nullable(),
|
|
15691
|
-
name: import_zod26.z.string(),
|
|
15692
|
-
email: import_zod26.z.string().email(),
|
|
15693
|
-
phone: import_zod26.z.string().nullable(),
|
|
15694
|
-
certification: practitionerCertificationSchema
|
|
15695
|
-
});
|
|
15696
|
-
var patientProfileInfoSchema = import_zod26.z.object({
|
|
15697
|
-
id: import_zod26.z.string(),
|
|
15698
|
-
fullName: import_zod26.z.string(),
|
|
15699
|
-
email: import_zod26.z.string().email(),
|
|
15700
|
-
phone: import_zod26.z.string().nullable(),
|
|
15701
|
-
dateOfBirth: import_zod26.z.instanceof(import_firestore47.Timestamp),
|
|
15702
|
-
gender: import_zod26.z.nativeEnum(Gender)
|
|
15703
|
-
});
|
|
15704
|
-
|
|
15705
|
-
// src/validations/calendar.schema.ts
|
|
15706
|
-
var MIN_APPOINTMENT_DURATION2 = 15;
|
|
15707
|
-
var calendarEventTimeSchema = import_zod27.z.object({
|
|
15708
|
-
start: import_zod27.z.instanceof(Date).or(import_zod27.z.instanceof(import_firestore48.Timestamp)),
|
|
15709
|
-
end: import_zod27.z.instanceof(Date).or(import_zod27.z.instanceof(import_firestore48.Timestamp))
|
|
15710
|
-
}).refine(
|
|
15711
|
-
(data) => {
|
|
15712
|
-
const startDate = data.start instanceof import_firestore48.Timestamp ? data.start.toDate() : data.start;
|
|
15713
|
-
const endDate = data.end instanceof import_firestore48.Timestamp ? data.end.toDate() : data.end;
|
|
15714
|
-
return startDate < endDate;
|
|
15715
|
-
},
|
|
15716
|
-
{
|
|
15717
|
-
message: "End time must be after start time",
|
|
15718
|
-
path: ["end"]
|
|
15719
|
-
}
|
|
15720
|
-
).refine(
|
|
15721
|
-
(data) => {
|
|
15722
|
-
const startDate = data.start instanceof import_firestore48.Timestamp ? data.start.toDate() : data.start;
|
|
15723
|
-
return startDate > /* @__PURE__ */ new Date();
|
|
15724
|
-
},
|
|
15725
|
-
{
|
|
15726
|
-
message: "Appointment must be scheduled in the future",
|
|
15727
|
-
path: ["start"]
|
|
15728
|
-
}
|
|
15729
|
-
);
|
|
15730
|
-
var timeSlotSchema2 = import_zod27.z.object({
|
|
15731
|
-
start: import_zod27.z.date(),
|
|
15732
|
-
end: import_zod27.z.date(),
|
|
15733
|
-
isAvailable: import_zod27.z.boolean()
|
|
15734
|
-
}).refine((data) => data.start < data.end, {
|
|
15735
|
-
message: "End time must be after start time",
|
|
15736
|
-
path: ["end"]
|
|
15737
|
-
});
|
|
15738
|
-
var syncedCalendarEventSchema = import_zod27.z.object({
|
|
15739
|
-
eventId: import_zod27.z.string(),
|
|
15740
|
-
syncedCalendarProvider: import_zod27.z.nativeEnum(SyncedCalendarProvider),
|
|
15741
|
-
syncedAt: import_zod27.z.instanceof(Date).or(import_zod27.z.instanceof(import_firestore48.Timestamp))
|
|
15742
|
-
});
|
|
15743
|
-
var procedureInfoSchema = import_zod27.z.object({
|
|
15744
|
-
name: import_zod27.z.string(),
|
|
15745
|
-
description: import_zod27.z.string(),
|
|
15746
|
-
duration: import_zod27.z.number().min(MIN_APPOINTMENT_DURATION2),
|
|
15747
|
-
price: import_zod27.z.number().min(0),
|
|
15748
|
-
currency: import_zod27.z.nativeEnum(Currency)
|
|
15749
|
-
});
|
|
15750
|
-
var procedureCategorizationSchema = import_zod27.z.object({
|
|
15751
|
-
procedureFamily: import_zod27.z.string(),
|
|
15752
|
-
// Replace with proper enum when available
|
|
15753
|
-
procedureCategory: import_zod27.z.string(),
|
|
15754
|
-
// Replace with proper enum when available
|
|
15755
|
-
procedureSubcategory: import_zod27.z.string(),
|
|
15756
|
-
// Replace with proper enum when available
|
|
15757
|
-
procedureTechnology: import_zod27.z.string(),
|
|
15758
|
-
// Replace with proper enum when available
|
|
15759
|
-
procedureProduct: import_zod27.z.string()
|
|
15760
|
-
// Replace with proper enum when available
|
|
15761
|
-
});
|
|
15762
|
-
var createCalendarEventSchema = import_zod27.z.object({
|
|
15763
|
-
id: import_zod27.z.string(),
|
|
15764
|
-
clinicBranchId: import_zod27.z.string().nullable().optional(),
|
|
15765
|
-
clinicBranchInfo: clinicBranchInfoSchema.nullable().optional(),
|
|
15766
|
-
practitionerProfileId: import_zod27.z.string().nullable().optional(),
|
|
15767
|
-
practitionerProfileInfo: practitionerProfileInfoSchema.nullable().optional(),
|
|
15768
|
-
patientProfileId: import_zod27.z.string().nullable().optional(),
|
|
15769
|
-
patientProfileInfo: patientProfileInfoSchema.nullable().optional(),
|
|
15770
|
-
procedureId: import_zod27.z.string().nullable().optional(),
|
|
15771
|
-
procedureInfo: procedureInfoSchema.nullable().optional(),
|
|
15772
|
-
procedureCategorization: procedureCategorizationSchema.nullable().optional(),
|
|
15773
|
-
appointmentId: import_zod27.z.string().nullable().optional(),
|
|
15774
|
-
syncedCalendarEventId: import_zod27.z.array(syncedCalendarEventSchema).nullable().optional(),
|
|
15775
|
-
eventName: import_zod27.z.string(),
|
|
15776
|
-
eventLocation: clinicLocationSchema.optional(),
|
|
15777
|
-
eventTime: calendarEventTimeSchema,
|
|
15778
|
-
description: import_zod27.z.string().optional(),
|
|
15779
|
-
status: import_zod27.z.nativeEnum(CalendarEventStatus),
|
|
15780
|
-
syncStatus: import_zod27.z.nativeEnum(CalendarSyncStatus),
|
|
15781
|
-
eventType: import_zod27.z.nativeEnum(CalendarEventType),
|
|
15782
|
-
createdAt: import_zod27.z.any(),
|
|
15783
|
-
// FieldValue for server timestamp
|
|
15784
|
-
updatedAt: import_zod27.z.any()
|
|
15785
|
-
// FieldValue for server timestamp
|
|
15786
|
-
});
|
|
15787
|
-
var updateCalendarEventSchema = import_zod27.z.object({
|
|
15788
|
-
syncedCalendarEventId: import_zod27.z.array(syncedCalendarEventSchema).nullable().optional(),
|
|
15789
|
-
appointmentId: import_zod27.z.string().nullable().optional(),
|
|
15790
|
-
eventName: import_zod27.z.string().optional(),
|
|
15791
|
-
eventTime: calendarEventTimeSchema.optional(),
|
|
15792
|
-
description: import_zod27.z.string().optional(),
|
|
15793
|
-
status: import_zod27.z.nativeEnum(CalendarEventStatus).optional(),
|
|
15794
|
-
syncStatus: import_zod27.z.nativeEnum(CalendarSyncStatus).optional(),
|
|
15795
|
-
eventType: import_zod27.z.nativeEnum(CalendarEventType).optional(),
|
|
15796
|
-
updatedAt: import_zod27.z.any()
|
|
15797
|
-
// FieldValue for server timestamp
|
|
15798
|
-
});
|
|
15799
|
-
var calendarEventSchema = import_zod27.z.object({
|
|
15800
|
-
id: import_zod27.z.string(),
|
|
15801
|
-
clinicBranchId: import_zod27.z.string().nullable().optional(),
|
|
15802
|
-
clinicBranchInfo: clinicBranchInfoSchema.nullable().optional(),
|
|
15803
|
-
// Will be replaced with proper clinic info schema
|
|
15804
|
-
practitionerProfileId: import_zod27.z.string().nullable().optional(),
|
|
15805
|
-
practitionerProfileInfo: practitionerProfileInfoSchema.nullable().optional(),
|
|
15806
|
-
patientProfileId: import_zod27.z.string().nullable().optional(),
|
|
15807
|
-
patientProfileInfo: patientProfileInfoSchema.nullable().optional(),
|
|
15808
|
-
procedureId: import_zod27.z.string().nullable().optional(),
|
|
15809
|
-
procedureInfo: procedureInfoSchema.nullable().optional(),
|
|
15810
|
-
procedureCategorization: procedureCategorizationSchema.nullable().optional(),
|
|
15811
|
-
appointmentId: import_zod27.z.string().nullable().optional(),
|
|
15812
|
-
syncedCalendarEventId: import_zod27.z.array(syncedCalendarEventSchema).nullable().optional(),
|
|
15813
|
-
eventName: import_zod27.z.string(),
|
|
15814
|
-
eventLocation: clinicLocationSchema.optional(),
|
|
15815
|
-
eventTime: calendarEventTimeSchema,
|
|
15816
|
-
description: import_zod27.z.string().optional(),
|
|
15817
|
-
status: import_zod27.z.nativeEnum(CalendarEventStatus),
|
|
15818
|
-
syncStatus: import_zod27.z.nativeEnum(CalendarSyncStatus),
|
|
15819
|
-
eventType: import_zod27.z.nativeEnum(CalendarEventType),
|
|
15820
|
-
createdAt: import_zod27.z.instanceof(Date).or(import_zod27.z.instanceof(import_firestore48.Timestamp)),
|
|
15821
|
-
updatedAt: import_zod27.z.instanceof(Date).or(import_zod27.z.instanceof(import_firestore48.Timestamp))
|
|
15822
|
-
});
|
|
15823
|
-
var createBlockingEventSchema = import_zod27.z.object({
|
|
15824
|
-
entityType: import_zod27.z.enum(["practitioner", "clinic"]),
|
|
15825
|
-
entityId: import_zod27.z.string().min(1, "Entity ID is required"),
|
|
15826
|
-
eventName: import_zod27.z.string().min(1, "Event name is required").max(200, "Event name too long"),
|
|
15827
|
-
eventTime: calendarEventTimeSchema,
|
|
15828
|
-
eventType: import_zod27.z.enum([
|
|
15829
|
-
"blocking" /* BLOCKING */,
|
|
15830
|
-
"break" /* BREAK */,
|
|
15831
|
-
"free_day" /* FREE_DAY */,
|
|
15832
|
-
"other" /* OTHER */
|
|
15833
|
-
]),
|
|
15834
|
-
description: import_zod27.z.string().max(1e3, "Description too long").optional()
|
|
15835
|
-
});
|
|
15836
|
-
var updateBlockingEventSchema = import_zod27.z.object({
|
|
15837
|
-
entityType: import_zod27.z.enum(["practitioner", "clinic"]),
|
|
15838
|
-
entityId: import_zod27.z.string().min(1, "Entity ID is required"),
|
|
15839
|
-
eventId: import_zod27.z.string().min(1, "Event ID is required"),
|
|
15840
|
-
eventName: import_zod27.z.string().min(1, "Event name is required").max(200, "Event name too long").optional(),
|
|
15841
|
-
eventTime: calendarEventTimeSchema.optional(),
|
|
15842
|
-
description: import_zod27.z.string().max(1e3, "Description too long").optional()
|
|
15843
|
-
});
|
|
15844
|
-
|
|
15845
|
-
// src/validations/notification.schema.ts
|
|
15846
|
-
var import_zod28 = require("zod");
|
|
15847
|
-
var baseNotificationSchema = import_zod28.z.object({
|
|
15848
|
-
id: import_zod28.z.string().optional(),
|
|
15849
|
-
userId: import_zod28.z.string(),
|
|
15850
|
-
notificationTime: import_zod28.z.any(),
|
|
15851
|
-
// Timestamp
|
|
15852
|
-
notificationType: import_zod28.z.nativeEnum(NotificationType),
|
|
15853
|
-
notificationTokens: import_zod28.z.array(import_zod28.z.string()),
|
|
15854
|
-
status: import_zod28.z.nativeEnum(NotificationStatus),
|
|
15855
|
-
createdAt: import_zod28.z.any().optional(),
|
|
15856
|
-
// Timestamp
|
|
15857
|
-
updatedAt: import_zod28.z.any().optional(),
|
|
15858
|
-
// Timestamp
|
|
15859
|
-
title: import_zod28.z.string(),
|
|
15860
|
-
body: import_zod28.z.string(),
|
|
15861
|
-
isRead: import_zod28.z.boolean(),
|
|
15862
|
-
userRole: import_zod28.z.nativeEnum(UserRole)
|
|
15863
|
-
});
|
|
15864
|
-
var preRequirementNotificationSchema = baseNotificationSchema.extend({
|
|
15865
|
-
notificationType: import_zod28.z.literal("preRequirementInstructionDue" /* PRE_REQUIREMENT_INSTRUCTION_DUE */),
|
|
15866
|
-
treatmentId: import_zod28.z.string(),
|
|
15867
|
-
requirements: import_zod28.z.array(import_zod28.z.string()),
|
|
15868
|
-
deadline: import_zod28.z.any()
|
|
15869
|
-
// Timestamp
|
|
15870
|
-
});
|
|
15871
|
-
var postRequirementNotificationSchema = baseNotificationSchema.extend({
|
|
15872
|
-
notificationType: import_zod28.z.literal(
|
|
15873
|
-
"postRequirementInstructionDue" /* POST_REQUIREMENT_INSTRUCTION_DUE */
|
|
15874
|
-
),
|
|
15875
|
-
treatmentId: import_zod28.z.string(),
|
|
15876
|
-
requirements: import_zod28.z.array(import_zod28.z.string()),
|
|
15877
|
-
deadline: import_zod28.z.any()
|
|
15878
|
-
// Timestamp
|
|
15879
|
-
});
|
|
15880
|
-
var requirementInstructionDueNotificationSchema = baseNotificationSchema.extend({
|
|
15881
|
-
notificationType: import_zod28.z.literal("requirementInstructionDue" /* REQUIREMENT_INSTRUCTION_DUE */),
|
|
15882
|
-
appointmentId: import_zod28.z.string(),
|
|
15883
|
-
patientRequirementInstanceId: import_zod28.z.string(),
|
|
15884
|
-
instructionId: import_zod28.z.string(),
|
|
15885
|
-
originalRequirementId: import_zod28.z.string().optional()
|
|
15886
|
-
});
|
|
15887
|
-
var appointmentReminderNotificationSchema = baseNotificationSchema.extend({
|
|
15888
|
-
notificationType: import_zod28.z.literal("appointmentReminder" /* APPOINTMENT_REMINDER */),
|
|
15889
|
-
appointmentId: import_zod28.z.string(),
|
|
15890
|
-
appointmentTime: import_zod28.z.any(),
|
|
15891
|
-
// Timestamp
|
|
15892
|
-
treatmentType: import_zod28.z.string(),
|
|
15893
|
-
doctorName: import_zod28.z.string()
|
|
15894
|
-
});
|
|
15895
|
-
var appointmentNotificationSchema = baseNotificationSchema.extend({
|
|
15896
|
-
notificationType: import_zod28.z.literal("appointmentStatusChange" /* APPOINTMENT_STATUS_CHANGE */),
|
|
15897
|
-
appointmentId: import_zod28.z.string(),
|
|
15898
|
-
appointmentStatus: import_zod28.z.string(),
|
|
15899
|
-
previousStatus: import_zod28.z.string(),
|
|
15900
|
-
reason: import_zod28.z.string().optional()
|
|
15901
|
-
});
|
|
15902
|
-
var notificationSchema = import_zod28.z.discriminatedUnion("notificationType", [
|
|
15903
|
-
preRequirementNotificationSchema,
|
|
15904
|
-
postRequirementNotificationSchema,
|
|
15905
|
-
requirementInstructionDueNotificationSchema,
|
|
15906
|
-
appointmentReminderNotificationSchema,
|
|
15907
|
-
appointmentNotificationSchema
|
|
15908
|
-
]);
|
|
15909
|
-
|
|
15910
|
-
// src/validations/patient/patient-requirements.schema.ts
|
|
15911
|
-
var import_zod30 = require("zod");
|
|
15912
|
-
|
|
15913
|
-
// src/backoffice/validations/schemas.ts
|
|
15914
|
-
var import_zod29 = require("zod");
|
|
15915
|
-
|
|
15916
|
-
// src/backoffice/types/static/treatment-benefit.types.ts
|
|
15917
|
-
var TreatmentBenefit = /* @__PURE__ */ ((TreatmentBenefit2) => {
|
|
15918
|
-
TreatmentBenefit2["WRINKLE_REDUCTION"] = "wrinkle_reduction";
|
|
15919
|
-
TreatmentBenefit2["SKIN_TIGHTENING"] = "skin_tightening";
|
|
15920
|
-
TreatmentBenefit2["COLLAGEN_PRODUCTION"] = "collagen_production";
|
|
15921
|
-
TreatmentBenefit2["ACNE_REDUCTION"] = "acne_reduction";
|
|
15922
|
-
TreatmentBenefit2["SCAR_REDUCTION"] = "scar_reduction";
|
|
15923
|
-
TreatmentBenefit2["PIGMENTATION_IMPROVEMENT"] = "pigmentation_improvement";
|
|
15924
|
-
TreatmentBenefit2["HAIR_REMOVAL"] = "hair_removal";
|
|
15925
|
-
TreatmentBenefit2["MUSCLE_TONING"] = "muscle_toning";
|
|
15926
|
-
TreatmentBenefit2["FAT_REDUCTION"] = "fat_reduction";
|
|
15927
|
-
TreatmentBenefit2["CELLULITE_REDUCTION"] = "cellulite_reduction";
|
|
15928
|
-
TreatmentBenefit2["SKIN_REJUVENATION"] = "skin_rejuvenation";
|
|
15929
|
-
TreatmentBenefit2["PORE_REDUCTION"] = "pore_reduction";
|
|
15930
|
-
TreatmentBenefit2["TEXTURE_IMPROVEMENT"] = "texture_improvement";
|
|
15931
|
-
TreatmentBenefit2["HYDRATION_BOOST"] = "hydration_boost";
|
|
15932
|
-
TreatmentBenefit2["CIRCULATION_IMPROVEMENT"] = "circulation_improvement";
|
|
15933
|
-
return TreatmentBenefit2;
|
|
15934
|
-
})(TreatmentBenefit || {});
|
|
15935
|
-
|
|
15936
|
-
// src/backoffice/types/requirement.types.ts
|
|
15937
|
-
var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
|
|
15938
|
-
TimeUnit2["HOURS"] = "hours";
|
|
15939
|
-
TimeUnit2["DAYS"] = "days";
|
|
15940
|
-
return TimeUnit2;
|
|
15941
|
-
})(TimeUnit || {});
|
|
15942
|
-
var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
|
|
15943
|
-
RequirementType2["PRE"] = "pre";
|
|
15944
|
-
RequirementType2["POST"] = "post";
|
|
15945
|
-
return RequirementType2;
|
|
15946
|
-
})(RequirementType || {});
|
|
15947
|
-
|
|
15948
|
-
// src/backoffice/validations/schemas.ts
|
|
15949
|
-
var blockingConditionSchemaBackoffice = import_zod29.z.nativeEnum(BlockingCondition);
|
|
15950
|
-
var contraindicationSchemaBackoffice = import_zod29.z.nativeEnum(Contraindication);
|
|
15951
|
-
var treatmentBenefitSchemaBackoffice = import_zod29.z.nativeEnum(TreatmentBenefit);
|
|
15952
|
-
var procedureFamilySchemaBackoffice = import_zod29.z.nativeEnum(ProcedureFamily);
|
|
15953
|
-
var timeUnitSchemaBackoffice = import_zod29.z.nativeEnum(TimeUnit);
|
|
15954
|
-
var requirementTypeSchema = import_zod29.z.nativeEnum(RequirementType);
|
|
15955
|
-
var certificationLevelSchema = import_zod29.z.nativeEnum(CertificationLevel);
|
|
15956
|
-
var certificationSpecialtySchema = import_zod29.z.nativeEnum(
|
|
15957
|
-
CertificationSpecialty
|
|
15958
|
-
);
|
|
15959
|
-
var certificationRequirementSchema = import_zod29.z.object({
|
|
15960
|
-
minimumLevel: certificationLevelSchema,
|
|
15961
|
-
requiredSpecialties: import_zod29.z.array(certificationSpecialtySchema).max(5, "Maximum 5 specialties allowed").optional()
|
|
15962
|
-
});
|
|
15963
|
-
var timeframeSchema = import_zod29.z.object({
|
|
15964
|
-
duration: import_zod29.z.number().min(1, "Duration must be positive"),
|
|
15965
|
-
unit: timeUnitSchemaBackoffice,
|
|
15966
|
-
notifyAt: import_zod29.z.array(import_zod29.z.number()).min(1, "At least one notification point is required")
|
|
15967
|
-
});
|
|
15968
|
-
var requirementSchema = import_zod29.z.object({
|
|
15969
|
-
name: import_zod29.z.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
15970
|
-
description: import_zod29.z.string().min(1, "Description is required"),
|
|
15971
|
-
type: requirementTypeSchema,
|
|
15972
|
-
timeframe: timeframeSchema,
|
|
15973
|
-
importance: import_zod29.z.enum(["low", "medium", "high"]),
|
|
15974
|
-
isActive: import_zod29.z.boolean().default(true)
|
|
15975
|
-
});
|
|
15976
|
-
var technologyRequirementsSchema = import_zod29.z.object({
|
|
15977
|
-
pre: import_zod29.z.array(requirementSchema),
|
|
15978
|
-
post: import_zod29.z.array(requirementSchema)
|
|
15979
|
-
});
|
|
15980
|
-
var technologySchema = import_zod29.z.object({
|
|
15981
|
-
name: import_zod29.z.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
15982
|
-
description: import_zod29.z.string().max(1e3, "Description is too long").optional(),
|
|
15983
|
-
technicalDetails: import_zod29.z.string().max(2e3, "Technical details are too long").optional(),
|
|
15984
|
-
family: procedureFamilySchemaBackoffice,
|
|
15985
|
-
categoryId: import_zod29.z.string().min(1, "Category ID is required"),
|
|
15986
|
-
subcategoryId: import_zod29.z.string().min(1, "Subcategory ID is required"),
|
|
15987
|
-
requirements: technologyRequirementsSchema.default({
|
|
15988
|
-
pre: [],
|
|
15989
|
-
post: []
|
|
15990
|
-
}),
|
|
15991
|
-
blockingConditions: import_zod29.z.array(blockingConditionSchemaBackoffice),
|
|
15992
|
-
contraindications: import_zod29.z.array(contraindicationSchemaBackoffice),
|
|
15993
|
-
documentationTemplates: import_zod29.z.array(documentTemplateSchema),
|
|
15994
|
-
benefits: import_zod29.z.array(treatmentBenefitSchemaBackoffice),
|
|
15995
|
-
certificationRequirement: certificationRequirementSchema,
|
|
15996
|
-
isActive: import_zod29.z.boolean().default(true)
|
|
15997
|
-
});
|
|
15998
|
-
var categorySchema = import_zod29.z.object({
|
|
15999
|
-
name: import_zod29.z.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
16000
|
-
description: import_zod29.z.string().optional(),
|
|
16001
|
-
family: procedureFamilySchemaBackoffice,
|
|
16002
|
-
isActive: import_zod29.z.boolean().default(true)
|
|
16003
|
-
});
|
|
16004
|
-
var subcategorySchema = import_zod29.z.object({
|
|
16005
|
-
name: import_zod29.z.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
16006
|
-
description: import_zod29.z.string().optional(),
|
|
16007
|
-
categoryId: import_zod29.z.string().min(1, "Category ID is required"),
|
|
16008
|
-
isActive: import_zod29.z.boolean().default(true)
|
|
16009
|
-
});
|
|
16010
|
-
var categoryUpdateSchema = categorySchema.partial();
|
|
16011
|
-
var subcategoryUpdateSchema = subcategorySchema.partial();
|
|
16012
|
-
var technologyUpdateSchema = technologySchema.partial();
|
|
16013
|
-
var requirementUpdateSchema = requirementSchema.partial();
|
|
16014
|
-
|
|
16015
|
-
// src/validations/patient/patient-requirements.schema.ts
|
|
16016
|
-
var patientInstructionStatusSchema = import_zod30.z.nativeEnum(
|
|
16017
|
-
PatientInstructionStatus
|
|
16018
|
-
);
|
|
16019
|
-
var patientRequirementInstructionSchema = import_zod30.z.object({
|
|
16020
|
-
instructionId: import_zod30.z.string().min(1, "Instruction ID is required."),
|
|
16021
|
-
instructionText: import_zod30.z.string().min(1, "Instruction text is required."),
|
|
16022
|
-
dueTime: import_zod30.z.any(),
|
|
16023
|
-
// Firestore Timestamp
|
|
16024
|
-
actionableWindow: import_zod30.z.number().default(1),
|
|
16025
|
-
status: patientInstructionStatusSchema,
|
|
16026
|
-
originalNotifyAtValue: import_zod30.z.number(),
|
|
16027
|
-
originalTimeframeUnit: timeUnitSchemaBackoffice,
|
|
16028
|
-
// Use the correctly imported timeUnitSchema
|
|
16029
|
-
notificationId: import_zod30.z.string().optional(),
|
|
16030
|
-
actionTakenAt: import_zod30.z.any().optional().nullable(),
|
|
16031
|
-
// Firestore Timestamp or null
|
|
16032
|
-
updatedAt: import_zod30.z.any()
|
|
16033
|
-
// Firestore Timestamp
|
|
16034
|
-
});
|
|
16035
|
-
var patientRequirementOverallStatusSchema = import_zod30.z.nativeEnum(
|
|
16036
|
-
PatientRequirementOverallStatus
|
|
16037
|
-
);
|
|
16038
|
-
var requirementImportanceSchema = import_zod30.z.enum(["low", "medium", "high"]);
|
|
16039
|
-
var patientRequirementInstanceSchema = import_zod30.z.object({
|
|
16040
|
-
id: import_zod30.z.string().min(1, "Instance ID is required."),
|
|
16041
|
-
patientId: import_zod30.z.string().min(1, "Patient ID is required."),
|
|
16042
|
-
appointmentId: import_zod30.z.string().min(1, "Appointment ID is required."),
|
|
16043
|
-
originalRequirementId: import_zod30.z.string().min(1, "Original Requirement ID is required."),
|
|
16044
|
-
requirementType: requirementTypeSchema,
|
|
16045
|
-
requirementName: import_zod30.z.string().min(1, "Requirement name is required."),
|
|
16046
|
-
requirementDescription: import_zod30.z.string(),
|
|
16047
|
-
requirementImportance: requirementImportanceSchema,
|
|
16048
|
-
// Use the locally defined schema
|
|
16049
|
-
overallStatus: patientRequirementOverallStatusSchema,
|
|
16050
|
-
instructions: import_zod30.z.array(patientRequirementInstructionSchema).min(1, "At least one instruction is required."),
|
|
16051
|
-
createdAt: import_zod30.z.any(),
|
|
16052
|
-
// Firestore Timestamp
|
|
16053
|
-
updatedAt: import_zod30.z.any()
|
|
16054
|
-
// Firestore Timestamp
|
|
16055
|
-
});
|
|
16056
|
-
var updatePatientInstructionStatusSchema = import_zod30.z.object({
|
|
16057
|
-
status: import_zod30.z.literal("actionTaken" /* ACTION_TAKEN */),
|
|
16058
|
-
actionTakenAt: import_zod30.z.any()
|
|
16059
|
-
// Should be a Timestamp from the server
|
|
16060
|
-
});
|
|
16061
|
-
|
|
16062
|
-
// src/utils/TimestampUtils.ts
|
|
16063
|
-
var admin = __toESM(require("firebase-admin"));
|
|
16064
|
-
var import_firestore49 = require("firebase/firestore");
|
|
16065
|
-
var IS_SERVER_ENV = process.env.NODE_ENV === "production" || process.env.FUNCTIONS_EMULATOR === "true" || process.env.FIREBASE_CONFIG !== void 0;
|
|
16066
|
-
var TimestampUtils = class {
|
|
16067
|
-
/**
|
|
16068
|
-
* Enables server mode where admin timestamps are preserved when saving
|
|
16069
|
-
* to Firestore via the admin SDK
|
|
16070
|
-
*/
|
|
16071
|
-
static enableServerMode() {
|
|
16072
|
-
this.serverMode = true;
|
|
16073
|
-
}
|
|
16074
|
-
/**
|
|
16075
|
-
* Disables server mode - use this only for client-side or mixed environments
|
|
16076
|
-
*/
|
|
16077
|
-
static disableServerMode() {
|
|
16078
|
-
this.serverMode = false;
|
|
16079
|
-
}
|
|
16080
|
-
/**
|
|
16081
|
-
* Converts an admin Firestore Timestamp to a client Firestore Timestamp
|
|
16082
|
-
* In server mode, returns the original admin timestamp for storage consistency
|
|
16083
|
-
*
|
|
16084
|
-
* @param adminTimestamp - Admin SDK Timestamp (from firebase-admin)
|
|
16085
|
-
* @returns A client SDK Timestamp (from firebase/firestore) with same seconds/nanoseconds,
|
|
16086
|
-
* or the original admin timestamp in server mode,
|
|
16087
|
-
* or null if input is null
|
|
16088
|
-
*/
|
|
16089
|
-
static adminToClient(adminTimestamp) {
|
|
16090
|
-
if (!adminTimestamp) return null;
|
|
16091
|
-
if (this.serverMode) {
|
|
16092
|
-
return adminTimestamp;
|
|
16093
|
-
}
|
|
16094
|
-
return new import_firestore49.Timestamp(
|
|
16095
|
-
adminTimestamp.seconds,
|
|
16096
|
-
adminTimestamp.nanoseconds
|
|
16097
|
-
);
|
|
16098
|
-
}
|
|
16099
|
-
/**
|
|
16100
|
-
* Converts a client Firestore Timestamp to an admin Firestore Timestamp
|
|
16101
|
-
* @param clientTimestamp - Client SDK Timestamp (from firebase/firestore)
|
|
16102
|
-
* @returns An admin SDK Timestamp (from firebase-admin) with same seconds/nanoseconds or null if input is null
|
|
16103
|
-
*/
|
|
16104
|
-
static clientToAdmin(clientTimestamp) {
|
|
16105
|
-
if (!clientTimestamp) return null;
|
|
16106
|
-
return new admin.firestore.Timestamp(
|
|
16107
|
-
clientTimestamp.seconds,
|
|
16108
|
-
clientTimestamp.nanoseconds
|
|
16109
|
-
);
|
|
16110
|
-
}
|
|
16111
|
-
/**
|
|
16112
|
-
* Creates a timestamp for the current time in the appropriate format based on environment
|
|
16113
|
-
* @returns A timestamp for the current time (admin timestamp in server mode, client in client mode)
|
|
16114
|
-
*/
|
|
16115
|
-
static nowAsTimestamp() {
|
|
16116
|
-
const now = admin.firestore.Timestamp.now();
|
|
16117
|
-
if (this.serverMode) {
|
|
16118
|
-
return now;
|
|
16119
|
-
}
|
|
16120
|
-
return this.adminToClient(now);
|
|
16121
|
-
}
|
|
16122
|
-
/**
|
|
16123
|
-
* @deprecated Use nowAsTimestamp() instead for better cross-environment compatibility
|
|
16124
|
-
*/
|
|
16125
|
-
static nowAsClient() {
|
|
16126
|
-
const now = admin.firestore.Timestamp.now();
|
|
16127
|
-
return this.adminToClient(now);
|
|
16128
|
-
}
|
|
16129
|
-
/**
|
|
16130
|
-
* Converts a Date object to a timestamp in the appropriate format based on environment
|
|
16131
|
-
* @param date - JavaScript Date object
|
|
16132
|
-
* @returns A timestamp (admin timestamp in server mode, client in client mode) or null if input is null
|
|
16133
|
-
*/
|
|
16134
|
-
static dateToTimestamp(date) {
|
|
16135
|
-
if (!date) return null;
|
|
16136
|
-
if (this.serverMode) {
|
|
16137
|
-
return admin.firestore.Timestamp.fromDate(date);
|
|
16138
|
-
}
|
|
16139
|
-
return import_firestore49.Timestamp.fromDate(date);
|
|
16140
|
-
}
|
|
16141
|
-
/**
|
|
16142
|
-
* @deprecated Use dateToTimestamp() instead for better cross-environment compatibility
|
|
16143
|
-
*/
|
|
16144
|
-
static dateToClientTimestamp(date) {
|
|
16145
|
-
if (!date) return null;
|
|
16146
|
-
return import_firestore49.Timestamp.fromDate(date);
|
|
16147
|
-
}
|
|
16148
|
-
/**
|
|
16149
|
-
* @deprecated Use dateToTimestamp() instead for better cross-environment compatibility
|
|
16150
|
-
*/
|
|
16151
|
-
static dateToAdminTimestamp(date) {
|
|
16152
|
-
if (!date) return null;
|
|
16153
|
-
return admin.firestore.Timestamp.fromDate(date);
|
|
16154
|
-
}
|
|
16155
|
-
/**
|
|
16156
|
-
* Gets a server timestamp field value for use in create/update operations
|
|
16157
|
-
* Works in both admin and client environments
|
|
16158
|
-
*/
|
|
16159
|
-
static serverTimestamp() {
|
|
16160
|
-
if (this.serverMode) {
|
|
16161
|
-
return admin.firestore.FieldValue.serverTimestamp();
|
|
16162
|
-
}
|
|
16163
|
-
throw new Error("Server timestamp in client mode not implemented");
|
|
16164
|
-
}
|
|
16165
|
-
/**
|
|
16166
|
-
* For objects with mixed timestamp types, ensures all timestamps are
|
|
16167
|
-
* in the correct format for the current environment
|
|
16168
|
-
*/
|
|
16169
|
-
static normalizeTimestamps(obj) {
|
|
16170
|
-
if (!obj || typeof obj !== "object") {
|
|
16171
|
-
return obj;
|
|
16172
|
-
}
|
|
16173
|
-
if (obj instanceof admin.firestore.Timestamp) {
|
|
16174
|
-
return this.serverMode ? obj : this.adminToClient(obj);
|
|
16175
|
-
}
|
|
16176
|
-
if (obj instanceof import_firestore49.Timestamp && this.serverMode) {
|
|
16177
|
-
return this.clientToAdmin(obj);
|
|
16178
|
-
}
|
|
16179
|
-
if (Array.isArray(obj)) {
|
|
16180
|
-
return obj.map((item) => this.normalizeTimestamps(item));
|
|
16181
|
-
}
|
|
16182
|
-
const result = { ...obj };
|
|
16183
|
-
for (const key in result) {
|
|
16184
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
16185
|
-
result[key] = this.normalizeTimestamps(result[key]);
|
|
16186
|
-
}
|
|
16187
|
-
}
|
|
16188
|
-
return result;
|
|
16189
|
-
}
|
|
16190
|
-
/**
|
|
16191
|
-
* @deprecated Use normalizeTimestamps() instead for better cross-environment compatibility
|
|
16192
|
-
*/
|
|
16193
|
-
static convertObjectTimestampsAdminToClient(obj) {
|
|
16194
|
-
if (!obj || typeof obj !== "object") {
|
|
16195
|
-
return obj;
|
|
16196
|
-
}
|
|
16197
|
-
if (obj instanceof admin.firestore.Timestamp) {
|
|
16198
|
-
return this.adminToClient(obj);
|
|
16199
|
-
}
|
|
16200
|
-
if (Array.isArray(obj)) {
|
|
16201
|
-
return obj.map(
|
|
16202
|
-
(item) => this.convertObjectTimestampsAdminToClient(item)
|
|
16203
|
-
);
|
|
16204
|
-
}
|
|
16205
|
-
const result = { ...obj };
|
|
16206
|
-
for (const key in result) {
|
|
16207
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
16208
|
-
result[key] = this.convertObjectTimestampsAdminToClient(result[key]);
|
|
16209
|
-
}
|
|
16210
|
-
}
|
|
16211
|
-
return result;
|
|
16212
|
-
}
|
|
16213
|
-
/**
|
|
16214
|
-
* @deprecated Use normalizeTimestamps() instead for better cross-environment compatibility
|
|
16215
|
-
*/
|
|
16216
|
-
static convertObjectTimestampsClientToAdmin(obj) {
|
|
16217
|
-
if (!obj || typeof obj !== "object") {
|
|
16218
|
-
return obj;
|
|
16219
|
-
}
|
|
16220
|
-
if (obj instanceof import_firestore49.Timestamp) {
|
|
16221
|
-
return this.clientToAdmin(obj);
|
|
16222
|
-
}
|
|
16223
|
-
if (Array.isArray(obj)) {
|
|
16224
|
-
return obj.map(
|
|
16225
|
-
(item) => this.convertObjectTimestampsClientToAdmin(item)
|
|
16226
|
-
);
|
|
16227
|
-
}
|
|
16228
|
-
const result = { ...obj };
|
|
16229
|
-
for (const key in result) {
|
|
16230
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
16231
|
-
result[key] = this.convertObjectTimestampsClientToAdmin(result[key]);
|
|
16232
|
-
}
|
|
16233
|
-
}
|
|
16234
|
-
return result;
|
|
16235
|
-
}
|
|
16236
|
-
};
|
|
16237
|
-
/**
|
|
16238
|
-
* Flag to force server mode where admin timestamps are preserved
|
|
16239
|
-
* This should be true in Cloud Functions environments
|
|
16240
|
-
*/
|
|
16241
|
-
TimestampUtils.serverMode = IS_SERVER_ENV;
|
|
16242
|
-
|
|
16243
15528
|
// src/config/firebase.ts
|
|
16244
15529
|
var import_app = require("firebase/app");
|
|
16245
|
-
var
|
|
15530
|
+
var import_firestore47 = require("firebase/firestore");
|
|
16246
15531
|
var import_auth9 = require("firebase/auth");
|
|
16247
15532
|
var import_analytics = require("firebase/analytics");
|
|
16248
15533
|
var import_react_native = require("react-native");
|
|
@@ -16252,7 +15537,7 @@ var firebaseInstance = null;
|
|
|
16252
15537
|
var initializeFirebase = (config) => {
|
|
16253
15538
|
if (!firebaseInstance) {
|
|
16254
15539
|
const app = (0, import_app.initializeApp)(config);
|
|
16255
|
-
const db = (0,
|
|
15540
|
+
const db = (0, import_firestore47.getFirestore)(app);
|
|
16256
15541
|
const auth = (0, import_auth9.getAuth)(app);
|
|
16257
15542
|
const storage = (0, import_storage4.getStorage)(app);
|
|
16258
15543
|
const functions = (0, import_functions2.getFunctions)(app);
|
|
@@ -16294,7 +15579,7 @@ var getFirebaseFunctions = async () => {
|
|
|
16294
15579
|
};
|
|
16295
15580
|
|
|
16296
15581
|
// src/backoffice/services/brand.service.ts
|
|
16297
|
-
var
|
|
15582
|
+
var import_firestore48 = require("firebase/firestore");
|
|
16298
15583
|
|
|
16299
15584
|
// src/backoffice/types/brand.types.ts
|
|
16300
15585
|
var BRANDS_COLLECTION = "brands";
|
|
@@ -16305,7 +15590,7 @@ var BrandService = class extends BaseService {
|
|
|
16305
15590
|
* Gets reference to brands collection
|
|
16306
15591
|
*/
|
|
16307
15592
|
getBrandsRef() {
|
|
16308
|
-
return (0,
|
|
15593
|
+
return (0, import_firestore48.collection)(this.db, BRANDS_COLLECTION);
|
|
16309
15594
|
}
|
|
16310
15595
|
/**
|
|
16311
15596
|
* Creates a new brand
|
|
@@ -16318,15 +15603,15 @@ var BrandService = class extends BaseService {
|
|
|
16318
15603
|
updatedAt: now,
|
|
16319
15604
|
isActive: true
|
|
16320
15605
|
};
|
|
16321
|
-
const docRef = await (0,
|
|
15606
|
+
const docRef = await (0, import_firestore48.addDoc)(this.getBrandsRef(), newBrand);
|
|
16322
15607
|
return { id: docRef.id, ...newBrand };
|
|
16323
15608
|
}
|
|
16324
15609
|
/**
|
|
16325
15610
|
* Gets all active brands
|
|
16326
15611
|
*/
|
|
16327
15612
|
async getAll() {
|
|
16328
|
-
const q = (0,
|
|
16329
|
-
const snapshot = await (0,
|
|
15613
|
+
const q = (0, import_firestore48.query)(this.getBrandsRef(), (0, import_firestore48.where)("isActive", "==", true));
|
|
15614
|
+
const snapshot = await (0, import_firestore48.getDocs)(q);
|
|
16330
15615
|
return snapshot.docs.map(
|
|
16331
15616
|
(doc37) => ({
|
|
16332
15617
|
id: doc37.id,
|
|
@@ -16342,8 +15627,8 @@ var BrandService = class extends BaseService {
|
|
|
16342
15627
|
...brand,
|
|
16343
15628
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16344
15629
|
};
|
|
16345
|
-
const docRef = (0,
|
|
16346
|
-
await (0,
|
|
15630
|
+
const docRef = (0, import_firestore48.doc)(this.getBrandsRef(), brandId);
|
|
15631
|
+
await (0, import_firestore48.updateDoc)(docRef, updateData);
|
|
16347
15632
|
return this.getById(brandId);
|
|
16348
15633
|
}
|
|
16349
15634
|
/**
|
|
@@ -16358,8 +15643,8 @@ var BrandService = class extends BaseService {
|
|
|
16358
15643
|
* Gets a brand by ID
|
|
16359
15644
|
*/
|
|
16360
15645
|
async getById(brandId) {
|
|
16361
|
-
const docRef = (0,
|
|
16362
|
-
const docSnap = await (0,
|
|
15646
|
+
const docRef = (0, import_firestore48.doc)(this.getBrandsRef(), brandId);
|
|
15647
|
+
const docSnap = await (0, import_firestore48.getDoc)(docRef);
|
|
16363
15648
|
if (!docSnap.exists()) return null;
|
|
16364
15649
|
return {
|
|
16365
15650
|
id: docSnap.id,
|
|
@@ -16369,7 +15654,7 @@ var BrandService = class extends BaseService {
|
|
|
16369
15654
|
};
|
|
16370
15655
|
|
|
16371
15656
|
// src/backoffice/services/category.service.ts
|
|
16372
|
-
var
|
|
15657
|
+
var import_firestore49 = require("firebase/firestore");
|
|
16373
15658
|
|
|
16374
15659
|
// src/backoffice/types/category.types.ts
|
|
16375
15660
|
var CATEGORIES_COLLECTION = "backoffice_categories";
|
|
@@ -16380,7 +15665,7 @@ var CategoryService = class extends BaseService {
|
|
|
16380
15665
|
* Referenca na Firestore kolekciju kategorija
|
|
16381
15666
|
*/
|
|
16382
15667
|
get categoriesRef() {
|
|
16383
|
-
return (0,
|
|
15668
|
+
return (0, import_firestore49.collection)(this.db, CATEGORIES_COLLECTION);
|
|
16384
15669
|
}
|
|
16385
15670
|
/**
|
|
16386
15671
|
* Kreira novu kategoriju u sistemu
|
|
@@ -16395,7 +15680,7 @@ var CategoryService = class extends BaseService {
|
|
|
16395
15680
|
updatedAt: now,
|
|
16396
15681
|
isActive: true
|
|
16397
15682
|
};
|
|
16398
|
-
const docRef = await (0,
|
|
15683
|
+
const docRef = await (0, import_firestore49.addDoc)(this.categoriesRef, newCategory);
|
|
16399
15684
|
return { id: docRef.id, ...newCategory };
|
|
16400
15685
|
}
|
|
16401
15686
|
/**
|
|
@@ -16403,8 +15688,8 @@ var CategoryService = class extends BaseService {
|
|
|
16403
15688
|
* @returns Lista aktivnih kategorija
|
|
16404
15689
|
*/
|
|
16405
15690
|
async getAll() {
|
|
16406
|
-
const q = (0,
|
|
16407
|
-
const snapshot = await (0,
|
|
15691
|
+
const q = (0, import_firestore49.query)(this.categoriesRef, (0, import_firestore49.where)("isActive", "==", true));
|
|
15692
|
+
const snapshot = await (0, import_firestore49.getDocs)(q);
|
|
16408
15693
|
return snapshot.docs.map(
|
|
16409
15694
|
(doc37) => ({
|
|
16410
15695
|
id: doc37.id,
|
|
@@ -16418,12 +15703,12 @@ var CategoryService = class extends BaseService {
|
|
|
16418
15703
|
* @returns Lista kategorija koje pripadaju traženoj familiji
|
|
16419
15704
|
*/
|
|
16420
15705
|
async getAllByFamily(family) {
|
|
16421
|
-
const q = (0,
|
|
15706
|
+
const q = (0, import_firestore49.query)(
|
|
16422
15707
|
this.categoriesRef,
|
|
16423
|
-
(0,
|
|
16424
|
-
(0,
|
|
15708
|
+
(0, import_firestore49.where)("family", "==", family),
|
|
15709
|
+
(0, import_firestore49.where)("isActive", "==", true)
|
|
16425
15710
|
);
|
|
16426
|
-
const snapshot = await (0,
|
|
15711
|
+
const snapshot = await (0, import_firestore49.getDocs)(q);
|
|
16427
15712
|
return snapshot.docs.map(
|
|
16428
15713
|
(doc37) => ({
|
|
16429
15714
|
id: doc37.id,
|
|
@@ -16442,8 +15727,8 @@ var CategoryService = class extends BaseService {
|
|
|
16442
15727
|
...category,
|
|
16443
15728
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16444
15729
|
};
|
|
16445
|
-
const docRef = (0,
|
|
16446
|
-
await (0,
|
|
15730
|
+
const docRef = (0, import_firestore49.doc)(this.categoriesRef, id);
|
|
15731
|
+
await (0, import_firestore49.updateDoc)(docRef, updateData);
|
|
16447
15732
|
return this.getById(id);
|
|
16448
15733
|
}
|
|
16449
15734
|
/**
|
|
@@ -16459,8 +15744,8 @@ var CategoryService = class extends BaseService {
|
|
|
16459
15744
|
* @returns Kategorija ili null ako ne postoji
|
|
16460
15745
|
*/
|
|
16461
15746
|
async getById(id) {
|
|
16462
|
-
const docRef = (0,
|
|
16463
|
-
const docSnap = await (0,
|
|
15747
|
+
const docRef = (0, import_firestore49.doc)(this.categoriesRef, id);
|
|
15748
|
+
const docSnap = await (0, import_firestore49.getDoc)(docRef);
|
|
16464
15749
|
if (!docSnap.exists()) return null;
|
|
16465
15750
|
return {
|
|
16466
15751
|
id: docSnap.id,
|
|
@@ -16470,7 +15755,7 @@ var CategoryService = class extends BaseService {
|
|
|
16470
15755
|
};
|
|
16471
15756
|
|
|
16472
15757
|
// src/backoffice/services/subcategory.service.ts
|
|
16473
|
-
var
|
|
15758
|
+
var import_firestore50 = require("firebase/firestore");
|
|
16474
15759
|
|
|
16475
15760
|
// src/backoffice/types/subcategory.types.ts
|
|
16476
15761
|
var SUBCATEGORIES_COLLECTION = "subcategories";
|
|
@@ -16482,7 +15767,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
16482
15767
|
* @param categoryId - ID roditeljske kategorije
|
|
16483
15768
|
*/
|
|
16484
15769
|
getSubcategoriesRef(categoryId) {
|
|
16485
|
-
return (0,
|
|
15770
|
+
return (0, import_firestore50.collection)(
|
|
16486
15771
|
this.db,
|
|
16487
15772
|
CATEGORIES_COLLECTION,
|
|
16488
15773
|
categoryId,
|
|
@@ -16504,7 +15789,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
16504
15789
|
updatedAt: now,
|
|
16505
15790
|
isActive: true
|
|
16506
15791
|
};
|
|
16507
|
-
const docRef = await (0,
|
|
15792
|
+
const docRef = await (0, import_firestore50.addDoc)(
|
|
16508
15793
|
this.getSubcategoriesRef(categoryId),
|
|
16509
15794
|
newSubcategory
|
|
16510
15795
|
);
|
|
@@ -16516,11 +15801,11 @@ var SubcategoryService = class extends BaseService {
|
|
|
16516
15801
|
* @returns Lista aktivnih podkategorija
|
|
16517
15802
|
*/
|
|
16518
15803
|
async getAllByCategoryId(categoryId) {
|
|
16519
|
-
const q = (0,
|
|
15804
|
+
const q = (0, import_firestore50.query)(
|
|
16520
15805
|
this.getSubcategoriesRef(categoryId),
|
|
16521
|
-
(0,
|
|
15806
|
+
(0, import_firestore50.where)("isActive", "==", true)
|
|
16522
15807
|
);
|
|
16523
|
-
const snapshot = await (0,
|
|
15808
|
+
const snapshot = await (0, import_firestore50.getDocs)(q);
|
|
16524
15809
|
return snapshot.docs.map(
|
|
16525
15810
|
(doc37) => ({
|
|
16526
15811
|
id: doc37.id,
|
|
@@ -16540,8 +15825,8 @@ var SubcategoryService = class extends BaseService {
|
|
|
16540
15825
|
...subcategory,
|
|
16541
15826
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16542
15827
|
};
|
|
16543
|
-
const docRef = (0,
|
|
16544
|
-
await (0,
|
|
15828
|
+
const docRef = (0, import_firestore50.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
15829
|
+
await (0, import_firestore50.updateDoc)(docRef, updateData);
|
|
16545
15830
|
return this.getById(categoryId, subcategoryId);
|
|
16546
15831
|
}
|
|
16547
15832
|
/**
|
|
@@ -16559,8 +15844,8 @@ var SubcategoryService = class extends BaseService {
|
|
|
16559
15844
|
* @returns Podkategorija ili null ako ne postoji
|
|
16560
15845
|
*/
|
|
16561
15846
|
async getById(categoryId, subcategoryId) {
|
|
16562
|
-
const docRef = (0,
|
|
16563
|
-
const docSnap = await (0,
|
|
15847
|
+
const docRef = (0, import_firestore50.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
15848
|
+
const docSnap = await (0, import_firestore50.getDoc)(docRef);
|
|
16564
15849
|
if (!docSnap.exists()) return null;
|
|
16565
15850
|
return {
|
|
16566
15851
|
id: docSnap.id,
|
|
@@ -16570,7 +15855,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
16570
15855
|
};
|
|
16571
15856
|
|
|
16572
15857
|
// src/backoffice/services/technology.service.ts
|
|
16573
|
-
var
|
|
15858
|
+
var import_firestore51 = require("firebase/firestore");
|
|
16574
15859
|
var DEFAULT_CERTIFICATION_REQUIREMENT = {
|
|
16575
15860
|
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
16576
15861
|
requiredSpecialties: []
|
|
@@ -16580,7 +15865,7 @@ var TechnologyService = class extends BaseService {
|
|
|
16580
15865
|
* Vraća referencu na Firestore kolekciju tehnologija
|
|
16581
15866
|
*/
|
|
16582
15867
|
getTechnologiesRef() {
|
|
16583
|
-
return (0,
|
|
15868
|
+
return (0, import_firestore51.collection)(this.db, TECHNOLOGIES_COLLECTION);
|
|
16584
15869
|
}
|
|
16585
15870
|
/**
|
|
16586
15871
|
* Kreira novu tehnologiju
|
|
@@ -16603,7 +15888,7 @@ var TechnologyService = class extends BaseService {
|
|
|
16603
15888
|
benefits: technology.benefits || [],
|
|
16604
15889
|
certificationRequirement: technology.certificationRequirement || DEFAULT_CERTIFICATION_REQUIREMENT
|
|
16605
15890
|
};
|
|
16606
|
-
const docRef = await (0,
|
|
15891
|
+
const docRef = await (0, import_firestore51.addDoc)(this.getTechnologiesRef(), newTechnology);
|
|
16607
15892
|
return { id: docRef.id, ...newTechnology };
|
|
16608
15893
|
}
|
|
16609
15894
|
/**
|
|
@@ -16611,8 +15896,8 @@ var TechnologyService = class extends BaseService {
|
|
|
16611
15896
|
* @returns Lista aktivnih tehnologija
|
|
16612
15897
|
*/
|
|
16613
15898
|
async getAll() {
|
|
16614
|
-
const q = (0,
|
|
16615
|
-
const snapshot = await (0,
|
|
15899
|
+
const q = (0, import_firestore51.query)(this.getTechnologiesRef(), (0, import_firestore51.where)("isActive", "==", true));
|
|
15900
|
+
const snapshot = await (0, import_firestore51.getDocs)(q);
|
|
16616
15901
|
return snapshot.docs.map(
|
|
16617
15902
|
(doc37) => ({
|
|
16618
15903
|
id: doc37.id,
|
|
@@ -16626,12 +15911,12 @@ var TechnologyService = class extends BaseService {
|
|
|
16626
15911
|
* @returns Lista aktivnih tehnologija
|
|
16627
15912
|
*/
|
|
16628
15913
|
async getAllByFamily(family) {
|
|
16629
|
-
const q = (0,
|
|
15914
|
+
const q = (0, import_firestore51.query)(
|
|
16630
15915
|
this.getTechnologiesRef(),
|
|
16631
|
-
(0,
|
|
16632
|
-
(0,
|
|
15916
|
+
(0, import_firestore51.where)("isActive", "==", true),
|
|
15917
|
+
(0, import_firestore51.where)("family", "==", family)
|
|
16633
15918
|
);
|
|
16634
|
-
const snapshot = await (0,
|
|
15919
|
+
const snapshot = await (0, import_firestore51.getDocs)(q);
|
|
16635
15920
|
return snapshot.docs.map(
|
|
16636
15921
|
(doc37) => ({
|
|
16637
15922
|
id: doc37.id,
|
|
@@ -16645,12 +15930,12 @@ var TechnologyService = class extends BaseService {
|
|
|
16645
15930
|
* @returns Lista aktivnih tehnologija
|
|
16646
15931
|
*/
|
|
16647
15932
|
async getAllByCategoryId(categoryId) {
|
|
16648
|
-
const q = (0,
|
|
15933
|
+
const q = (0, import_firestore51.query)(
|
|
16649
15934
|
this.getTechnologiesRef(),
|
|
16650
|
-
(0,
|
|
16651
|
-
(0,
|
|
15935
|
+
(0, import_firestore51.where)("isActive", "==", true),
|
|
15936
|
+
(0, import_firestore51.where)("categoryId", "==", categoryId)
|
|
16652
15937
|
);
|
|
16653
|
-
const snapshot = await (0,
|
|
15938
|
+
const snapshot = await (0, import_firestore51.getDocs)(q);
|
|
16654
15939
|
return snapshot.docs.map(
|
|
16655
15940
|
(doc37) => ({
|
|
16656
15941
|
id: doc37.id,
|
|
@@ -16664,12 +15949,12 @@ var TechnologyService = class extends BaseService {
|
|
|
16664
15949
|
* @returns Lista aktivnih tehnologija
|
|
16665
15950
|
*/
|
|
16666
15951
|
async getAllBySubcategoryId(subcategoryId) {
|
|
16667
|
-
const q = (0,
|
|
15952
|
+
const q = (0, import_firestore51.query)(
|
|
16668
15953
|
this.getTechnologiesRef(),
|
|
16669
|
-
(0,
|
|
16670
|
-
(0,
|
|
15954
|
+
(0, import_firestore51.where)("isActive", "==", true),
|
|
15955
|
+
(0, import_firestore51.where)("subcategoryId", "==", subcategoryId)
|
|
16671
15956
|
);
|
|
16672
|
-
const snapshot = await (0,
|
|
15957
|
+
const snapshot = await (0, import_firestore51.getDocs)(q);
|
|
16673
15958
|
return snapshot.docs.map(
|
|
16674
15959
|
(doc37) => ({
|
|
16675
15960
|
id: doc37.id,
|
|
@@ -16688,8 +15973,8 @@ var TechnologyService = class extends BaseService {
|
|
|
16688
15973
|
...technology,
|
|
16689
15974
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16690
15975
|
};
|
|
16691
|
-
const docRef = (0,
|
|
16692
|
-
await (0,
|
|
15976
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
15977
|
+
await (0, import_firestore51.updateDoc)(docRef, updateData);
|
|
16693
15978
|
return this.getById(technologyId);
|
|
16694
15979
|
}
|
|
16695
15980
|
/**
|
|
@@ -16707,8 +15992,8 @@ var TechnologyService = class extends BaseService {
|
|
|
16707
15992
|
* @returns Tehnologija ili null ako ne postoji
|
|
16708
15993
|
*/
|
|
16709
15994
|
async getById(technologyId) {
|
|
16710
|
-
const docRef = (0,
|
|
16711
|
-
const docSnap = await (0,
|
|
15995
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
15996
|
+
const docSnap = await (0, import_firestore51.getDoc)(docRef);
|
|
16712
15997
|
if (!docSnap.exists()) return null;
|
|
16713
15998
|
return {
|
|
16714
15999
|
id: docSnap.id,
|
|
@@ -16722,10 +16007,10 @@ var TechnologyService = class extends BaseService {
|
|
|
16722
16007
|
* @returns Ažurirana tehnologija sa novim zahtevom
|
|
16723
16008
|
*/
|
|
16724
16009
|
async addRequirement(technologyId, requirement) {
|
|
16725
|
-
const docRef = (0,
|
|
16010
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16726
16011
|
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
16727
|
-
await (0,
|
|
16728
|
-
[requirementType]: (0,
|
|
16012
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16013
|
+
[requirementType]: (0, import_firestore51.arrayUnion)(requirement),
|
|
16729
16014
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16730
16015
|
});
|
|
16731
16016
|
return this.getById(technologyId);
|
|
@@ -16737,10 +16022,10 @@ var TechnologyService = class extends BaseService {
|
|
|
16737
16022
|
* @returns Ažurirana tehnologija bez uklonjenog zahteva
|
|
16738
16023
|
*/
|
|
16739
16024
|
async removeRequirement(technologyId, requirement) {
|
|
16740
|
-
const docRef = (0,
|
|
16025
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16741
16026
|
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
16742
|
-
await (0,
|
|
16743
|
-
[requirementType]: (0,
|
|
16027
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16028
|
+
[requirementType]: (0, import_firestore51.arrayRemove)(requirement),
|
|
16744
16029
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16745
16030
|
});
|
|
16746
16031
|
return this.getById(technologyId);
|
|
@@ -16777,9 +16062,9 @@ var TechnologyService = class extends BaseService {
|
|
|
16777
16062
|
* @returns Ažurirana tehnologija
|
|
16778
16063
|
*/
|
|
16779
16064
|
async addBlockingCondition(technologyId, condition) {
|
|
16780
|
-
const docRef = (0,
|
|
16781
|
-
await (0,
|
|
16782
|
-
blockingConditions: (0,
|
|
16065
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16066
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16067
|
+
blockingConditions: (0, import_firestore51.arrayUnion)(condition),
|
|
16783
16068
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16784
16069
|
});
|
|
16785
16070
|
return this.getById(technologyId);
|
|
@@ -16791,9 +16076,9 @@ var TechnologyService = class extends BaseService {
|
|
|
16791
16076
|
* @returns Ažurirana tehnologija
|
|
16792
16077
|
*/
|
|
16793
16078
|
async removeBlockingCondition(technologyId, condition) {
|
|
16794
|
-
const docRef = (0,
|
|
16795
|
-
await (0,
|
|
16796
|
-
blockingConditions: (0,
|
|
16079
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16080
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16081
|
+
blockingConditions: (0, import_firestore51.arrayRemove)(condition),
|
|
16797
16082
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16798
16083
|
});
|
|
16799
16084
|
return this.getById(technologyId);
|
|
@@ -16805,9 +16090,9 @@ var TechnologyService = class extends BaseService {
|
|
|
16805
16090
|
* @returns Ažurirana tehnologija
|
|
16806
16091
|
*/
|
|
16807
16092
|
async addContraindication(technologyId, contraindication) {
|
|
16808
|
-
const docRef = (0,
|
|
16809
|
-
await (0,
|
|
16810
|
-
contraindications: (0,
|
|
16093
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16094
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16095
|
+
contraindications: (0, import_firestore51.arrayUnion)(contraindication),
|
|
16811
16096
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16812
16097
|
});
|
|
16813
16098
|
return this.getById(technologyId);
|
|
@@ -16819,9 +16104,9 @@ var TechnologyService = class extends BaseService {
|
|
|
16819
16104
|
* @returns Ažurirana tehnologija
|
|
16820
16105
|
*/
|
|
16821
16106
|
async removeContraindication(technologyId, contraindication) {
|
|
16822
|
-
const docRef = (0,
|
|
16823
|
-
await (0,
|
|
16824
|
-
contraindications: (0,
|
|
16107
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16108
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16109
|
+
contraindications: (0, import_firestore51.arrayRemove)(contraindication),
|
|
16825
16110
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16826
16111
|
});
|
|
16827
16112
|
return this.getById(technologyId);
|
|
@@ -16833,9 +16118,9 @@ var TechnologyService = class extends BaseService {
|
|
|
16833
16118
|
* @returns Ažurirana tehnologija
|
|
16834
16119
|
*/
|
|
16835
16120
|
async addBenefit(technologyId, benefit) {
|
|
16836
|
-
const docRef = (0,
|
|
16837
|
-
await (0,
|
|
16838
|
-
benefits: (0,
|
|
16121
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16122
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16123
|
+
benefits: (0, import_firestore51.arrayUnion)(benefit),
|
|
16839
16124
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16840
16125
|
});
|
|
16841
16126
|
return this.getById(technologyId);
|
|
@@ -16847,9 +16132,9 @@ var TechnologyService = class extends BaseService {
|
|
|
16847
16132
|
* @returns Ažurirana tehnologija
|
|
16848
16133
|
*/
|
|
16849
16134
|
async removeBenefit(technologyId, benefit) {
|
|
16850
|
-
const docRef = (0,
|
|
16851
|
-
await (0,
|
|
16852
|
-
benefits: (0,
|
|
16135
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16136
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16137
|
+
benefits: (0, import_firestore51.arrayRemove)(benefit),
|
|
16853
16138
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16854
16139
|
});
|
|
16855
16140
|
return this.getById(technologyId);
|
|
@@ -16888,8 +16173,8 @@ var TechnologyService = class extends BaseService {
|
|
|
16888
16173
|
* @returns Ažurirana tehnologija
|
|
16889
16174
|
*/
|
|
16890
16175
|
async updateCertificationRequirement(technologyId, certificationRequirement) {
|
|
16891
|
-
const docRef = (0,
|
|
16892
|
-
await (0,
|
|
16176
|
+
const docRef = (0, import_firestore51.doc)(this.getTechnologiesRef(), technologyId);
|
|
16177
|
+
await (0, import_firestore51.updateDoc)(docRef, {
|
|
16893
16178
|
certificationRequirement,
|
|
16894
16179
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16895
16180
|
});
|
|
@@ -16989,7 +16274,7 @@ var TechnologyService = class extends BaseService {
|
|
|
16989
16274
|
};
|
|
16990
16275
|
|
|
16991
16276
|
// src/backoffice/services/product.service.ts
|
|
16992
|
-
var
|
|
16277
|
+
var import_firestore52 = require("firebase/firestore");
|
|
16993
16278
|
|
|
16994
16279
|
// src/backoffice/types/product.types.ts
|
|
16995
16280
|
var PRODUCTS_COLLECTION = "products";
|
|
@@ -17002,7 +16287,7 @@ var ProductService = class extends BaseService {
|
|
|
17002
16287
|
* @returns Firestore collection reference
|
|
17003
16288
|
*/
|
|
17004
16289
|
getProductsRef(technologyId) {
|
|
17005
|
-
return (0,
|
|
16290
|
+
return (0, import_firestore52.collection)(
|
|
17006
16291
|
this.db,
|
|
17007
16292
|
TECHNOLOGIES_COLLECTION,
|
|
17008
16293
|
technologyId,
|
|
@@ -17022,7 +16307,7 @@ var ProductService = class extends BaseService {
|
|
|
17022
16307
|
updatedAt: now,
|
|
17023
16308
|
isActive: true
|
|
17024
16309
|
};
|
|
17025
|
-
const productRef = await (0,
|
|
16310
|
+
const productRef = await (0, import_firestore52.addDoc)(
|
|
17026
16311
|
this.getProductsRef(technologyId),
|
|
17027
16312
|
newProduct
|
|
17028
16313
|
);
|
|
@@ -17032,11 +16317,11 @@ var ProductService = class extends BaseService {
|
|
|
17032
16317
|
* Gets all products for a technology
|
|
17033
16318
|
*/
|
|
17034
16319
|
async getAllByTechnology(technologyId) {
|
|
17035
|
-
const q = (0,
|
|
16320
|
+
const q = (0, import_firestore52.query)(
|
|
17036
16321
|
this.getProductsRef(technologyId),
|
|
17037
|
-
(0,
|
|
16322
|
+
(0, import_firestore52.where)("isActive", "==", true)
|
|
17038
16323
|
);
|
|
17039
|
-
const snapshot = await (0,
|
|
16324
|
+
const snapshot = await (0, import_firestore52.getDocs)(q);
|
|
17040
16325
|
return snapshot.docs.map(
|
|
17041
16326
|
(doc37) => ({
|
|
17042
16327
|
id: doc37.id,
|
|
@@ -17048,16 +16333,16 @@ var ProductService = class extends BaseService {
|
|
|
17048
16333
|
* Gets all products for a brand by filtering through all technologies
|
|
17049
16334
|
*/
|
|
17050
16335
|
async getAllByBrand(brandId) {
|
|
17051
|
-
const allTechnologiesRef = (0,
|
|
17052
|
-
const technologiesSnapshot = await (0,
|
|
16336
|
+
const allTechnologiesRef = (0, import_firestore52.collection)(this.db, TECHNOLOGIES_COLLECTION);
|
|
16337
|
+
const technologiesSnapshot = await (0, import_firestore52.getDocs)(allTechnologiesRef);
|
|
17053
16338
|
const products = [];
|
|
17054
16339
|
for (const techDoc of technologiesSnapshot.docs) {
|
|
17055
|
-
const q = (0,
|
|
16340
|
+
const q = (0, import_firestore52.query)(
|
|
17056
16341
|
this.getProductsRef(techDoc.id),
|
|
17057
|
-
(0,
|
|
17058
|
-
(0,
|
|
16342
|
+
(0, import_firestore52.where)("brandId", "==", brandId),
|
|
16343
|
+
(0, import_firestore52.where)("isActive", "==", true)
|
|
17059
16344
|
);
|
|
17060
|
-
const snapshot = await (0,
|
|
16345
|
+
const snapshot = await (0, import_firestore52.getDocs)(q);
|
|
17061
16346
|
products.push(
|
|
17062
16347
|
...snapshot.docs.map(
|
|
17063
16348
|
(doc37) => ({
|
|
@@ -17077,8 +16362,8 @@ var ProductService = class extends BaseService {
|
|
|
17077
16362
|
...product,
|
|
17078
16363
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17079
16364
|
};
|
|
17080
|
-
const docRef = (0,
|
|
17081
|
-
await (0,
|
|
16365
|
+
const docRef = (0, import_firestore52.doc)(this.getProductsRef(technologyId), productId);
|
|
16366
|
+
await (0, import_firestore52.updateDoc)(docRef, updateData);
|
|
17082
16367
|
return this.getById(technologyId, productId);
|
|
17083
16368
|
}
|
|
17084
16369
|
/**
|
|
@@ -17093,8 +16378,8 @@ var ProductService = class extends BaseService {
|
|
|
17093
16378
|
* Gets a product by ID
|
|
17094
16379
|
*/
|
|
17095
16380
|
async getById(technologyId, productId) {
|
|
17096
|
-
const docRef = (0,
|
|
17097
|
-
const docSnap = await (0,
|
|
16381
|
+
const docRef = (0, import_firestore52.doc)(this.getProductsRef(technologyId), productId);
|
|
16382
|
+
const docSnap = await (0, import_firestore52.getDoc)(docRef);
|
|
17098
16383
|
if (!docSnap.exists()) return null;
|
|
17099
16384
|
return {
|
|
17100
16385
|
id: docSnap.id,
|
|
@@ -17102,6 +16387,38 @@ var ProductService = class extends BaseService {
|
|
|
17102
16387
|
};
|
|
17103
16388
|
}
|
|
17104
16389
|
};
|
|
16390
|
+
|
|
16391
|
+
// src/backoffice/types/static/treatment-benefit.types.ts
|
|
16392
|
+
var TreatmentBenefit = /* @__PURE__ */ ((TreatmentBenefit2) => {
|
|
16393
|
+
TreatmentBenefit2["WRINKLE_REDUCTION"] = "wrinkle_reduction";
|
|
16394
|
+
TreatmentBenefit2["SKIN_TIGHTENING"] = "skin_tightening";
|
|
16395
|
+
TreatmentBenefit2["COLLAGEN_PRODUCTION"] = "collagen_production";
|
|
16396
|
+
TreatmentBenefit2["ACNE_REDUCTION"] = "acne_reduction";
|
|
16397
|
+
TreatmentBenefit2["SCAR_REDUCTION"] = "scar_reduction";
|
|
16398
|
+
TreatmentBenefit2["PIGMENTATION_IMPROVEMENT"] = "pigmentation_improvement";
|
|
16399
|
+
TreatmentBenefit2["HAIR_REMOVAL"] = "hair_removal";
|
|
16400
|
+
TreatmentBenefit2["MUSCLE_TONING"] = "muscle_toning";
|
|
16401
|
+
TreatmentBenefit2["FAT_REDUCTION"] = "fat_reduction";
|
|
16402
|
+
TreatmentBenefit2["CELLULITE_REDUCTION"] = "cellulite_reduction";
|
|
16403
|
+
TreatmentBenefit2["SKIN_REJUVENATION"] = "skin_rejuvenation";
|
|
16404
|
+
TreatmentBenefit2["PORE_REDUCTION"] = "pore_reduction";
|
|
16405
|
+
TreatmentBenefit2["TEXTURE_IMPROVEMENT"] = "texture_improvement";
|
|
16406
|
+
TreatmentBenefit2["HYDRATION_BOOST"] = "hydration_boost";
|
|
16407
|
+
TreatmentBenefit2["CIRCULATION_IMPROVEMENT"] = "circulation_improvement";
|
|
16408
|
+
return TreatmentBenefit2;
|
|
16409
|
+
})(TreatmentBenefit || {});
|
|
16410
|
+
|
|
16411
|
+
// src/backoffice/types/requirement.types.ts
|
|
16412
|
+
var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
|
|
16413
|
+
TimeUnit2["HOURS"] = "hours";
|
|
16414
|
+
TimeUnit2["DAYS"] = "days";
|
|
16415
|
+
return TimeUnit2;
|
|
16416
|
+
})(TimeUnit || {});
|
|
16417
|
+
var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
|
|
16418
|
+
RequirementType2["PRE"] = "pre";
|
|
16419
|
+
RequirementType2["POST"] = "post";
|
|
16420
|
+
return RequirementType2;
|
|
16421
|
+
})(RequirementType || {});
|
|
17105
16422
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17106
16423
|
0 && (module.exports = {
|
|
17107
16424
|
APPOINTMENTS_COLLECTION,
|
|
@@ -17194,164 +16511,19 @@ var ProductService = class extends BaseService {
|
|
|
17194
16511
|
SubcategoryService,
|
|
17195
16512
|
SubscriptionModel,
|
|
17196
16513
|
SyncedCalendarProvider,
|
|
16514
|
+
SyncedCalendarsService,
|
|
17197
16515
|
TechnologyService,
|
|
17198
16516
|
TimeUnit,
|
|
17199
|
-
TimestampUtils,
|
|
17200
16517
|
TreatmentBenefit,
|
|
17201
16518
|
USERS_COLLECTION,
|
|
17202
16519
|
USER_FORMS_SUBCOLLECTION,
|
|
17203
16520
|
UserRole,
|
|
17204
16521
|
UserService,
|
|
17205
|
-
addAllergySchema,
|
|
17206
|
-
addBlockingConditionSchema,
|
|
17207
|
-
addContraindicationSchema,
|
|
17208
|
-
addMedicationSchema,
|
|
17209
|
-
addressDataSchema,
|
|
17210
|
-
adminInfoSchema,
|
|
17211
|
-
adminTokenSchema,
|
|
17212
|
-
allergySchema,
|
|
17213
|
-
allergySubtypeSchema,
|
|
17214
|
-
appointmentMediaItemSchema,
|
|
17215
|
-
appointmentMetadataSchema,
|
|
17216
|
-
appointmentNotificationSchema,
|
|
17217
|
-
appointmentReminderNotificationSchema,
|
|
17218
|
-
appointmentStatusSchema,
|
|
17219
|
-
baseNotificationSchema,
|
|
17220
|
-
beforeAfterPerZoneSchema,
|
|
17221
|
-
billingPerZoneSchema,
|
|
17222
|
-
blockingConditionSchema,
|
|
17223
|
-
calendarEventSchema,
|
|
17224
|
-
calendarEventTimeSchema,
|
|
17225
|
-
clinicAdminOptionsSchema,
|
|
17226
|
-
clinicAdminSchema,
|
|
17227
|
-
clinicAdminSignupSchema,
|
|
17228
|
-
clinicBranchInfoSchema,
|
|
17229
|
-
clinicBranchSetupSchema,
|
|
17230
|
-
clinicContactInfoSchema,
|
|
17231
|
-
clinicGroupSchema,
|
|
17232
|
-
clinicGroupSetupSchema,
|
|
17233
|
-
clinicInfoSchema,
|
|
17234
|
-
clinicLocationSchema,
|
|
17235
|
-
clinicReviewInfoSchema,
|
|
17236
|
-
clinicReviewSchema,
|
|
17237
|
-
clinicSchema,
|
|
17238
|
-
clinicTagsSchema,
|
|
17239
|
-
contactPersonSchema,
|
|
17240
|
-
contraindicationSchema,
|
|
17241
|
-
createAdminTokenSchema,
|
|
17242
|
-
createAppointmentSchema,
|
|
17243
|
-
createBlockingEventSchema,
|
|
17244
|
-
createCalendarEventSchema,
|
|
17245
|
-
createClinicAdminSchema,
|
|
17246
|
-
createClinicGroupSchema,
|
|
17247
|
-
createClinicReviewSchema,
|
|
17248
|
-
createClinicSchema,
|
|
17249
|
-
createDefaultClinicGroupSchema,
|
|
17250
|
-
createDocumentTemplateSchema,
|
|
17251
|
-
createDraftPractitionerSchema,
|
|
17252
|
-
createFilledDocumentDataSchema,
|
|
17253
|
-
createManualPatientSchema,
|
|
17254
|
-
createPatientLocationInfoSchema,
|
|
17255
|
-
createPatientMedicalInfoSchema,
|
|
17256
|
-
createPatientProfileSchema,
|
|
17257
|
-
createPatientSensitiveInfoSchema,
|
|
17258
|
-
createPatientTokenSchema,
|
|
17259
|
-
createPractitionerReviewSchema,
|
|
17260
|
-
createPractitionerSchema,
|
|
17261
|
-
createPractitionerTokenSchema,
|
|
17262
|
-
createProcedureReviewSchema,
|
|
17263
|
-
createProcedureSchema,
|
|
17264
|
-
createReviewSchema,
|
|
17265
|
-
createUserOptionsSchema,
|
|
17266
|
-
doctorInfoSchema,
|
|
17267
|
-
documentElementSchema,
|
|
17268
|
-
documentElementWithoutIdSchema,
|
|
17269
|
-
documentTemplateSchema,
|
|
17270
|
-
emailSchema,
|
|
17271
|
-
emergencyContactSchema,
|
|
17272
|
-
filledDocumentSchema,
|
|
17273
|
-
filledDocumentStatusSchema,
|
|
17274
|
-
finalBillingSchema,
|
|
17275
|
-
finalizedDetailsSchema,
|
|
17276
|
-
gamificationSchema,
|
|
17277
16522
|
getFirebaseApp,
|
|
17278
16523
|
getFirebaseAuth,
|
|
17279
16524
|
getFirebaseDB,
|
|
17280
16525
|
getFirebaseFunctions,
|
|
17281
16526
|
getFirebaseInstance,
|
|
17282
16527
|
getFirebaseStorage,
|
|
17283
|
-
initializeFirebase
|
|
17284
|
-
linkedFormInfoSchema,
|
|
17285
|
-
locationDataSchema,
|
|
17286
|
-
mediaResourceSchema,
|
|
17287
|
-
mediaTypeSchema,
|
|
17288
|
-
medicationSchema,
|
|
17289
|
-
notificationSchema,
|
|
17290
|
-
passwordSchema,
|
|
17291
|
-
patientClinicSchema,
|
|
17292
|
-
patientDoctorSchema,
|
|
17293
|
-
patientInstructionStatusSchema,
|
|
17294
|
-
patientLocationInfoSchema,
|
|
17295
|
-
patientMedicalInfoSchema,
|
|
17296
|
-
patientProfileInfoSchema,
|
|
17297
|
-
patientProfileSchema,
|
|
17298
|
-
patientRequirementInstanceSchema,
|
|
17299
|
-
patientRequirementInstructionSchema,
|
|
17300
|
-
patientRequirementOverallStatusSchema,
|
|
17301
|
-
patientReviewInfoSchema,
|
|
17302
|
-
patientSensitiveInfoSchema,
|
|
17303
|
-
patientTokenSchema,
|
|
17304
|
-
paymentStatusSchema,
|
|
17305
|
-
postRequirementNotificationSchema,
|
|
17306
|
-
practitionerBasicInfoSchema,
|
|
17307
|
-
practitionerCertificationSchema,
|
|
17308
|
-
practitionerClinicWorkingHoursSchema,
|
|
17309
|
-
practitionerProfileInfoSchema,
|
|
17310
|
-
practitionerReviewInfoSchema,
|
|
17311
|
-
practitionerReviewSchema,
|
|
17312
|
-
practitionerSchema,
|
|
17313
|
-
practitionerSignupSchema,
|
|
17314
|
-
practitionerTokenSchema,
|
|
17315
|
-
practitionerWorkingHoursSchema,
|
|
17316
|
-
preRequirementNotificationSchema,
|
|
17317
|
-
procedureCategorizationSchema,
|
|
17318
|
-
procedureExtendedInfoSchema,
|
|
17319
|
-
procedureInfoSchema,
|
|
17320
|
-
procedureReviewInfoSchema,
|
|
17321
|
-
procedureReviewSchema,
|
|
17322
|
-
procedureSchema,
|
|
17323
|
-
procedureSummaryInfoSchema,
|
|
17324
|
-
requesterInfoSchema,
|
|
17325
|
-
requirementImportanceSchema,
|
|
17326
|
-
requirementInstructionDueNotificationSchema,
|
|
17327
|
-
rescheduleAppointmentSchema,
|
|
17328
|
-
reviewSchema,
|
|
17329
|
-
searchAppointmentsSchema,
|
|
17330
|
-
searchPatientsSchema,
|
|
17331
|
-
sharedClinicContactInfoSchema,
|
|
17332
|
-
sharedClinicLocationSchema,
|
|
17333
|
-
syncedCalendarEventSchema,
|
|
17334
|
-
timeSlotSchema,
|
|
17335
|
-
timestampSchema,
|
|
17336
|
-
updateAllergySchema,
|
|
17337
|
-
updateAppointmentSchema,
|
|
17338
|
-
updateBlockingConditionSchema,
|
|
17339
|
-
updateBlockingEventSchema,
|
|
17340
|
-
updateCalendarEventSchema,
|
|
17341
|
-
updateClinicAdminSchema,
|
|
17342
|
-
updateClinicGroupSchema,
|
|
17343
|
-
updateClinicSchema,
|
|
17344
|
-
updateContraindicationSchema,
|
|
17345
|
-
updateDocumentTemplateSchema,
|
|
17346
|
-
updateFilledDocumentDataSchema,
|
|
17347
|
-
updateMedicationSchema,
|
|
17348
|
-
updatePatientInstructionStatusSchema,
|
|
17349
|
-
updatePatientMedicalInfoSchema,
|
|
17350
|
-
updateProcedureSchema,
|
|
17351
|
-
updateVitalStatsSchema,
|
|
17352
|
-
userRoleSchema,
|
|
17353
|
-
userRolesSchema,
|
|
17354
|
-
userSchema,
|
|
17355
|
-
vitalStatsSchema,
|
|
17356
|
-
workingHoursSchema
|
|
16528
|
+
initializeFirebase
|
|
17357
16529
|
});
|