@blackcode_sa/metaestetics-api 1.8.5 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -2455
- package/dist/index.d.ts +1 -2455
- package/dist/index.js +304 -742
- package/dist/index.mjs +312 -708
- package/package.json +1 -1
- package/src/backoffice/expo-safe/README.md +26 -0
- package/src/backoffice/expo-safe/index.ts +37 -0
- package/src/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -36,14 +36,10 @@ __export(index_exports, {
|
|
|
36
36
|
AppointmentService: () => AppointmentService,
|
|
37
37
|
AppointmentStatus: () => AppointmentStatus,
|
|
38
38
|
AuthService: () => AuthService,
|
|
39
|
-
BRANDS_COLLECTION: () => BRANDS_COLLECTION,
|
|
40
|
-
BackofficeError: () => BackofficeError,
|
|
41
39
|
BaseService: () => BaseService,
|
|
42
40
|
BlockingCondition: () => BlockingCondition,
|
|
43
|
-
BlockingConditionError: () => BlockingConditionError,
|
|
44
41
|
BrandService: () => BrandService,
|
|
45
42
|
CALENDAR_COLLECTION: () => CALENDAR_COLLECTION,
|
|
46
|
-
CATEGORIES_COLLECTION: () => CATEGORIES_COLLECTION,
|
|
47
43
|
CLINICS_COLLECTION: () => CLINICS_COLLECTION,
|
|
48
44
|
CLINIC_ADMINS_COLLECTION: () => CLINIC_ADMINS_COLLECTION,
|
|
49
45
|
CLINIC_GROUPS_COLLECTION: () => CLINIC_GROUPS_COLLECTION,
|
|
@@ -52,28 +48,22 @@ __export(index_exports, {
|
|
|
52
48
|
CalendarServiceV2: () => CalendarServiceV2,
|
|
53
49
|
CalendarServiceV3: () => CalendarServiceV3,
|
|
54
50
|
CalendarSyncStatus: () => CalendarSyncStatus,
|
|
55
|
-
CategoryError: () => CategoryError,
|
|
56
|
-
CategoryNotFoundError: () => CategoryNotFoundError,
|
|
57
51
|
CategoryService: () => CategoryService,
|
|
58
52
|
CertificationLevel: () => CertificationLevel,
|
|
59
53
|
CertificationSpecialty: () => CertificationSpecialty,
|
|
60
|
-
CircularReferenceError: () => CircularReferenceError,
|
|
61
54
|
ClinicAdminService: () => ClinicAdminService,
|
|
62
55
|
ClinicGroupService: () => ClinicGroupService,
|
|
63
56
|
ClinicPhotoTag: () => ClinicPhotoTag,
|
|
64
57
|
ClinicService: () => ClinicService,
|
|
65
58
|
ClinicTag: () => ClinicTag,
|
|
66
59
|
Contraindication: () => Contraindication,
|
|
67
|
-
ContraindicationError: () => ContraindicationError,
|
|
68
60
|
CosmeticAllergySubtype: () => CosmeticAllergySubtype,
|
|
69
61
|
Currency: () => Currency,
|
|
70
|
-
DEFAULT_CERTIFICATION_REQUIREMENT: () => DEFAULT_CERTIFICATION_REQUIREMENT2,
|
|
71
62
|
DEFAULT_MEDICAL_INFO: () => DEFAULT_MEDICAL_INFO,
|
|
72
63
|
DOCTOR_FORMS_SUBCOLLECTION: () => DOCTOR_FORMS_SUBCOLLECTION,
|
|
73
64
|
DOCUMENTATION_TEMPLATES_COLLECTION: () => DOCUMENTATION_TEMPLATES_COLLECTION,
|
|
74
65
|
DocumentElementType: () => DocumentElementType,
|
|
75
66
|
DocumentationTemplateService: () => DocumentationTemplateService,
|
|
76
|
-
DocumentationTemplateServiceBackoffice: () => DocumentationTemplateServiceBackoffice,
|
|
77
67
|
DynamicVariable: () => DynamicVariable,
|
|
78
68
|
EnvironmentalAllergySubtype: () => EnvironmentalAllergySubtype,
|
|
79
69
|
ExternalCalendarService: () => ExternalCalendarService,
|
|
@@ -84,15 +74,6 @@ __export(index_exports, {
|
|
|
84
74
|
Gender: () => Gender,
|
|
85
75
|
HeadingLevel: () => HeadingLevel,
|
|
86
76
|
INVITE_TOKENS_COLLECTION: () => INVITE_TOKENS_COLLECTION,
|
|
87
|
-
InvalidBlockingConditionError: () => InvalidBlockingConditionError,
|
|
88
|
-
InvalidCategoryDataError: () => InvalidCategoryDataError,
|
|
89
|
-
InvalidContraindicationError: () => InvalidContraindicationError,
|
|
90
|
-
InvalidHierarchyError: () => InvalidHierarchyError,
|
|
91
|
-
InvalidRequirementDataError: () => InvalidRequirementDataError,
|
|
92
|
-
InvalidSubcategoryDataError: () => InvalidSubcategoryDataError,
|
|
93
|
-
InvalidTechnologyDataError: () => InvalidTechnologyDataError,
|
|
94
|
-
InvalidTimeframeError: () => InvalidTimeframeError,
|
|
95
|
-
InvalidTreatmentBenefitError: () => InvalidTreatmentBenefitError,
|
|
96
77
|
Language: () => Language,
|
|
97
78
|
ListType: () => ListType,
|
|
98
79
|
MEDIA_METADATA_COLLECTION: () => MEDIA_METADATA_COLLECTION,
|
|
@@ -114,7 +95,6 @@ __export(index_exports, {
|
|
|
114
95
|
PRACTITIONERS_COLLECTION: () => PRACTITIONERS_COLLECTION,
|
|
115
96
|
PRACTITIONER_INVITES_COLLECTION: () => PRACTITIONER_INVITES_COLLECTION,
|
|
116
97
|
PROCEDURES_COLLECTION: () => PROCEDURES_COLLECTION,
|
|
117
|
-
PRODUCTS_COLLECTION: () => PRODUCTS_COLLECTION,
|
|
118
98
|
PatientInstructionStatus: () => PatientInstructionStatus,
|
|
119
99
|
PatientRequirementOverallStatus: () => PatientRequirementOverallStatus,
|
|
120
100
|
PatientRequirementsService: () => PatientRequirementsService,
|
|
@@ -132,30 +112,18 @@ __export(index_exports, {
|
|
|
132
112
|
ProcedureService: () => ProcedureService,
|
|
133
113
|
ProductService: () => ProductService,
|
|
134
114
|
REGISTER_TOKENS_COLLECTION: () => REGISTER_TOKENS_COLLECTION,
|
|
135
|
-
REQUIREMENTS_COLLECTION: () => REQUIREMENTS_COLLECTION,
|
|
136
115
|
REVIEWS_COLLECTION: () => REVIEWS_COLLECTION,
|
|
137
|
-
RelationshipError: () => RelationshipError,
|
|
138
|
-
RequirementError: () => RequirementError,
|
|
139
|
-
RequirementNotFoundError: () => RequirementNotFoundError,
|
|
140
|
-
RequirementService: () => RequirementService,
|
|
141
116
|
RequirementType: () => RequirementType,
|
|
142
117
|
ReviewService: () => ReviewService,
|
|
143
|
-
SUBCATEGORIES_COLLECTION: () => SUBCATEGORIES_COLLECTION,
|
|
144
118
|
SYNCED_CALENDARS_COLLECTION: () => SYNCED_CALENDARS_COLLECTION,
|
|
145
119
|
SearchLocationEnum: () => SearchLocationEnum,
|
|
146
|
-
SubcategoryError: () => SubcategoryError,
|
|
147
|
-
SubcategoryNotFoundError: () => SubcategoryNotFoundError,
|
|
148
120
|
SubcategoryService: () => SubcategoryService,
|
|
149
121
|
SubscriptionModel: () => SubscriptionModel,
|
|
150
122
|
SyncedCalendarProvider: () => SyncedCalendarProvider,
|
|
151
|
-
TECHNOLOGIES_COLLECTION: () => TECHNOLOGIES_COLLECTION,
|
|
152
|
-
TechnologyError: () => TechnologyError,
|
|
153
|
-
TechnologyNotFoundError: () => TechnologyNotFoundError,
|
|
154
123
|
TechnologyService: () => TechnologyService,
|
|
155
124
|
TimeUnit: () => TimeUnit,
|
|
156
125
|
TimestampUtils: () => TimestampUtils,
|
|
157
126
|
TreatmentBenefit: () => TreatmentBenefit,
|
|
158
|
-
TreatmentBenefitError: () => TreatmentBenefitError,
|
|
159
127
|
USERS_COLLECTION: () => USERS_COLLECTION,
|
|
160
128
|
USER_FORMS_SUBCOLLECTION: () => USER_FORMS_SUBCOLLECTION,
|
|
161
129
|
UserRole: () => UserRole,
|
|
@@ -178,15 +146,9 @@ __export(index_exports, {
|
|
|
178
146
|
beforeAfterPerZoneSchema: () => beforeAfterPerZoneSchema,
|
|
179
147
|
billingPerZoneSchema: () => billingPerZoneSchema,
|
|
180
148
|
blockingConditionSchema: () => blockingConditionSchema,
|
|
181
|
-
blockingConditionSchemaBackoffice: () => blockingConditionSchemaBackoffice,
|
|
182
149
|
buildPractitionerData: () => buildPractitionerData,
|
|
183
150
|
calendarEventSchema: () => calendarEventSchema,
|
|
184
151
|
calendarEventTimeSchema: () => calendarEventTimeSchema,
|
|
185
|
-
categorySchema: () => categorySchema,
|
|
186
|
-
categoryUpdateSchema: () => categoryUpdateSchema,
|
|
187
|
-
certificationLevelSchema: () => certificationLevelSchema,
|
|
188
|
-
certificationRequirementSchema: () => certificationRequirementSchema,
|
|
189
|
-
certificationSpecialtySchema: () => certificationSpecialtySchema,
|
|
190
152
|
checkEmailExists: () => checkEmailExists,
|
|
191
153
|
cleanupFirebaseUser: () => cleanupFirebaseUser,
|
|
192
154
|
clinicAdminOptionsSchema: () => clinicAdminOptionsSchema,
|
|
@@ -205,7 +167,6 @@ __export(index_exports, {
|
|
|
205
167
|
clinicTagsSchema: () => clinicTagsSchema,
|
|
206
168
|
contactPersonSchema: () => contactPersonSchema,
|
|
207
169
|
contraindicationSchema: () => contraindicationSchema,
|
|
208
|
-
contraindicationSchemaBackoffice: () => contraindicationSchemaBackoffice,
|
|
209
170
|
createAdminTokenSchema: () => createAdminTokenSchema,
|
|
210
171
|
createAppointmentSchema: () => createAppointmentSchema,
|
|
211
172
|
createBlockingEventSchema: () => createBlockingEventSchema,
|
|
@@ -288,7 +249,6 @@ __export(index_exports, {
|
|
|
288
249
|
preRequirementNotificationSchema: () => preRequirementNotificationSchema,
|
|
289
250
|
procedureCategorizationSchema: () => procedureCategorizationSchema,
|
|
290
251
|
procedureExtendedInfoSchema: () => procedureExtendedInfoSchema,
|
|
291
|
-
procedureFamilySchemaBackoffice: () => procedureFamilySchemaBackoffice,
|
|
292
252
|
procedureInfoSchema: () => procedureInfoSchema,
|
|
293
253
|
procedureReviewInfoSchema: () => procedureReviewInfoSchema,
|
|
294
254
|
procedureReviewSchema: () => procedureReviewSchema,
|
|
@@ -297,26 +257,15 @@ __export(index_exports, {
|
|
|
297
257
|
requesterInfoSchema: () => requesterInfoSchema,
|
|
298
258
|
requirementImportanceSchema: () => requirementImportanceSchema,
|
|
299
259
|
requirementInstructionDueNotificationSchema: () => requirementInstructionDueNotificationSchema,
|
|
300
|
-
requirementSchema: () => requirementSchema,
|
|
301
|
-
requirementTypeSchema: () => requirementTypeSchema,
|
|
302
|
-
requirementUpdateSchema: () => requirementUpdateSchema,
|
|
303
260
|
rescheduleAppointmentSchema: () => rescheduleAppointmentSchema,
|
|
304
261
|
reviewSchema: () => reviewSchema,
|
|
305
262
|
searchAppointmentsSchema: () => searchAppointmentsSchema,
|
|
306
263
|
searchPatientsSchema: () => searchPatientsSchema,
|
|
307
264
|
sharedClinicContactInfoSchema: () => sharedClinicContactInfoSchema,
|
|
308
265
|
sharedClinicLocationSchema: () => sharedClinicLocationSchema,
|
|
309
|
-
subcategorySchema: () => subcategorySchema,
|
|
310
|
-
subcategoryUpdateSchema: () => subcategoryUpdateSchema,
|
|
311
266
|
syncedCalendarEventSchema: () => syncedCalendarEventSchema,
|
|
312
|
-
technologyRequirementsSchema: () => technologyRequirementsSchema,
|
|
313
|
-
technologySchema: () => technologySchema,
|
|
314
|
-
technologyUpdateSchema: () => technologyUpdateSchema,
|
|
315
267
|
timeSlotSchema: () => timeSlotSchema2,
|
|
316
|
-
timeUnitSchemaBackoffice: () => timeUnitSchemaBackoffice,
|
|
317
|
-
timeframeSchema: () => timeframeSchema,
|
|
318
268
|
timestampSchema: () => timestampSchema,
|
|
319
|
-
treatmentBenefitSchemaBackoffice: () => treatmentBenefitSchemaBackoffice,
|
|
320
269
|
updateAllergySchema: () => updateAllergySchema,
|
|
321
270
|
updateAppointmentSchema: () => updateAppointmentSchema,
|
|
322
271
|
updateBlockingConditionSchema: () => updateBlockingConditionSchema,
|
|
@@ -1299,7 +1248,7 @@ async function searchAppointmentsUtil(db, params) {
|
|
|
1299
1248
|
const q = (0, import_firestore.query)((0, import_firestore.collection)(db, APPOINTMENTS_COLLECTION), ...constraints);
|
|
1300
1249
|
const querySnapshot = await (0, import_firestore.getDocs)(q);
|
|
1301
1250
|
const appointments = querySnapshot.docs.map(
|
|
1302
|
-
(
|
|
1251
|
+
(doc37) => doc37.data()
|
|
1303
1252
|
);
|
|
1304
1253
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
1305
1254
|
return { appointments, lastDoc };
|
|
@@ -2106,7 +2055,7 @@ var AppointmentService = class extends BaseService {
|
|
|
2106
2055
|
);
|
|
2107
2056
|
const querySnapshot = await (0, import_firestore2.getDocs)(q);
|
|
2108
2057
|
const appointments = querySnapshot.docs.map(
|
|
2109
|
-
(
|
|
2058
|
+
(doc37) => doc37.data()
|
|
2110
2059
|
);
|
|
2111
2060
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
2112
2061
|
console.log(
|
|
@@ -2179,7 +2128,7 @@ var AppointmentService = class extends BaseService {
|
|
|
2179
2128
|
);
|
|
2180
2129
|
const querySnapshot = await (0, import_firestore2.getDocs)(q);
|
|
2181
2130
|
const appointments = querySnapshot.docs.map(
|
|
2182
|
-
(
|
|
2131
|
+
(doc37) => doc37.data()
|
|
2183
2132
|
);
|
|
2184
2133
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
2185
2134
|
console.log(
|
|
@@ -3432,7 +3381,7 @@ var MediaService = class extends BaseService {
|
|
|
3432
3381
|
try {
|
|
3433
3382
|
const querySnapshot = await (0, import_firestore5.getDocs)(finalQuery);
|
|
3434
3383
|
const mediaList = querySnapshot.docs.map(
|
|
3435
|
-
(
|
|
3384
|
+
(doc37) => doc37.data()
|
|
3436
3385
|
);
|
|
3437
3386
|
console.log(`[MediaService] Found ${mediaList.length} media items.`);
|
|
3438
3387
|
return mediaList;
|
|
@@ -3486,8 +3435,8 @@ var getPatientsByClinicUtil = async (db, clinicId, options) => {
|
|
|
3486
3435
|
}
|
|
3487
3436
|
const patientsSnapshot = await (0, import_firestore6.getDocs)(q);
|
|
3488
3437
|
const patients = [];
|
|
3489
|
-
patientsSnapshot.forEach((
|
|
3490
|
-
patients.push(
|
|
3438
|
+
patientsSnapshot.forEach((doc37) => {
|
|
3439
|
+
patients.push(doc37.data());
|
|
3491
3440
|
});
|
|
3492
3441
|
console.log(
|
|
3493
3442
|
`[getPatientsByClinicUtil] Found ${patients.length} patients for clinic ID: ${clinicId}`
|
|
@@ -3840,8 +3789,8 @@ var getPatientsByPractitionerUtil = async (db, practitionerId, options) => {
|
|
|
3840
3789
|
}
|
|
3841
3790
|
const patientsSnapshot = await (0, import_firestore9.getDocs)(q);
|
|
3842
3791
|
const patients = [];
|
|
3843
|
-
patientsSnapshot.forEach((
|
|
3844
|
-
patients.push(
|
|
3792
|
+
patientsSnapshot.forEach((doc37) => {
|
|
3793
|
+
patients.push(doc37.data());
|
|
3845
3794
|
});
|
|
3846
3795
|
console.log(
|
|
3847
3796
|
`[getPatientsByPractitionerUtil] Found ${patients.length} patients for practitioner ID: ${practitionerId}`
|
|
@@ -4409,7 +4358,7 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
|
|
|
4409
4358
|
(0, import_firestore11.where)("clinicGroupId", "==", clinicGroupId)
|
|
4410
4359
|
);
|
|
4411
4360
|
const querySnapshot = await (0, import_firestore11.getDocs)(q);
|
|
4412
|
-
return querySnapshot.docs.map((
|
|
4361
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
4413
4362
|
}
|
|
4414
4363
|
async function updateClinicAdmin(db, adminId, data) {
|
|
4415
4364
|
const admin2 = await getClinicAdmin(db, adminId);
|
|
@@ -5072,9 +5021,9 @@ var updateAllergyUtil = async (db, patientId, data, requesterId, requesterRoles)
|
|
|
5072
5021
|
};
|
|
5073
5022
|
var removeAllergyUtil = async (db, patientId, allergyIndex, requesterId, requesterRoles) => {
|
|
5074
5023
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5075
|
-
const
|
|
5076
|
-
if (!
|
|
5077
|
-
const medicalInfo =
|
|
5024
|
+
const doc37 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5025
|
+
if (!doc37.exists()) throw new Error("Medical info not found");
|
|
5026
|
+
const medicalInfo = doc37.data();
|
|
5078
5027
|
if (allergyIndex >= medicalInfo.allergies.length) {
|
|
5079
5028
|
throw new Error("Invalid allergy index");
|
|
5080
5029
|
}
|
|
@@ -5101,9 +5050,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, requesterId, reque
|
|
|
5101
5050
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5102
5051
|
const validatedData = updateBlockingConditionSchema.parse(data);
|
|
5103
5052
|
const { conditionIndex, ...updateData } = validatedData;
|
|
5104
|
-
const
|
|
5105
|
-
if (!
|
|
5106
|
-
const medicalInfo =
|
|
5053
|
+
const doc37 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5054
|
+
if (!doc37.exists()) throw new Error("Medical info not found");
|
|
5055
|
+
const medicalInfo = doc37.data();
|
|
5107
5056
|
if (conditionIndex >= medicalInfo.blockingConditions.length) {
|
|
5108
5057
|
throw new Error("Invalid blocking condition index");
|
|
5109
5058
|
}
|
|
@@ -5120,9 +5069,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, requesterId, reque
|
|
|
5120
5069
|
};
|
|
5121
5070
|
var removeBlockingConditionUtil = async (db, patientId, conditionIndex, requesterId, requesterRoles) => {
|
|
5122
5071
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5123
|
-
const
|
|
5124
|
-
if (!
|
|
5125
|
-
const medicalInfo =
|
|
5072
|
+
const doc37 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5073
|
+
if (!doc37.exists()) throw new Error("Medical info not found");
|
|
5074
|
+
const medicalInfo = doc37.data();
|
|
5126
5075
|
if (conditionIndex >= medicalInfo.blockingConditions.length) {
|
|
5127
5076
|
throw new Error("Invalid blocking condition index");
|
|
5128
5077
|
}
|
|
@@ -5149,9 +5098,9 @@ var updateContraindicationUtil = async (db, patientId, data, requesterId, reques
|
|
|
5149
5098
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5150
5099
|
const validatedData = updateContraindicationSchema.parse(data);
|
|
5151
5100
|
const { contraindicationIndex, ...updateData } = validatedData;
|
|
5152
|
-
const
|
|
5153
|
-
if (!
|
|
5154
|
-
const medicalInfo =
|
|
5101
|
+
const doc37 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5102
|
+
if (!doc37.exists()) throw new Error("Medical info not found");
|
|
5103
|
+
const medicalInfo = doc37.data();
|
|
5155
5104
|
if (contraindicationIndex >= medicalInfo.contraindications.length) {
|
|
5156
5105
|
throw new Error("Invalid contraindication index");
|
|
5157
5106
|
}
|
|
@@ -5168,9 +5117,9 @@ var updateContraindicationUtil = async (db, patientId, data, requesterId, reques
|
|
|
5168
5117
|
};
|
|
5169
5118
|
var removeContraindicationUtil = async (db, patientId, contraindicationIndex, requesterId, requesterRoles) => {
|
|
5170
5119
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5171
|
-
const
|
|
5172
|
-
if (!
|
|
5173
|
-
const medicalInfo =
|
|
5120
|
+
const doc37 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5121
|
+
if (!doc37.exists()) throw new Error("Medical info not found");
|
|
5122
|
+
const medicalInfo = doc37.data();
|
|
5174
5123
|
if (contraindicationIndex >= medicalInfo.contraindications.length) {
|
|
5175
5124
|
throw new Error("Invalid contraindication index");
|
|
5176
5125
|
}
|
|
@@ -5197,9 +5146,9 @@ var updateMedicationUtil = async (db, patientId, data, requesterId, requesterRol
|
|
|
5197
5146
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5198
5147
|
const validatedData = updateMedicationSchema.parse(data);
|
|
5199
5148
|
const { medicationIndex, ...updateData } = validatedData;
|
|
5200
|
-
const
|
|
5201
|
-
if (!
|
|
5202
|
-
const medicalInfo =
|
|
5149
|
+
const doc37 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5150
|
+
if (!doc37.exists()) throw new Error("Medical info not found");
|
|
5151
|
+
const medicalInfo = doc37.data();
|
|
5203
5152
|
if (medicationIndex >= medicalInfo.currentMedications.length) {
|
|
5204
5153
|
throw new Error("Invalid medication index");
|
|
5205
5154
|
}
|
|
@@ -5216,9 +5165,9 @@ var updateMedicationUtil = async (db, patientId, data, requesterId, requesterRol
|
|
|
5216
5165
|
};
|
|
5217
5166
|
var removeMedicationUtil = async (db, patientId, medicationIndex, requesterId, requesterRoles) => {
|
|
5218
5167
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5219
|
-
const
|
|
5220
|
-
if (!
|
|
5221
|
-
const medicalInfo =
|
|
5168
|
+
const doc37 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5169
|
+
if (!doc37.exists()) throw new Error("Medical info not found");
|
|
5170
|
+
const medicalInfo = doc37.data();
|
|
5222
5171
|
if (medicationIndex >= medicalInfo.currentMedications.length) {
|
|
5223
5172
|
throw new Error("Invalid medication index");
|
|
5224
5173
|
}
|
|
@@ -5505,7 +5454,7 @@ var searchPatientsUtil = async (db, params, requester) => {
|
|
|
5505
5454
|
const finalQuery = (0, import_firestore17.query)(patientsCollectionRef, ...constraints);
|
|
5506
5455
|
const querySnapshot = await (0, import_firestore17.getDocs)(finalQuery);
|
|
5507
5456
|
const patients = querySnapshot.docs.map(
|
|
5508
|
-
(
|
|
5457
|
+
(doc37) => doc37.data()
|
|
5509
5458
|
);
|
|
5510
5459
|
console.log(
|
|
5511
5460
|
`[searchPatientsUtil] Found ${patients.length} patients matching criteria.`
|
|
@@ -5537,8 +5486,8 @@ var getAllPatientsUtil = async (db, options) => {
|
|
|
5537
5486
|
}
|
|
5538
5487
|
const patientsSnapshot = await (0, import_firestore17.getDocs)(q);
|
|
5539
5488
|
const patients = [];
|
|
5540
|
-
patientsSnapshot.forEach((
|
|
5541
|
-
patients.push(
|
|
5489
|
+
patientsSnapshot.forEach((doc37) => {
|
|
5490
|
+
patients.push(doc37.data());
|
|
5542
5491
|
});
|
|
5543
5492
|
console.log(`[getAllPatientsUtil] Found ${patients.length} patients`);
|
|
5544
5493
|
return patients;
|
|
@@ -5660,7 +5609,7 @@ var getActiveInviteTokensByClinicUtil = async (db, clinicId) => {
|
|
|
5660
5609
|
if (querySnapshot.empty) {
|
|
5661
5610
|
return [];
|
|
5662
5611
|
}
|
|
5663
|
-
return querySnapshot.docs.map((
|
|
5612
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
5664
5613
|
};
|
|
5665
5614
|
var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
|
|
5666
5615
|
const tokensRef = (0, import_firestore18.collection)(
|
|
@@ -5678,7 +5627,7 @@ var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
|
|
|
5678
5627
|
if (querySnapshot.empty) {
|
|
5679
5628
|
return [];
|
|
5680
5629
|
}
|
|
5681
|
-
return querySnapshot.docs.map((
|
|
5630
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
5682
5631
|
};
|
|
5683
5632
|
|
|
5684
5633
|
// src/services/patient/patient.service.ts
|
|
@@ -6784,7 +6733,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6784
6733
|
(0, import_firestore21.where)("expiresAt", ">", import_firestore21.Timestamp.now())
|
|
6785
6734
|
);
|
|
6786
6735
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6787
|
-
return querySnapshot.docs.map((
|
|
6736
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
6788
6737
|
}
|
|
6789
6738
|
/**
|
|
6790
6739
|
* Gets a token by its string value and validates it
|
|
@@ -6894,7 +6843,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6894
6843
|
(0, import_firestore21.where)("status", "==", "active" /* ACTIVE */)
|
|
6895
6844
|
);
|
|
6896
6845
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6897
|
-
return querySnapshot.docs.map((
|
|
6846
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
6898
6847
|
}
|
|
6899
6848
|
/**
|
|
6900
6849
|
* Dohvata sve zdravstvene radnike za određenu kliniku
|
|
@@ -6906,7 +6855,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6906
6855
|
(0, import_firestore21.where)("isActive", "==", true)
|
|
6907
6856
|
);
|
|
6908
6857
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6909
|
-
return querySnapshot.docs.map((
|
|
6858
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
6910
6859
|
}
|
|
6911
6860
|
/**
|
|
6912
6861
|
* Dohvata sve draft zdravstvene radnike za određenu kliniku sa statusom DRAFT
|
|
@@ -6918,7 +6867,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6918
6867
|
(0, import_firestore21.where)("status", "==", "draft" /* DRAFT */)
|
|
6919
6868
|
);
|
|
6920
6869
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6921
|
-
return querySnapshot.docs.map((
|
|
6870
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
6922
6871
|
}
|
|
6923
6872
|
/**
|
|
6924
6873
|
* Updates a practitioner
|
|
@@ -7132,7 +7081,7 @@ var PractitionerService = class extends BaseService {
|
|
|
7132
7081
|
);
|
|
7133
7082
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
7134
7083
|
const practitioners = querySnapshot.docs.map(
|
|
7135
|
-
(
|
|
7084
|
+
(doc37) => doc37.data()
|
|
7136
7085
|
);
|
|
7137
7086
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
7138
7087
|
return {
|
|
@@ -7203,8 +7152,8 @@ var PractitionerService = class extends BaseService {
|
|
|
7203
7152
|
console.log(
|
|
7204
7153
|
`[PRACTITIONER_SERVICE] Found ${querySnapshot.docs.length} practitioners with base query`
|
|
7205
7154
|
);
|
|
7206
|
-
let practitioners = querySnapshot.docs.map((
|
|
7207
|
-
return { ...
|
|
7155
|
+
let practitioners = querySnapshot.docs.map((doc37) => {
|
|
7156
|
+
return { ...doc37.data(), id: doc37.id };
|
|
7208
7157
|
});
|
|
7209
7158
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
7210
7159
|
if (filters.nameSearch && filters.nameSearch.trim() !== "") {
|
|
@@ -7688,7 +7637,7 @@ var UserService = class extends BaseService {
|
|
|
7688
7637
|
];
|
|
7689
7638
|
const q = (0, import_firestore22.query)((0, import_firestore22.collection)(this.db, USERS_COLLECTION), ...constraints);
|
|
7690
7639
|
const querySnapshot = await (0, import_firestore22.getDocs)(q);
|
|
7691
|
-
const users = querySnapshot.docs.map((
|
|
7640
|
+
const users = querySnapshot.docs.map((doc37) => doc37.data());
|
|
7692
7641
|
return users.map((userData) => userSchema.parse(userData));
|
|
7693
7642
|
}
|
|
7694
7643
|
/**
|
|
@@ -8052,7 +8001,7 @@ async function getAllActiveGroups(db) {
|
|
|
8052
8001
|
(0, import_firestore23.where)("isActive", "==", true)
|
|
8053
8002
|
);
|
|
8054
8003
|
const querySnapshot = await (0, import_firestore23.getDocs)(q);
|
|
8055
|
-
return querySnapshot.docs.map((
|
|
8004
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
8056
8005
|
}
|
|
8057
8006
|
async function updateClinicGroup(db, groupId, data, app) {
|
|
8058
8007
|
console.log("[CLINIC_GROUP] Updating clinic group", { groupId });
|
|
@@ -8492,7 +8441,7 @@ async function getClinicsByGroup(db, groupId) {
|
|
|
8492
8441
|
(0, import_firestore24.where)("isActive", "==", true)
|
|
8493
8442
|
);
|
|
8494
8443
|
const querySnapshot = await (0, import_firestore24.getDocs)(q);
|
|
8495
|
-
return querySnapshot.docs.map((
|
|
8444
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
8496
8445
|
}
|
|
8497
8446
|
async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
|
|
8498
8447
|
console.log("[CLINIC] Starting clinic update", { clinicId, adminId });
|
|
@@ -8686,7 +8635,7 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
|
|
|
8686
8635
|
}
|
|
8687
8636
|
const q = (0, import_firestore24.query)((0, import_firestore24.collection)(db, CLINICS_COLLECTION), ...constraints);
|
|
8688
8637
|
const querySnapshot = await (0, import_firestore24.getDocs)(q);
|
|
8689
|
-
return querySnapshot.docs.map((
|
|
8638
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
8690
8639
|
}
|
|
8691
8640
|
async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
|
|
8692
8641
|
return getClinicsByAdmin(
|
|
@@ -8731,11 +8680,11 @@ async function getAllClinics(db, pagination, lastDoc) {
|
|
|
8731
8680
|
}
|
|
8732
8681
|
const clinicsSnapshot = await (0, import_firestore24.getDocs)(clinicsQuery);
|
|
8733
8682
|
const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
|
|
8734
|
-
const clinics = clinicsSnapshot.docs.map((
|
|
8735
|
-
const data =
|
|
8683
|
+
const clinics = clinicsSnapshot.docs.map((doc37) => {
|
|
8684
|
+
const data = doc37.data();
|
|
8736
8685
|
return {
|
|
8737
8686
|
...data,
|
|
8738
|
-
id:
|
|
8687
|
+
id: doc37.id
|
|
8739
8688
|
};
|
|
8740
8689
|
});
|
|
8741
8690
|
return {
|
|
@@ -8762,8 +8711,8 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
|
|
|
8762
8711
|
];
|
|
8763
8712
|
const q = (0, import_firestore24.query)((0, import_firestore24.collection)(db, CLINICS_COLLECTION), ...constraints);
|
|
8764
8713
|
const querySnapshot = await (0, import_firestore24.getDocs)(q);
|
|
8765
|
-
for (const
|
|
8766
|
-
const clinic =
|
|
8714
|
+
for (const doc37 of querySnapshot.docs) {
|
|
8715
|
+
const clinic = doc37.data();
|
|
8767
8716
|
const distance = (0, import_geofire_common4.distanceBetween)(
|
|
8768
8717
|
[center.latitude, center.longitude],
|
|
8769
8718
|
[clinic.location.latitude, clinic.location.longitude]
|
|
@@ -8880,8 +8829,8 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
|
|
|
8880
8829
|
}
|
|
8881
8830
|
const q = (0, import_firestore25.query)((0, import_firestore25.collection)(db, CLINICS_COLLECTION), ...constraints);
|
|
8882
8831
|
const querySnapshot = await (0, import_firestore25.getDocs)(q);
|
|
8883
|
-
for (const
|
|
8884
|
-
const clinic =
|
|
8832
|
+
for (const doc37 of querySnapshot.docs) {
|
|
8833
|
+
const clinic = doc37.data();
|
|
8885
8834
|
const distance = (0, import_geofire_common5.distanceBetween)(
|
|
8886
8835
|
[center.latitude, center.longitude],
|
|
8887
8836
|
[clinic.location.latitude, clinic.location.longitude]
|
|
@@ -8969,8 +8918,8 @@ async function getClinicsByFilters(db, filters) {
|
|
|
8969
8918
|
console.log(
|
|
8970
8919
|
`[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics in geo bound`
|
|
8971
8920
|
);
|
|
8972
|
-
for (const
|
|
8973
|
-
const clinic = { ...
|
|
8921
|
+
for (const doc37 of querySnapshot.docs) {
|
|
8922
|
+
const clinic = { ...doc37.data(), id: doc37.id };
|
|
8974
8923
|
const distance = (0, import_geofire_common6.distanceBetween)(
|
|
8975
8924
|
[center.latitude, center.longitude],
|
|
8976
8925
|
[clinic.location.latitude, clinic.location.longitude]
|
|
@@ -9026,8 +8975,8 @@ async function getClinicsByFilters(db, filters) {
|
|
|
9026
8975
|
console.log(
|
|
9027
8976
|
`[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics with regular query`
|
|
9028
8977
|
);
|
|
9029
|
-
const clinics = querySnapshot.docs.map((
|
|
9030
|
-
return { ...
|
|
8978
|
+
const clinics = querySnapshot.docs.map((doc37) => {
|
|
8979
|
+
return { ...doc37.data(), id: doc37.id };
|
|
9031
8980
|
});
|
|
9032
8981
|
let filteredClinics = clinics;
|
|
9033
8982
|
if (filters.center) {
|
|
@@ -10648,7 +10597,7 @@ async function searchCalendarEventsUtil(db, params) {
|
|
|
10648
10597
|
const finalQuery = (0, import_firestore33.query)(collectionRef, ...constraints);
|
|
10649
10598
|
const querySnapshot = await (0, import_firestore33.getDocs)(finalQuery);
|
|
10650
10599
|
const events = querySnapshot.docs.map(
|
|
10651
|
-
(
|
|
10600
|
+
(doc37) => ({ id: doc37.id, ...doc37.data() })
|
|
10652
10601
|
);
|
|
10653
10602
|
return events;
|
|
10654
10603
|
} catch (error) {
|
|
@@ -10730,7 +10679,7 @@ async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
|
|
|
10730
10679
|
);
|
|
10731
10680
|
const q = (0, import_firestore34.query)(calendarsRef, (0, import_firestore34.orderBy)("createdAt", "desc"));
|
|
10732
10681
|
const querySnapshot = await (0, import_firestore34.getDocs)(q);
|
|
10733
|
-
return querySnapshot.docs.map((
|
|
10682
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
10734
10683
|
}
|
|
10735
10684
|
async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
|
|
10736
10685
|
const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
|
|
@@ -10747,7 +10696,7 @@ async function getPatientSyncedCalendarsUtil(db, patientId) {
|
|
|
10747
10696
|
);
|
|
10748
10697
|
const q = (0, import_firestore34.query)(calendarsRef, (0, import_firestore34.orderBy)("createdAt", "desc"));
|
|
10749
10698
|
const querySnapshot = await (0, import_firestore34.getDocs)(q);
|
|
10750
|
-
return querySnapshot.docs.map((
|
|
10699
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
10751
10700
|
}
|
|
10752
10701
|
async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
|
|
10753
10702
|
const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
|
|
@@ -10764,7 +10713,7 @@ async function getClinicSyncedCalendarsUtil(db, clinicId) {
|
|
|
10764
10713
|
);
|
|
10765
10714
|
const q = (0, import_firestore34.query)(calendarsRef, (0, import_firestore34.orderBy)("createdAt", "desc"));
|
|
10766
10715
|
const querySnapshot = await (0, import_firestore34.getDocs)(q);
|
|
10767
|
-
return querySnapshot.docs.map((
|
|
10716
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
10768
10717
|
}
|
|
10769
10718
|
async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
|
|
10770
10719
|
const calendarRef = getPractitionerSyncedCalendarDocRef(
|
|
@@ -12119,9 +12068,9 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
12119
12068
|
(0, import_firestore37.where)("eventTime.start", "<=", import_firestore36.Timestamp.fromDate(endDate))
|
|
12120
12069
|
);
|
|
12121
12070
|
const eventsSnapshot = await (0, import_firestore37.getDocs)(q);
|
|
12122
|
-
const events = eventsSnapshot.docs.map((
|
|
12123
|
-
id:
|
|
12124
|
-
...
|
|
12071
|
+
const events = eventsSnapshot.docs.map((doc37) => ({
|
|
12072
|
+
id: doc37.id,
|
|
12073
|
+
...doc37.data()
|
|
12125
12074
|
}));
|
|
12126
12075
|
const calendars = await this.syncedCalendarsService.getPractitionerSyncedCalendars(
|
|
12127
12076
|
doctorId
|
|
@@ -12755,7 +12704,7 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
12755
12704
|
])
|
|
12756
12705
|
);
|
|
12757
12706
|
const querySnapshot = await (0, import_firestore37.getDocs)(q);
|
|
12758
|
-
return querySnapshot.docs.map((
|
|
12707
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
12759
12708
|
}
|
|
12760
12709
|
/**
|
|
12761
12710
|
* Calculates available time slots based on working hours, schedule and existing appointments
|
|
@@ -13286,7 +13235,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
13286
13235
|
...constraints
|
|
13287
13236
|
);
|
|
13288
13237
|
const querySnapshot = await (0, import_firestore40.getDocs)(q);
|
|
13289
|
-
return querySnapshot.docs.map((
|
|
13238
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
13290
13239
|
} catch (error) {
|
|
13291
13240
|
console.error(
|
|
13292
13241
|
"[PractitionerInviteService] Error getting doctor invites:",
|
|
@@ -13315,7 +13264,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
13315
13264
|
...constraints
|
|
13316
13265
|
);
|
|
13317
13266
|
const querySnapshot = await (0, import_firestore40.getDocs)(q);
|
|
13318
|
-
return querySnapshot.docs.map((
|
|
13267
|
+
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
13319
13268
|
} catch (error) {
|
|
13320
13269
|
console.error(
|
|
13321
13270
|
"[PractitionerInviteService] Error getting clinic invites:",
|
|
@@ -13471,7 +13420,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
13471
13420
|
);
|
|
13472
13421
|
const querySnapshot = await (0, import_firestore40.getDocs)(q);
|
|
13473
13422
|
let invites = querySnapshot.docs.map(
|
|
13474
|
-
(
|
|
13423
|
+
(doc37) => doc37.data()
|
|
13475
13424
|
);
|
|
13476
13425
|
if (filters.fromDate) {
|
|
13477
13426
|
invites = invites.filter(
|
|
@@ -13728,8 +13677,8 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13728
13677
|
const q = (0, import_firestore41.query)(versionsCollectionRef, (0, import_firestore41.orderBy)("version", "desc"));
|
|
13729
13678
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13730
13679
|
const versions = [];
|
|
13731
|
-
querySnapshot.forEach((
|
|
13732
|
-
versions.push(
|
|
13680
|
+
querySnapshot.forEach((doc37) => {
|
|
13681
|
+
versions.push(doc37.data());
|
|
13733
13682
|
});
|
|
13734
13683
|
return versions;
|
|
13735
13684
|
}
|
|
@@ -13760,9 +13709,9 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13760
13709
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13761
13710
|
const templates = [];
|
|
13762
13711
|
let lastVisible = null;
|
|
13763
|
-
querySnapshot.forEach((
|
|
13764
|
-
templates.push(
|
|
13765
|
-
lastVisible =
|
|
13712
|
+
querySnapshot.forEach((doc37) => {
|
|
13713
|
+
templates.push(doc37.data());
|
|
13714
|
+
lastVisible = doc37;
|
|
13766
13715
|
});
|
|
13767
13716
|
return {
|
|
13768
13717
|
templates,
|
|
@@ -13790,9 +13739,9 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13790
13739
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13791
13740
|
const templates = [];
|
|
13792
13741
|
let lastVisible = null;
|
|
13793
|
-
querySnapshot.forEach((
|
|
13794
|
-
templates.push(
|
|
13795
|
-
lastVisible =
|
|
13742
|
+
querySnapshot.forEach((doc37) => {
|
|
13743
|
+
templates.push(doc37.data());
|
|
13744
|
+
lastVisible = doc37;
|
|
13796
13745
|
});
|
|
13797
13746
|
return {
|
|
13798
13747
|
templates,
|
|
@@ -13819,9 +13768,9 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13819
13768
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13820
13769
|
const templates = [];
|
|
13821
13770
|
let lastVisible = null;
|
|
13822
|
-
querySnapshot.forEach((
|
|
13823
|
-
templates.push(
|
|
13824
|
-
lastVisible =
|
|
13771
|
+
querySnapshot.forEach((doc37) => {
|
|
13772
|
+
templates.push(doc37.data());
|
|
13773
|
+
lastVisible = doc37;
|
|
13825
13774
|
});
|
|
13826
13775
|
return {
|
|
13827
13776
|
templates,
|
|
@@ -13847,8 +13796,8 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13847
13796
|
}
|
|
13848
13797
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13849
13798
|
const templates = [];
|
|
13850
|
-
querySnapshot.forEach((
|
|
13851
|
-
templates.push(
|
|
13799
|
+
querySnapshot.forEach((doc37) => {
|
|
13800
|
+
templates.push(doc37.data());
|
|
13852
13801
|
});
|
|
13853
13802
|
return templates;
|
|
13854
13803
|
}
|
|
@@ -14043,9 +13992,9 @@ var FilledDocumentService = class extends BaseService {
|
|
|
14043
13992
|
const querySnapshot = await (0, import_firestore42.getDocs)(q);
|
|
14044
13993
|
const documents = [];
|
|
14045
13994
|
let lastVisible = null;
|
|
14046
|
-
querySnapshot.forEach((
|
|
14047
|
-
documents.push(
|
|
14048
|
-
lastVisible =
|
|
13995
|
+
querySnapshot.forEach((doc37) => {
|
|
13996
|
+
documents.push(doc37.data());
|
|
13997
|
+
lastVisible = doc37;
|
|
14049
13998
|
});
|
|
14050
13999
|
return {
|
|
14051
14000
|
documents,
|
|
@@ -14254,9 +14203,9 @@ var NotificationService = class extends BaseService {
|
|
|
14254
14203
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14255
14204
|
);
|
|
14256
14205
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14257
|
-
return querySnapshot.docs.map((
|
|
14258
|
-
id:
|
|
14259
|
-
...
|
|
14206
|
+
return querySnapshot.docs.map((doc37) => ({
|
|
14207
|
+
id: doc37.id,
|
|
14208
|
+
...doc37.data()
|
|
14260
14209
|
}));
|
|
14261
14210
|
}
|
|
14262
14211
|
/**
|
|
@@ -14270,9 +14219,9 @@ var NotificationService = class extends BaseService {
|
|
|
14270
14219
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14271
14220
|
);
|
|
14272
14221
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14273
|
-
return querySnapshot.docs.map((
|
|
14274
|
-
id:
|
|
14275
|
-
...
|
|
14222
|
+
return querySnapshot.docs.map((doc37) => ({
|
|
14223
|
+
id: doc37.id,
|
|
14224
|
+
...doc37.data()
|
|
14276
14225
|
}));
|
|
14277
14226
|
}
|
|
14278
14227
|
/**
|
|
@@ -14344,9 +14293,9 @@ var NotificationService = class extends BaseService {
|
|
|
14344
14293
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14345
14294
|
);
|
|
14346
14295
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14347
|
-
return querySnapshot.docs.map((
|
|
14348
|
-
id:
|
|
14349
|
-
...
|
|
14296
|
+
return querySnapshot.docs.map((doc37) => ({
|
|
14297
|
+
id: doc37.id,
|
|
14298
|
+
...doc37.data()
|
|
14350
14299
|
}));
|
|
14351
14300
|
}
|
|
14352
14301
|
/**
|
|
@@ -14359,9 +14308,9 @@ var NotificationService = class extends BaseService {
|
|
|
14359
14308
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14360
14309
|
);
|
|
14361
14310
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14362
|
-
return querySnapshot.docs.map((
|
|
14363
|
-
id:
|
|
14364
|
-
...
|
|
14311
|
+
return querySnapshot.docs.map((doc37) => ({
|
|
14312
|
+
id: doc37.id,
|
|
14313
|
+
...doc37.data()
|
|
14365
14314
|
}));
|
|
14366
14315
|
}
|
|
14367
14316
|
};
|
|
@@ -14838,8 +14787,8 @@ var ProcedureService = class extends BaseService {
|
|
|
14838
14787
|
(0, import_firestore45.where)((0, import_firestore45.documentId)(), "in", chunk)
|
|
14839
14788
|
);
|
|
14840
14789
|
const practitionersSnapshot = await (0, import_firestore45.getDocs)(practitionersQuery);
|
|
14841
|
-
practitionersSnapshot.docs.forEach((
|
|
14842
|
-
practitionersMap.set(
|
|
14790
|
+
practitionersSnapshot.docs.forEach((doc37) => {
|
|
14791
|
+
practitionersMap.set(doc37.id, doc37.data());
|
|
14843
14792
|
});
|
|
14844
14793
|
}
|
|
14845
14794
|
if (practitionersMap.size !== practitionerIds.length) {
|
|
@@ -14921,8 +14870,8 @@ var ProcedureService = class extends BaseService {
|
|
|
14921
14870
|
(0, import_firestore45.where)((0, import_firestore45.documentId)(), "in", chunk)
|
|
14922
14871
|
);
|
|
14923
14872
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14924
|
-
snapshot.forEach((
|
|
14925
|
-
fetchedProcedures.push(
|
|
14873
|
+
snapshot.forEach((doc37) => {
|
|
14874
|
+
fetchedProcedures.push(doc37.data());
|
|
14926
14875
|
});
|
|
14927
14876
|
}
|
|
14928
14877
|
return fetchedProcedures;
|
|
@@ -14952,7 +14901,7 @@ var ProcedureService = class extends BaseService {
|
|
|
14952
14901
|
(0, import_firestore45.where)("isActive", "==", true)
|
|
14953
14902
|
);
|
|
14954
14903
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14955
|
-
return snapshot.docs.map((
|
|
14904
|
+
return snapshot.docs.map((doc37) => doc37.data());
|
|
14956
14905
|
}
|
|
14957
14906
|
/**
|
|
14958
14907
|
* Gets all procedures for a practitioner
|
|
@@ -14966,7 +14915,7 @@ var ProcedureService = class extends BaseService {
|
|
|
14966
14915
|
(0, import_firestore45.where)("isActive", "==", true)
|
|
14967
14916
|
);
|
|
14968
14917
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14969
|
-
return snapshot.docs.map((
|
|
14918
|
+
return snapshot.docs.map((doc37) => doc37.data());
|
|
14970
14919
|
}
|
|
14971
14920
|
/**
|
|
14972
14921
|
* Gets all inactive procedures for a practitioner
|
|
@@ -14980,7 +14929,7 @@ var ProcedureService = class extends BaseService {
|
|
|
14980
14929
|
(0, import_firestore45.where)("isActive", "==", false)
|
|
14981
14930
|
);
|
|
14982
14931
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14983
|
-
return snapshot.docs.map((
|
|
14932
|
+
return snapshot.docs.map((doc37) => doc37.data());
|
|
14984
14933
|
}
|
|
14985
14934
|
/**
|
|
14986
14935
|
* Updates a procedure
|
|
@@ -15192,11 +15141,11 @@ var ProcedureService = class extends BaseService {
|
|
|
15192
15141
|
}
|
|
15193
15142
|
const proceduresSnapshot = await (0, import_firestore45.getDocs)(proceduresQuery);
|
|
15194
15143
|
const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
|
|
15195
|
-
const procedures = proceduresSnapshot.docs.map((
|
|
15196
|
-
const data =
|
|
15144
|
+
const procedures = proceduresSnapshot.docs.map((doc37) => {
|
|
15145
|
+
const data = doc37.data();
|
|
15197
15146
|
return {
|
|
15198
15147
|
...data,
|
|
15199
|
-
id:
|
|
15148
|
+
id: doc37.id
|
|
15200
15149
|
// Ensure ID is present
|
|
15201
15150
|
};
|
|
15202
15151
|
});
|
|
@@ -15278,8 +15227,8 @@ var ProcedureService = class extends BaseService {
|
|
|
15278
15227
|
console.log(
|
|
15279
15228
|
`[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures in geo bound`
|
|
15280
15229
|
);
|
|
15281
|
-
for (const
|
|
15282
|
-
const procedure = { ...
|
|
15230
|
+
for (const doc37 of querySnapshot.docs) {
|
|
15231
|
+
const procedure = { ...doc37.data(), id: doc37.id };
|
|
15283
15232
|
const distance = (0, import_geofire_common8.distanceBetween)(
|
|
15284
15233
|
[center.latitude, center.longitude],
|
|
15285
15234
|
[
|
|
@@ -15330,8 +15279,8 @@ var ProcedureService = class extends BaseService {
|
|
|
15330
15279
|
console.log(
|
|
15331
15280
|
`[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures with regular query`
|
|
15332
15281
|
);
|
|
15333
|
-
const procedures = querySnapshot.docs.map((
|
|
15334
|
-
return { ...
|
|
15282
|
+
const procedures = querySnapshot.docs.map((doc37) => {
|
|
15283
|
+
return { ...doc37.data(), id: doc37.id };
|
|
15335
15284
|
});
|
|
15336
15285
|
if (filters.location) {
|
|
15337
15286
|
const center = filters.location;
|
|
@@ -15664,7 +15613,7 @@ var ReviewService = class extends BaseService {
|
|
|
15664
15613
|
(0, import_firestore46.where)("patientId", "==", patientId)
|
|
15665
15614
|
);
|
|
15666
15615
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15667
|
-
return snapshot.docs.map((
|
|
15616
|
+
return snapshot.docs.map((doc37) => doc37.data());
|
|
15668
15617
|
}
|
|
15669
15618
|
/**
|
|
15670
15619
|
* Gets all reviews for a specific clinic
|
|
@@ -15677,7 +15626,7 @@ var ReviewService = class extends BaseService {
|
|
|
15677
15626
|
(0, import_firestore46.where)("clinicReview.clinicId", "==", clinicId)
|
|
15678
15627
|
);
|
|
15679
15628
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15680
|
-
return snapshot.docs.map((
|
|
15629
|
+
return snapshot.docs.map((doc37) => doc37.data());
|
|
15681
15630
|
}
|
|
15682
15631
|
/**
|
|
15683
15632
|
* Gets all reviews for a specific practitioner
|
|
@@ -15690,7 +15639,7 @@ var ReviewService = class extends BaseService {
|
|
|
15690
15639
|
(0, import_firestore46.where)("practitionerReview.practitionerId", "==", practitionerId)
|
|
15691
15640
|
);
|
|
15692
15641
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15693
|
-
return snapshot.docs.map((
|
|
15642
|
+
return snapshot.docs.map((doc37) => doc37.data());
|
|
15694
15643
|
}
|
|
15695
15644
|
/**
|
|
15696
15645
|
* Gets all reviews for a specific procedure
|
|
@@ -15703,7 +15652,7 @@ var ReviewService = class extends BaseService {
|
|
|
15703
15652
|
(0, import_firestore46.where)("procedureReview.procedureId", "==", procedureId)
|
|
15704
15653
|
);
|
|
15705
15654
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15706
|
-
return snapshot.docs.map((
|
|
15655
|
+
return snapshot.docs.map((doc37) => doc37.data());
|
|
15707
15656
|
}
|
|
15708
15657
|
/**
|
|
15709
15658
|
* Gets all reviews for a specific appointment
|
|
@@ -16016,12 +15965,11 @@ var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
|
|
|
16016
15965
|
TimeUnit2["DAYS"] = "days";
|
|
16017
15966
|
return TimeUnit2;
|
|
16018
15967
|
})(TimeUnit || {});
|
|
16019
|
-
var RequirementType = /* @__PURE__ */ ((
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
return
|
|
15968
|
+
var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
|
|
15969
|
+
RequirementType2["PRE"] = "pre";
|
|
15970
|
+
RequirementType2["POST"] = "post";
|
|
15971
|
+
return RequirementType2;
|
|
16023
15972
|
})(RequirementType || {});
|
|
16024
|
-
var REQUIREMENTS_COLLECTION = "backoffice_requirements";
|
|
16025
15973
|
|
|
16026
15974
|
// src/backoffice/validations/schemas.ts
|
|
16027
15975
|
var blockingConditionSchemaBackoffice = import_zod29.z.nativeEnum(BlockingCondition);
|
|
@@ -16406,9 +16354,9 @@ var BrandService = class extends BaseService {
|
|
|
16406
16354
|
const q = (0, import_firestore51.query)(this.getBrandsRef(), (0, import_firestore51.where)("isActive", "==", true));
|
|
16407
16355
|
const snapshot = await (0, import_firestore51.getDocs)(q);
|
|
16408
16356
|
return snapshot.docs.map(
|
|
16409
|
-
(
|
|
16410
|
-
id:
|
|
16411
|
-
...
|
|
16357
|
+
(doc37) => ({
|
|
16358
|
+
id: doc37.id,
|
|
16359
|
+
...doc37.data()
|
|
16412
16360
|
})
|
|
16413
16361
|
);
|
|
16414
16362
|
}
|
|
@@ -16484,9 +16432,9 @@ var CategoryService = class extends BaseService {
|
|
|
16484
16432
|
const q = (0, import_firestore52.query)(this.categoriesRef, (0, import_firestore52.where)("isActive", "==", true));
|
|
16485
16433
|
const snapshot = await (0, import_firestore52.getDocs)(q);
|
|
16486
16434
|
return snapshot.docs.map(
|
|
16487
|
-
(
|
|
16488
|
-
id:
|
|
16489
|
-
...
|
|
16435
|
+
(doc37) => ({
|
|
16436
|
+
id: doc37.id,
|
|
16437
|
+
...doc37.data()
|
|
16490
16438
|
})
|
|
16491
16439
|
);
|
|
16492
16440
|
}
|
|
@@ -16503,9 +16451,9 @@ var CategoryService = class extends BaseService {
|
|
|
16503
16451
|
);
|
|
16504
16452
|
const snapshot = await (0, import_firestore52.getDocs)(q);
|
|
16505
16453
|
return snapshot.docs.map(
|
|
16506
|
-
(
|
|
16507
|
-
id:
|
|
16508
|
-
...
|
|
16454
|
+
(doc37) => ({
|
|
16455
|
+
id: doc37.id,
|
|
16456
|
+
...doc37.data()
|
|
16509
16457
|
})
|
|
16510
16458
|
);
|
|
16511
16459
|
}
|
|
@@ -16547,312 +16495,8 @@ var CategoryService = class extends BaseService {
|
|
|
16547
16495
|
}
|
|
16548
16496
|
};
|
|
16549
16497
|
|
|
16550
|
-
// src/backoffice/services/documentation-template.service.ts
|
|
16551
|
-
var DocumentationTemplateServiceBackoffice = class {
|
|
16552
|
-
/**
|
|
16553
|
-
* Constructor for DocumentationTemplateService
|
|
16554
|
-
* @param db - Firestore instance
|
|
16555
|
-
* @param auth - Firebase Auth instance
|
|
16556
|
-
* @param app - Firebase App instance
|
|
16557
|
-
*/
|
|
16558
|
-
constructor(db, auth, app) {
|
|
16559
|
-
this.apiService = new DocumentationTemplateService(db, auth, app);
|
|
16560
|
-
}
|
|
16561
|
-
/**
|
|
16562
|
-
* Create a new document template
|
|
16563
|
-
* @param data - Template data
|
|
16564
|
-
* @param userId - ID of the user creating the template
|
|
16565
|
-
* @returns The created template
|
|
16566
|
-
*/
|
|
16567
|
-
async createTemplate(data, userId) {
|
|
16568
|
-
return this.apiService.createTemplate(data, userId);
|
|
16569
|
-
}
|
|
16570
|
-
/**
|
|
16571
|
-
* Get a document template by ID
|
|
16572
|
-
* @param templateId - ID of the template to retrieve
|
|
16573
|
-
* @param version - Optional version number to retrieve (defaults to latest version)
|
|
16574
|
-
* @returns The template or null if not found
|
|
16575
|
-
*/
|
|
16576
|
-
async getTemplateById(templateId, version) {
|
|
16577
|
-
return this.apiService.getTemplateById(templateId, version);
|
|
16578
|
-
}
|
|
16579
|
-
/**
|
|
16580
|
-
* Update an existing document template
|
|
16581
|
-
* @param templateId - ID of the template to update
|
|
16582
|
-
* @param data - Updated template data
|
|
16583
|
-
* @returns The updated template
|
|
16584
|
-
*/
|
|
16585
|
-
async updateTemplate(templateId, data) {
|
|
16586
|
-
return this.apiService.updateTemplate(templateId, data);
|
|
16587
|
-
}
|
|
16588
|
-
/**
|
|
16589
|
-
* Delete a document template
|
|
16590
|
-
* @param templateId - ID of the template to delete
|
|
16591
|
-
*/
|
|
16592
|
-
async deleteTemplate(templateId) {
|
|
16593
|
-
return this.apiService.deleteTemplate(templateId);
|
|
16594
|
-
}
|
|
16595
|
-
/**
|
|
16596
|
-
* Get all active templates
|
|
16597
|
-
* @param pageSize - Number of templates to retrieve
|
|
16598
|
-
* @param lastDoc - Last document from previous page for pagination
|
|
16599
|
-
* @returns Array of templates and the last document for pagination
|
|
16600
|
-
*/
|
|
16601
|
-
async getActiveTemplates(pageSize = 20, lastDoc) {
|
|
16602
|
-
return this.apiService.getActiveTemplates(pageSize, lastDoc);
|
|
16603
|
-
}
|
|
16604
|
-
/**
|
|
16605
|
-
* Get templates by tags
|
|
16606
|
-
* @param tags - Tags to filter by
|
|
16607
|
-
* @param pageSize - Number of templates to retrieve
|
|
16608
|
-
* @param lastDoc - Last document from previous page for pagination
|
|
16609
|
-
* @returns Array of templates and the last document for pagination
|
|
16610
|
-
*/
|
|
16611
|
-
async getTemplatesByTags(tags, pageSize = 20, lastDoc) {
|
|
16612
|
-
return this.apiService.getTemplatesByTags(tags, pageSize, lastDoc);
|
|
16613
|
-
}
|
|
16614
|
-
/**
|
|
16615
|
-
* Get templates created by a specific user
|
|
16616
|
-
* @param userId - ID of the user who created the templates
|
|
16617
|
-
* @param pageSize - Number of templates to retrieve
|
|
16618
|
-
* @param lastDoc - Last document from previous page for pagination
|
|
16619
|
-
* @returns Array of templates and the last document for pagination
|
|
16620
|
-
*/
|
|
16621
|
-
async getTemplatesByCreator(userId, pageSize = 20, lastDoc) {
|
|
16622
|
-
return this.apiService.getTemplatesByCreator(userId, pageSize, lastDoc);
|
|
16623
|
-
}
|
|
16624
|
-
/**
|
|
16625
|
-
* Get a specific version of a template
|
|
16626
|
-
* @param templateId - ID of the template
|
|
16627
|
-
* @param versionNumber - Version number to retrieve
|
|
16628
|
-
* @returns The template version or null if not found
|
|
16629
|
-
*/
|
|
16630
|
-
async getTemplateVersion(templateId, versionNumber) {
|
|
16631
|
-
return this.apiService.getTemplateVersion(templateId, versionNumber);
|
|
16632
|
-
}
|
|
16633
|
-
/**
|
|
16634
|
-
* Get all versions of a template
|
|
16635
|
-
* @param templateId - ID of the template
|
|
16636
|
-
* @returns Array of template versions
|
|
16637
|
-
*/
|
|
16638
|
-
async getTemplateVersions(templateId) {
|
|
16639
|
-
return this.apiService.getTemplateOldVersions(templateId);
|
|
16640
|
-
}
|
|
16641
|
-
};
|
|
16642
|
-
|
|
16643
|
-
// src/backoffice/services/product.service.ts
|
|
16644
|
-
var import_firestore53 = require("firebase/firestore");
|
|
16645
|
-
|
|
16646
|
-
// src/backoffice/types/product.types.ts
|
|
16647
|
-
var PRODUCTS_COLLECTION = "products";
|
|
16648
|
-
|
|
16649
|
-
// src/backoffice/services/product.service.ts
|
|
16650
|
-
var ProductService = class extends BaseService {
|
|
16651
|
-
/**
|
|
16652
|
-
* Gets reference to products collection under a technology
|
|
16653
|
-
* @param technologyId - ID of the technology
|
|
16654
|
-
* @returns Firestore collection reference
|
|
16655
|
-
*/
|
|
16656
|
-
getProductsRef(technologyId) {
|
|
16657
|
-
return (0, import_firestore53.collection)(
|
|
16658
|
-
this.db,
|
|
16659
|
-
TECHNOLOGIES_COLLECTION,
|
|
16660
|
-
technologyId,
|
|
16661
|
-
PRODUCTS_COLLECTION
|
|
16662
|
-
);
|
|
16663
|
-
}
|
|
16664
|
-
/**
|
|
16665
|
-
* Creates a new product under technology
|
|
16666
|
-
*/
|
|
16667
|
-
async create(technologyId, brandId, product) {
|
|
16668
|
-
const now = /* @__PURE__ */ new Date();
|
|
16669
|
-
const newProduct = {
|
|
16670
|
-
...product,
|
|
16671
|
-
brandId,
|
|
16672
|
-
technologyId,
|
|
16673
|
-
createdAt: now,
|
|
16674
|
-
updatedAt: now,
|
|
16675
|
-
isActive: true
|
|
16676
|
-
};
|
|
16677
|
-
const productRef = await (0, import_firestore53.addDoc)(
|
|
16678
|
-
this.getProductsRef(technologyId),
|
|
16679
|
-
newProduct
|
|
16680
|
-
);
|
|
16681
|
-
return { id: productRef.id, ...newProduct };
|
|
16682
|
-
}
|
|
16683
|
-
/**
|
|
16684
|
-
* Gets all products for a technology
|
|
16685
|
-
*/
|
|
16686
|
-
async getAllByTechnology(technologyId) {
|
|
16687
|
-
const q = (0, import_firestore53.query)(
|
|
16688
|
-
this.getProductsRef(technologyId),
|
|
16689
|
-
(0, import_firestore53.where)("isActive", "==", true)
|
|
16690
|
-
);
|
|
16691
|
-
const snapshot = await (0, import_firestore53.getDocs)(q);
|
|
16692
|
-
return snapshot.docs.map(
|
|
16693
|
-
(doc38) => ({
|
|
16694
|
-
id: doc38.id,
|
|
16695
|
-
...doc38.data()
|
|
16696
|
-
})
|
|
16697
|
-
);
|
|
16698
|
-
}
|
|
16699
|
-
/**
|
|
16700
|
-
* Gets all products for a brand by filtering through all technologies
|
|
16701
|
-
*/
|
|
16702
|
-
async getAllByBrand(brandId) {
|
|
16703
|
-
const allTechnologiesRef = (0, import_firestore53.collection)(this.db, TECHNOLOGIES_COLLECTION);
|
|
16704
|
-
const technologiesSnapshot = await (0, import_firestore53.getDocs)(allTechnologiesRef);
|
|
16705
|
-
const products = [];
|
|
16706
|
-
for (const techDoc of technologiesSnapshot.docs) {
|
|
16707
|
-
const q = (0, import_firestore53.query)(
|
|
16708
|
-
this.getProductsRef(techDoc.id),
|
|
16709
|
-
(0, import_firestore53.where)("brandId", "==", brandId),
|
|
16710
|
-
(0, import_firestore53.where)("isActive", "==", true)
|
|
16711
|
-
);
|
|
16712
|
-
const snapshot = await (0, import_firestore53.getDocs)(q);
|
|
16713
|
-
products.push(
|
|
16714
|
-
...snapshot.docs.map(
|
|
16715
|
-
(doc38) => ({
|
|
16716
|
-
id: doc38.id,
|
|
16717
|
-
...doc38.data()
|
|
16718
|
-
})
|
|
16719
|
-
)
|
|
16720
|
-
);
|
|
16721
|
-
}
|
|
16722
|
-
return products;
|
|
16723
|
-
}
|
|
16724
|
-
/**
|
|
16725
|
-
* Updates a product
|
|
16726
|
-
*/
|
|
16727
|
-
async update(technologyId, productId, product) {
|
|
16728
|
-
const updateData = {
|
|
16729
|
-
...product,
|
|
16730
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
16731
|
-
};
|
|
16732
|
-
const docRef = (0, import_firestore53.doc)(this.getProductsRef(technologyId), productId);
|
|
16733
|
-
await (0, import_firestore53.updateDoc)(docRef, updateData);
|
|
16734
|
-
return this.getById(technologyId, productId);
|
|
16735
|
-
}
|
|
16736
|
-
/**
|
|
16737
|
-
* Soft deletes a product
|
|
16738
|
-
*/
|
|
16739
|
-
async delete(technologyId, productId) {
|
|
16740
|
-
await this.update(technologyId, productId, {
|
|
16741
|
-
isActive: false
|
|
16742
|
-
});
|
|
16743
|
-
}
|
|
16744
|
-
/**
|
|
16745
|
-
* Gets a product by ID
|
|
16746
|
-
*/
|
|
16747
|
-
async getById(technologyId, productId) {
|
|
16748
|
-
const docRef = (0, import_firestore53.doc)(this.getProductsRef(technologyId), productId);
|
|
16749
|
-
const docSnap = await (0, import_firestore53.getDoc)(docRef);
|
|
16750
|
-
if (!docSnap.exists()) return null;
|
|
16751
|
-
return {
|
|
16752
|
-
id: docSnap.id,
|
|
16753
|
-
...docSnap.data()
|
|
16754
|
-
};
|
|
16755
|
-
}
|
|
16756
|
-
};
|
|
16757
|
-
|
|
16758
|
-
// src/backoffice/services/requirement.service.ts
|
|
16759
|
-
var import_firestore54 = require("firebase/firestore");
|
|
16760
|
-
var RequirementService = class extends BaseService {
|
|
16761
|
-
/**
|
|
16762
|
-
* Referenca na Firestore kolekciju zahteva
|
|
16763
|
-
*/
|
|
16764
|
-
get requirementsRef() {
|
|
16765
|
-
return (0, import_firestore54.collection)(this.db, REQUIREMENTS_COLLECTION);
|
|
16766
|
-
}
|
|
16767
|
-
/**
|
|
16768
|
-
* Kreira novi globalni zahtev
|
|
16769
|
-
* @param requirement - Podaci za novi zahtev
|
|
16770
|
-
* @returns Kreirani zahtev sa generisanim ID-em
|
|
16771
|
-
*/
|
|
16772
|
-
async create(requirement) {
|
|
16773
|
-
const now = /* @__PURE__ */ new Date();
|
|
16774
|
-
const newRequirement = {
|
|
16775
|
-
...requirement,
|
|
16776
|
-
createdAt: now,
|
|
16777
|
-
updatedAt: now,
|
|
16778
|
-
isActive: true
|
|
16779
|
-
};
|
|
16780
|
-
const docRef = await (0, import_firestore54.addDoc)(this.requirementsRef, newRequirement);
|
|
16781
|
-
return { id: docRef.id, ...newRequirement };
|
|
16782
|
-
}
|
|
16783
|
-
/**
|
|
16784
|
-
* Vraća sve aktivne zahteve
|
|
16785
|
-
* @returns Lista aktivnih zahteva
|
|
16786
|
-
*/
|
|
16787
|
-
async getAll() {
|
|
16788
|
-
const q = (0, import_firestore54.query)(this.requirementsRef, (0, import_firestore54.where)("isActive", "==", true));
|
|
16789
|
-
const snapshot = await (0, import_firestore54.getDocs)(q);
|
|
16790
|
-
return snapshot.docs.map(
|
|
16791
|
-
(doc38) => ({
|
|
16792
|
-
id: doc38.id,
|
|
16793
|
-
...doc38.data()
|
|
16794
|
-
})
|
|
16795
|
-
);
|
|
16796
|
-
}
|
|
16797
|
-
/**
|
|
16798
|
-
* Vraća sve aktivne zahteve određenog tipa
|
|
16799
|
-
* @param type - Tip zahteva (pre/post)
|
|
16800
|
-
* @returns Lista zahteva određenog tipa
|
|
16801
|
-
*/
|
|
16802
|
-
async getAllByType(type) {
|
|
16803
|
-
const q = (0, import_firestore54.query)(
|
|
16804
|
-
this.requirementsRef,
|
|
16805
|
-
(0, import_firestore54.where)("type", "==", type),
|
|
16806
|
-
(0, import_firestore54.where)("isActive", "==", true)
|
|
16807
|
-
);
|
|
16808
|
-
const snapshot = await (0, import_firestore54.getDocs)(q);
|
|
16809
|
-
return snapshot.docs.map(
|
|
16810
|
-
(doc38) => ({
|
|
16811
|
-
id: doc38.id,
|
|
16812
|
-
...doc38.data()
|
|
16813
|
-
})
|
|
16814
|
-
);
|
|
16815
|
-
}
|
|
16816
|
-
/**
|
|
16817
|
-
* Ažurira postojeći zahtev
|
|
16818
|
-
* @param id - ID zahteva koji se ažurira
|
|
16819
|
-
* @param requirement - Novi podaci za zahtev
|
|
16820
|
-
* @returns Ažurirani zahtev
|
|
16821
|
-
*/
|
|
16822
|
-
async update(id, requirement) {
|
|
16823
|
-
const updateData = {
|
|
16824
|
-
...requirement,
|
|
16825
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
16826
|
-
};
|
|
16827
|
-
const docRef = (0, import_firestore54.doc)(this.requirementsRef, id);
|
|
16828
|
-
await (0, import_firestore54.updateDoc)(docRef, updateData);
|
|
16829
|
-
return this.getById(id);
|
|
16830
|
-
}
|
|
16831
|
-
/**
|
|
16832
|
-
* Soft delete zahteva (postavlja isActive na false)
|
|
16833
|
-
* @param id - ID zahteva koji se briše
|
|
16834
|
-
*/
|
|
16835
|
-
async delete(id) {
|
|
16836
|
-
await this.update(id, { isActive: false });
|
|
16837
|
-
}
|
|
16838
|
-
/**
|
|
16839
|
-
* Vraća zahtev po ID-u
|
|
16840
|
-
* @param id - ID traženog zahteva
|
|
16841
|
-
* @returns Zahtev ili null ako ne postoji
|
|
16842
|
-
*/
|
|
16843
|
-
async getById(id) {
|
|
16844
|
-
const docRef = (0, import_firestore54.doc)(this.requirementsRef, id);
|
|
16845
|
-
const docSnap = await (0, import_firestore54.getDoc)(docRef);
|
|
16846
|
-
if (!docSnap.exists()) return null;
|
|
16847
|
-
return {
|
|
16848
|
-
id: docSnap.id,
|
|
16849
|
-
...docSnap.data()
|
|
16850
|
-
};
|
|
16851
|
-
}
|
|
16852
|
-
};
|
|
16853
|
-
|
|
16854
16498
|
// src/backoffice/services/subcategory.service.ts
|
|
16855
|
-
var
|
|
16499
|
+
var import_firestore53 = require("firebase/firestore");
|
|
16856
16500
|
|
|
16857
16501
|
// src/backoffice/types/subcategory.types.ts
|
|
16858
16502
|
var SUBCATEGORIES_COLLECTION = "subcategories";
|
|
@@ -16864,7 +16508,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
16864
16508
|
* @param categoryId - ID roditeljske kategorije
|
|
16865
16509
|
*/
|
|
16866
16510
|
getSubcategoriesRef(categoryId) {
|
|
16867
|
-
return (0,
|
|
16511
|
+
return (0, import_firestore53.collection)(
|
|
16868
16512
|
this.db,
|
|
16869
16513
|
CATEGORIES_COLLECTION,
|
|
16870
16514
|
categoryId,
|
|
@@ -16886,7 +16530,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
16886
16530
|
updatedAt: now,
|
|
16887
16531
|
isActive: true
|
|
16888
16532
|
};
|
|
16889
|
-
const docRef = await (0,
|
|
16533
|
+
const docRef = await (0, import_firestore53.addDoc)(
|
|
16890
16534
|
this.getSubcategoriesRef(categoryId),
|
|
16891
16535
|
newSubcategory
|
|
16892
16536
|
);
|
|
@@ -16898,15 +16542,15 @@ var SubcategoryService = class extends BaseService {
|
|
|
16898
16542
|
* @returns Lista aktivnih podkategorija
|
|
16899
16543
|
*/
|
|
16900
16544
|
async getAllByCategoryId(categoryId) {
|
|
16901
|
-
const q = (0,
|
|
16545
|
+
const q = (0, import_firestore53.query)(
|
|
16902
16546
|
this.getSubcategoriesRef(categoryId),
|
|
16903
|
-
(0,
|
|
16547
|
+
(0, import_firestore53.where)("isActive", "==", true)
|
|
16904
16548
|
);
|
|
16905
|
-
const snapshot = await (0,
|
|
16549
|
+
const snapshot = await (0, import_firestore53.getDocs)(q);
|
|
16906
16550
|
return snapshot.docs.map(
|
|
16907
|
-
(
|
|
16908
|
-
id:
|
|
16909
|
-
...
|
|
16551
|
+
(doc37) => ({
|
|
16552
|
+
id: doc37.id,
|
|
16553
|
+
...doc37.data()
|
|
16910
16554
|
})
|
|
16911
16555
|
);
|
|
16912
16556
|
}
|
|
@@ -16922,8 +16566,8 @@ var SubcategoryService = class extends BaseService {
|
|
|
16922
16566
|
...subcategory,
|
|
16923
16567
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16924
16568
|
};
|
|
16925
|
-
const docRef = (0,
|
|
16926
|
-
await (0,
|
|
16569
|
+
const docRef = (0, import_firestore53.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
16570
|
+
await (0, import_firestore53.updateDoc)(docRef, updateData);
|
|
16927
16571
|
return this.getById(categoryId, subcategoryId);
|
|
16928
16572
|
}
|
|
16929
16573
|
/**
|
|
@@ -16941,8 +16585,8 @@ var SubcategoryService = class extends BaseService {
|
|
|
16941
16585
|
* @returns Podkategorija ili null ako ne postoji
|
|
16942
16586
|
*/
|
|
16943
16587
|
async getById(categoryId, subcategoryId) {
|
|
16944
|
-
const docRef = (0,
|
|
16945
|
-
const docSnap = await (0,
|
|
16588
|
+
const docRef = (0, import_firestore53.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
16589
|
+
const docSnap = await (0, import_firestore53.getDoc)(docRef);
|
|
16946
16590
|
if (!docSnap.exists()) return null;
|
|
16947
16591
|
return {
|
|
16948
16592
|
id: docSnap.id,
|
|
@@ -16952,7 +16596,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
16952
16596
|
};
|
|
16953
16597
|
|
|
16954
16598
|
// src/backoffice/services/technology.service.ts
|
|
16955
|
-
var
|
|
16599
|
+
var import_firestore54 = require("firebase/firestore");
|
|
16956
16600
|
var DEFAULT_CERTIFICATION_REQUIREMENT = {
|
|
16957
16601
|
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
16958
16602
|
requiredSpecialties: []
|
|
@@ -16962,7 +16606,7 @@ var TechnologyService = class extends BaseService {
|
|
|
16962
16606
|
* Vraća referencu na Firestore kolekciju tehnologija
|
|
16963
16607
|
*/
|
|
16964
16608
|
getTechnologiesRef() {
|
|
16965
|
-
return (0,
|
|
16609
|
+
return (0, import_firestore54.collection)(this.db, TECHNOLOGIES_COLLECTION);
|
|
16966
16610
|
}
|
|
16967
16611
|
/**
|
|
16968
16612
|
* Kreira novu tehnologiju
|
|
@@ -16985,7 +16629,7 @@ var TechnologyService = class extends BaseService {
|
|
|
16985
16629
|
benefits: technology.benefits || [],
|
|
16986
16630
|
certificationRequirement: technology.certificationRequirement || DEFAULT_CERTIFICATION_REQUIREMENT
|
|
16987
16631
|
};
|
|
16988
|
-
const docRef = await (0,
|
|
16632
|
+
const docRef = await (0, import_firestore54.addDoc)(this.getTechnologiesRef(), newTechnology);
|
|
16989
16633
|
return { id: docRef.id, ...newTechnology };
|
|
16990
16634
|
}
|
|
16991
16635
|
/**
|
|
@@ -16993,12 +16637,12 @@ var TechnologyService = class extends BaseService {
|
|
|
16993
16637
|
* @returns Lista aktivnih tehnologija
|
|
16994
16638
|
*/
|
|
16995
16639
|
async getAll() {
|
|
16996
|
-
const q = (0,
|
|
16997
|
-
const snapshot = await (0,
|
|
16640
|
+
const q = (0, import_firestore54.query)(this.getTechnologiesRef(), (0, import_firestore54.where)("isActive", "==", true));
|
|
16641
|
+
const snapshot = await (0, import_firestore54.getDocs)(q);
|
|
16998
16642
|
return snapshot.docs.map(
|
|
16999
|
-
(
|
|
17000
|
-
id:
|
|
17001
|
-
...
|
|
16643
|
+
(doc37) => ({
|
|
16644
|
+
id: doc37.id,
|
|
16645
|
+
...doc37.data()
|
|
17002
16646
|
})
|
|
17003
16647
|
);
|
|
17004
16648
|
}
|
|
@@ -17008,16 +16652,16 @@ var TechnologyService = class extends BaseService {
|
|
|
17008
16652
|
* @returns Lista aktivnih tehnologija
|
|
17009
16653
|
*/
|
|
17010
16654
|
async getAllByFamily(family) {
|
|
17011
|
-
const q = (0,
|
|
16655
|
+
const q = (0, import_firestore54.query)(
|
|
17012
16656
|
this.getTechnologiesRef(),
|
|
17013
|
-
(0,
|
|
17014
|
-
(0,
|
|
16657
|
+
(0, import_firestore54.where)("isActive", "==", true),
|
|
16658
|
+
(0, import_firestore54.where)("family", "==", family)
|
|
17015
16659
|
);
|
|
17016
|
-
const snapshot = await (0,
|
|
16660
|
+
const snapshot = await (0, import_firestore54.getDocs)(q);
|
|
17017
16661
|
return snapshot.docs.map(
|
|
17018
|
-
(
|
|
17019
|
-
id:
|
|
17020
|
-
...
|
|
16662
|
+
(doc37) => ({
|
|
16663
|
+
id: doc37.id,
|
|
16664
|
+
...doc37.data()
|
|
17021
16665
|
})
|
|
17022
16666
|
);
|
|
17023
16667
|
}
|
|
@@ -17027,16 +16671,16 @@ var TechnologyService = class extends BaseService {
|
|
|
17027
16671
|
* @returns Lista aktivnih tehnologija
|
|
17028
16672
|
*/
|
|
17029
16673
|
async getAllByCategoryId(categoryId) {
|
|
17030
|
-
const q = (0,
|
|
16674
|
+
const q = (0, import_firestore54.query)(
|
|
17031
16675
|
this.getTechnologiesRef(),
|
|
17032
|
-
(0,
|
|
17033
|
-
(0,
|
|
16676
|
+
(0, import_firestore54.where)("isActive", "==", true),
|
|
16677
|
+
(0, import_firestore54.where)("categoryId", "==", categoryId)
|
|
17034
16678
|
);
|
|
17035
|
-
const snapshot = await (0,
|
|
16679
|
+
const snapshot = await (0, import_firestore54.getDocs)(q);
|
|
17036
16680
|
return snapshot.docs.map(
|
|
17037
|
-
(
|
|
17038
|
-
id:
|
|
17039
|
-
...
|
|
16681
|
+
(doc37) => ({
|
|
16682
|
+
id: doc37.id,
|
|
16683
|
+
...doc37.data()
|
|
17040
16684
|
})
|
|
17041
16685
|
);
|
|
17042
16686
|
}
|
|
@@ -17046,16 +16690,16 @@ var TechnologyService = class extends BaseService {
|
|
|
17046
16690
|
* @returns Lista aktivnih tehnologija
|
|
17047
16691
|
*/
|
|
17048
16692
|
async getAllBySubcategoryId(subcategoryId) {
|
|
17049
|
-
const q = (0,
|
|
16693
|
+
const q = (0, import_firestore54.query)(
|
|
17050
16694
|
this.getTechnologiesRef(),
|
|
17051
|
-
(0,
|
|
17052
|
-
(0,
|
|
16695
|
+
(0, import_firestore54.where)("isActive", "==", true),
|
|
16696
|
+
(0, import_firestore54.where)("subcategoryId", "==", subcategoryId)
|
|
17053
16697
|
);
|
|
17054
|
-
const snapshot = await (0,
|
|
16698
|
+
const snapshot = await (0, import_firestore54.getDocs)(q);
|
|
17055
16699
|
return snapshot.docs.map(
|
|
17056
|
-
(
|
|
17057
|
-
id:
|
|
17058
|
-
...
|
|
16700
|
+
(doc37) => ({
|
|
16701
|
+
id: doc37.id,
|
|
16702
|
+
...doc37.data()
|
|
17059
16703
|
})
|
|
17060
16704
|
);
|
|
17061
16705
|
}
|
|
@@ -17070,8 +16714,8 @@ var TechnologyService = class extends BaseService {
|
|
|
17070
16714
|
...technology,
|
|
17071
16715
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17072
16716
|
};
|
|
17073
|
-
const docRef = (0,
|
|
17074
|
-
await (0,
|
|
16717
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16718
|
+
await (0, import_firestore54.updateDoc)(docRef, updateData);
|
|
17075
16719
|
return this.getById(technologyId);
|
|
17076
16720
|
}
|
|
17077
16721
|
/**
|
|
@@ -17089,8 +16733,8 @@ var TechnologyService = class extends BaseService {
|
|
|
17089
16733
|
* @returns Tehnologija ili null ako ne postoji
|
|
17090
16734
|
*/
|
|
17091
16735
|
async getById(technologyId) {
|
|
17092
|
-
const docRef = (0,
|
|
17093
|
-
const docSnap = await (0,
|
|
16736
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16737
|
+
const docSnap = await (0, import_firestore54.getDoc)(docRef);
|
|
17094
16738
|
if (!docSnap.exists()) return null;
|
|
17095
16739
|
return {
|
|
17096
16740
|
id: docSnap.id,
|
|
@@ -17104,10 +16748,10 @@ var TechnologyService = class extends BaseService {
|
|
|
17104
16748
|
* @returns Ažurirana tehnologija sa novim zahtevom
|
|
17105
16749
|
*/
|
|
17106
16750
|
async addRequirement(technologyId, requirement) {
|
|
17107
|
-
const docRef = (0,
|
|
16751
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
17108
16752
|
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
17109
|
-
await (0,
|
|
17110
|
-
[requirementType]: (0,
|
|
16753
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16754
|
+
[requirementType]: (0, import_firestore54.arrayUnion)(requirement),
|
|
17111
16755
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17112
16756
|
});
|
|
17113
16757
|
return this.getById(technologyId);
|
|
@@ -17119,10 +16763,10 @@ var TechnologyService = class extends BaseService {
|
|
|
17119
16763
|
* @returns Ažurirana tehnologija bez uklonjenog zahteva
|
|
17120
16764
|
*/
|
|
17121
16765
|
async removeRequirement(technologyId, requirement) {
|
|
17122
|
-
const docRef = (0,
|
|
16766
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
17123
16767
|
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
17124
|
-
await (0,
|
|
17125
|
-
[requirementType]: (0,
|
|
16768
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16769
|
+
[requirementType]: (0, import_firestore54.arrayRemove)(requirement),
|
|
17126
16770
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17127
16771
|
});
|
|
17128
16772
|
return this.getById(technologyId);
|
|
@@ -17159,9 +16803,9 @@ var TechnologyService = class extends BaseService {
|
|
|
17159
16803
|
* @returns Ažurirana tehnologija
|
|
17160
16804
|
*/
|
|
17161
16805
|
async addBlockingCondition(technologyId, condition) {
|
|
17162
|
-
const docRef = (0,
|
|
17163
|
-
await (0,
|
|
17164
|
-
blockingConditions: (0,
|
|
16806
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16807
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16808
|
+
blockingConditions: (0, import_firestore54.arrayUnion)(condition),
|
|
17165
16809
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17166
16810
|
});
|
|
17167
16811
|
return this.getById(technologyId);
|
|
@@ -17173,9 +16817,9 @@ var TechnologyService = class extends BaseService {
|
|
|
17173
16817
|
* @returns Ažurirana tehnologija
|
|
17174
16818
|
*/
|
|
17175
16819
|
async removeBlockingCondition(technologyId, condition) {
|
|
17176
|
-
const docRef = (0,
|
|
17177
|
-
await (0,
|
|
17178
|
-
blockingConditions: (0,
|
|
16820
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16821
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16822
|
+
blockingConditions: (0, import_firestore54.arrayRemove)(condition),
|
|
17179
16823
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17180
16824
|
});
|
|
17181
16825
|
return this.getById(technologyId);
|
|
@@ -17187,9 +16831,9 @@ var TechnologyService = class extends BaseService {
|
|
|
17187
16831
|
* @returns Ažurirana tehnologija
|
|
17188
16832
|
*/
|
|
17189
16833
|
async addContraindication(technologyId, contraindication) {
|
|
17190
|
-
const docRef = (0,
|
|
17191
|
-
await (0,
|
|
17192
|
-
contraindications: (0,
|
|
16834
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16835
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16836
|
+
contraindications: (0, import_firestore54.arrayUnion)(contraindication),
|
|
17193
16837
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17194
16838
|
});
|
|
17195
16839
|
return this.getById(technologyId);
|
|
@@ -17201,9 +16845,9 @@ var TechnologyService = class extends BaseService {
|
|
|
17201
16845
|
* @returns Ažurirana tehnologija
|
|
17202
16846
|
*/
|
|
17203
16847
|
async removeContraindication(technologyId, contraindication) {
|
|
17204
|
-
const docRef = (0,
|
|
17205
|
-
await (0,
|
|
17206
|
-
contraindications: (0,
|
|
16848
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16849
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16850
|
+
contraindications: (0, import_firestore54.arrayRemove)(contraindication),
|
|
17207
16851
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17208
16852
|
});
|
|
17209
16853
|
return this.getById(technologyId);
|
|
@@ -17215,9 +16859,9 @@ var TechnologyService = class extends BaseService {
|
|
|
17215
16859
|
* @returns Ažurirana tehnologija
|
|
17216
16860
|
*/
|
|
17217
16861
|
async addBenefit(technologyId, benefit) {
|
|
17218
|
-
const docRef = (0,
|
|
17219
|
-
await (0,
|
|
17220
|
-
benefits: (0,
|
|
16862
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16863
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16864
|
+
benefits: (0, import_firestore54.arrayUnion)(benefit),
|
|
17221
16865
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17222
16866
|
});
|
|
17223
16867
|
return this.getById(technologyId);
|
|
@@ -17229,9 +16873,9 @@ var TechnologyService = class extends BaseService {
|
|
|
17229
16873
|
* @returns Ažurirana tehnologija
|
|
17230
16874
|
*/
|
|
17231
16875
|
async removeBenefit(technologyId, benefit) {
|
|
17232
|
-
const docRef = (0,
|
|
17233
|
-
await (0,
|
|
17234
|
-
benefits: (0,
|
|
16876
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16877
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
16878
|
+
benefits: (0, import_firestore54.arrayRemove)(benefit),
|
|
17235
16879
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17236
16880
|
});
|
|
17237
16881
|
return this.getById(technologyId);
|
|
@@ -17270,8 +16914,8 @@ var TechnologyService = class extends BaseService {
|
|
|
17270
16914
|
* @returns Ažurirana tehnologija
|
|
17271
16915
|
*/
|
|
17272
16916
|
async updateCertificationRequirement(technologyId, certificationRequirement) {
|
|
17273
|
-
const docRef = (0,
|
|
17274
|
-
await (0,
|
|
16917
|
+
const docRef = (0, import_firestore54.doc)(this.getTechnologiesRef(), technologyId);
|
|
16918
|
+
await (0, import_firestore54.updateDoc)(docRef, {
|
|
17275
16919
|
certificationRequirement,
|
|
17276
16920
|
updatedAt: /* @__PURE__ */ new Date()
|
|
17277
16921
|
});
|
|
@@ -17370,149 +17014,118 @@ var TechnologyService = class extends BaseService {
|
|
|
17370
17014
|
}
|
|
17371
17015
|
};
|
|
17372
17016
|
|
|
17373
|
-
// src/backoffice/
|
|
17374
|
-
var
|
|
17375
|
-
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
17376
|
-
requiredSpecialties: []
|
|
17377
|
-
};
|
|
17017
|
+
// src/backoffice/services/product.service.ts
|
|
17018
|
+
var import_firestore55 = require("firebase/firestore");
|
|
17378
17019
|
|
|
17379
|
-
// src/backoffice/
|
|
17380
|
-
var
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
17384
|
-
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
|
|
17395
|
-
|
|
17396
|
-
}
|
|
17397
|
-
};
|
|
17398
|
-
var InvalidCategoryDataError = class extends CategoryError {
|
|
17399
|
-
constructor(message) {
|
|
17400
|
-
super(`Neva\u017Ee\u0107i podaci za kategoriju: ${message}`);
|
|
17401
|
-
this.name = "InvalidCategoryDataError";
|
|
17402
|
-
}
|
|
17403
|
-
};
|
|
17404
|
-
var SubcategoryError = class extends BackofficeError {
|
|
17405
|
-
constructor(message) {
|
|
17406
|
-
super(message);
|
|
17407
|
-
this.name = "SubcategoryError";
|
|
17408
|
-
}
|
|
17409
|
-
};
|
|
17410
|
-
var SubcategoryNotFoundError = class extends SubcategoryError {
|
|
17411
|
-
constructor(id) {
|
|
17412
|
-
super(`Podkategorija sa ID-em ${id} nije prona\u0111ena`);
|
|
17413
|
-
this.name = "SubcategoryNotFoundError";
|
|
17414
|
-
}
|
|
17415
|
-
};
|
|
17416
|
-
var InvalidSubcategoryDataError = class extends SubcategoryError {
|
|
17417
|
-
constructor(message) {
|
|
17418
|
-
super(`Neva\u017Ee\u0107i podaci za podkategoriju: ${message}`);
|
|
17419
|
-
this.name = "InvalidSubcategoryDataError";
|
|
17420
|
-
}
|
|
17421
|
-
};
|
|
17422
|
-
var TechnologyError = class extends BackofficeError {
|
|
17423
|
-
constructor(message) {
|
|
17424
|
-
super(message);
|
|
17425
|
-
this.name = "TechnologyError";
|
|
17426
|
-
}
|
|
17427
|
-
};
|
|
17428
|
-
var TechnologyNotFoundError = class extends TechnologyError {
|
|
17429
|
-
constructor(id) {
|
|
17430
|
-
super(`Tehnologija sa ID-em ${id} nije prona\u0111ena`);
|
|
17431
|
-
this.name = "TechnologyNotFoundError";
|
|
17432
|
-
}
|
|
17433
|
-
};
|
|
17434
|
-
var InvalidTechnologyDataError = class extends TechnologyError {
|
|
17435
|
-
constructor(message) {
|
|
17436
|
-
super(`Neva\u017Ee\u0107i podaci za tehnologiju: ${message}`);
|
|
17437
|
-
this.name = "InvalidTechnologyDataError";
|
|
17438
|
-
}
|
|
17439
|
-
};
|
|
17440
|
-
var RequirementError = class extends BackofficeError {
|
|
17441
|
-
constructor(message) {
|
|
17442
|
-
super(message);
|
|
17443
|
-
this.name = "RequirementError";
|
|
17444
|
-
}
|
|
17445
|
-
};
|
|
17446
|
-
var RequirementNotFoundError = class extends RequirementError {
|
|
17447
|
-
constructor(id) {
|
|
17448
|
-
super(`Zahtev sa ID-em ${id} nije prona\u0111en`);
|
|
17449
|
-
this.name = "RequirementNotFoundError";
|
|
17450
|
-
}
|
|
17451
|
-
};
|
|
17452
|
-
var InvalidRequirementDataError = class extends RequirementError {
|
|
17453
|
-
constructor(message) {
|
|
17454
|
-
super(`Neva\u017Ee\u0107i podaci za zahtev: ${message}`);
|
|
17455
|
-
this.name = "InvalidRequirementDataError";
|
|
17456
|
-
}
|
|
17457
|
-
};
|
|
17458
|
-
var InvalidTimeframeError = class extends RequirementError {
|
|
17459
|
-
constructor(message) {
|
|
17460
|
-
super(`Invalid timeframe: ${message}`);
|
|
17461
|
-
this.name = "InvalidTimeframeError";
|
|
17462
|
-
}
|
|
17463
|
-
};
|
|
17464
|
-
var RelationshipError = class extends BackofficeError {
|
|
17465
|
-
constructor(message) {
|
|
17466
|
-
super(message);
|
|
17467
|
-
this.name = "RelationshipError";
|
|
17468
|
-
}
|
|
17469
|
-
};
|
|
17470
|
-
var InvalidHierarchyError = class extends RelationshipError {
|
|
17471
|
-
constructor(message) {
|
|
17472
|
-
super(`Invalid hierarchy: ${message}`);
|
|
17473
|
-
this.name = "InvalidHierarchyError";
|
|
17474
|
-
}
|
|
17475
|
-
};
|
|
17476
|
-
var CircularReferenceError = class extends RelationshipError {
|
|
17477
|
-
constructor(message) {
|
|
17478
|
-
super(`Circular reference detected: ${message}`);
|
|
17479
|
-
this.name = "CircularReferenceError";
|
|
17020
|
+
// src/backoffice/types/product.types.ts
|
|
17021
|
+
var PRODUCTS_COLLECTION = "products";
|
|
17022
|
+
|
|
17023
|
+
// src/backoffice/services/product.service.ts
|
|
17024
|
+
var ProductService = class extends BaseService {
|
|
17025
|
+
/**
|
|
17026
|
+
* Gets reference to products collection under a technology
|
|
17027
|
+
* @param technologyId - ID of the technology
|
|
17028
|
+
* @returns Firestore collection reference
|
|
17029
|
+
*/
|
|
17030
|
+
getProductsRef(technologyId) {
|
|
17031
|
+
return (0, import_firestore55.collection)(
|
|
17032
|
+
this.db,
|
|
17033
|
+
TECHNOLOGIES_COLLECTION,
|
|
17034
|
+
technologyId,
|
|
17035
|
+
PRODUCTS_COLLECTION
|
|
17036
|
+
);
|
|
17480
17037
|
}
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17038
|
+
/**
|
|
17039
|
+
* Creates a new product under technology
|
|
17040
|
+
*/
|
|
17041
|
+
async create(technologyId, brandId, product) {
|
|
17042
|
+
const now = /* @__PURE__ */ new Date();
|
|
17043
|
+
const newProduct = {
|
|
17044
|
+
...product,
|
|
17045
|
+
brandId,
|
|
17046
|
+
technologyId,
|
|
17047
|
+
createdAt: now,
|
|
17048
|
+
updatedAt: now,
|
|
17049
|
+
isActive: true
|
|
17050
|
+
};
|
|
17051
|
+
const productRef = await (0, import_firestore55.addDoc)(
|
|
17052
|
+
this.getProductsRef(technologyId),
|
|
17053
|
+
newProduct
|
|
17054
|
+
);
|
|
17055
|
+
return { id: productRef.id, ...newProduct };
|
|
17486
17056
|
}
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17057
|
+
/**
|
|
17058
|
+
* Gets all products for a technology
|
|
17059
|
+
*/
|
|
17060
|
+
async getAllByTechnology(technologyId) {
|
|
17061
|
+
const q = (0, import_firestore55.query)(
|
|
17062
|
+
this.getProductsRef(technologyId),
|
|
17063
|
+
(0, import_firestore55.where)("isActive", "==", true)
|
|
17064
|
+
);
|
|
17065
|
+
const snapshot = await (0, import_firestore55.getDocs)(q);
|
|
17066
|
+
return snapshot.docs.map(
|
|
17067
|
+
(doc37) => ({
|
|
17068
|
+
id: doc37.id,
|
|
17069
|
+
...doc37.data()
|
|
17070
|
+
})
|
|
17071
|
+
);
|
|
17492
17072
|
}
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
this.
|
|
17073
|
+
/**
|
|
17074
|
+
* Gets all products for a brand by filtering through all technologies
|
|
17075
|
+
*/
|
|
17076
|
+
async getAllByBrand(brandId) {
|
|
17077
|
+
const allTechnologiesRef = (0, import_firestore55.collection)(this.db, TECHNOLOGIES_COLLECTION);
|
|
17078
|
+
const technologiesSnapshot = await (0, import_firestore55.getDocs)(allTechnologiesRef);
|
|
17079
|
+
const products = [];
|
|
17080
|
+
for (const techDoc of technologiesSnapshot.docs) {
|
|
17081
|
+
const q = (0, import_firestore55.query)(
|
|
17082
|
+
this.getProductsRef(techDoc.id),
|
|
17083
|
+
(0, import_firestore55.where)("brandId", "==", brandId),
|
|
17084
|
+
(0, import_firestore55.where)("isActive", "==", true)
|
|
17085
|
+
);
|
|
17086
|
+
const snapshot = await (0, import_firestore55.getDocs)(q);
|
|
17087
|
+
products.push(
|
|
17088
|
+
...snapshot.docs.map(
|
|
17089
|
+
(doc37) => ({
|
|
17090
|
+
id: doc37.id,
|
|
17091
|
+
...doc37.data()
|
|
17092
|
+
})
|
|
17093
|
+
)
|
|
17094
|
+
);
|
|
17095
|
+
}
|
|
17096
|
+
return products;
|
|
17498
17097
|
}
|
|
17499
|
-
|
|
17500
|
-
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17098
|
+
/**
|
|
17099
|
+
* Updates a product
|
|
17100
|
+
*/
|
|
17101
|
+
async update(technologyId, productId, product) {
|
|
17102
|
+
const updateData = {
|
|
17103
|
+
...product,
|
|
17104
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17105
|
+
};
|
|
17106
|
+
const docRef = (0, import_firestore55.doc)(this.getProductsRef(technologyId), productId);
|
|
17107
|
+
await (0, import_firestore55.updateDoc)(docRef, updateData);
|
|
17108
|
+
return this.getById(technologyId, productId);
|
|
17504
17109
|
}
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
this.
|
|
17110
|
+
/**
|
|
17111
|
+
* Soft deletes a product
|
|
17112
|
+
*/
|
|
17113
|
+
async delete(technologyId, productId) {
|
|
17114
|
+
await this.update(technologyId, productId, {
|
|
17115
|
+
isActive: false
|
|
17116
|
+
});
|
|
17510
17117
|
}
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
|
|
17515
|
-
this.
|
|
17118
|
+
/**
|
|
17119
|
+
* Gets a product by ID
|
|
17120
|
+
*/
|
|
17121
|
+
async getById(technologyId, productId) {
|
|
17122
|
+
const docRef = (0, import_firestore55.doc)(this.getProductsRef(technologyId), productId);
|
|
17123
|
+
const docSnap = await (0, import_firestore55.getDoc)(docRef);
|
|
17124
|
+
if (!docSnap.exists()) return null;
|
|
17125
|
+
return {
|
|
17126
|
+
id: docSnap.id,
|
|
17127
|
+
...docSnap.data()
|
|
17128
|
+
};
|
|
17516
17129
|
}
|
|
17517
17130
|
};
|
|
17518
17131
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -17523,14 +17136,10 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17523
17136
|
AppointmentService,
|
|
17524
17137
|
AppointmentStatus,
|
|
17525
17138
|
AuthService,
|
|
17526
|
-
BRANDS_COLLECTION,
|
|
17527
|
-
BackofficeError,
|
|
17528
17139
|
BaseService,
|
|
17529
17140
|
BlockingCondition,
|
|
17530
|
-
BlockingConditionError,
|
|
17531
17141
|
BrandService,
|
|
17532
17142
|
CALENDAR_COLLECTION,
|
|
17533
|
-
CATEGORIES_COLLECTION,
|
|
17534
17143
|
CLINICS_COLLECTION,
|
|
17535
17144
|
CLINIC_ADMINS_COLLECTION,
|
|
17536
17145
|
CLINIC_GROUPS_COLLECTION,
|
|
@@ -17539,28 +17148,22 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17539
17148
|
CalendarServiceV2,
|
|
17540
17149
|
CalendarServiceV3,
|
|
17541
17150
|
CalendarSyncStatus,
|
|
17542
|
-
CategoryError,
|
|
17543
|
-
CategoryNotFoundError,
|
|
17544
17151
|
CategoryService,
|
|
17545
17152
|
CertificationLevel,
|
|
17546
17153
|
CertificationSpecialty,
|
|
17547
|
-
CircularReferenceError,
|
|
17548
17154
|
ClinicAdminService,
|
|
17549
17155
|
ClinicGroupService,
|
|
17550
17156
|
ClinicPhotoTag,
|
|
17551
17157
|
ClinicService,
|
|
17552
17158
|
ClinicTag,
|
|
17553
17159
|
Contraindication,
|
|
17554
|
-
ContraindicationError,
|
|
17555
17160
|
CosmeticAllergySubtype,
|
|
17556
17161
|
Currency,
|
|
17557
|
-
DEFAULT_CERTIFICATION_REQUIREMENT,
|
|
17558
17162
|
DEFAULT_MEDICAL_INFO,
|
|
17559
17163
|
DOCTOR_FORMS_SUBCOLLECTION,
|
|
17560
17164
|
DOCUMENTATION_TEMPLATES_COLLECTION,
|
|
17561
17165
|
DocumentElementType,
|
|
17562
17166
|
DocumentationTemplateService,
|
|
17563
|
-
DocumentationTemplateServiceBackoffice,
|
|
17564
17167
|
DynamicVariable,
|
|
17565
17168
|
EnvironmentalAllergySubtype,
|
|
17566
17169
|
ExternalCalendarService,
|
|
@@ -17571,15 +17174,6 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17571
17174
|
Gender,
|
|
17572
17175
|
HeadingLevel,
|
|
17573
17176
|
INVITE_TOKENS_COLLECTION,
|
|
17574
|
-
InvalidBlockingConditionError,
|
|
17575
|
-
InvalidCategoryDataError,
|
|
17576
|
-
InvalidContraindicationError,
|
|
17577
|
-
InvalidHierarchyError,
|
|
17578
|
-
InvalidRequirementDataError,
|
|
17579
|
-
InvalidSubcategoryDataError,
|
|
17580
|
-
InvalidTechnologyDataError,
|
|
17581
|
-
InvalidTimeframeError,
|
|
17582
|
-
InvalidTreatmentBenefitError,
|
|
17583
17177
|
Language,
|
|
17584
17178
|
ListType,
|
|
17585
17179
|
MEDIA_METADATA_COLLECTION,
|
|
@@ -17601,7 +17195,6 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17601
17195
|
PRACTITIONERS_COLLECTION,
|
|
17602
17196
|
PRACTITIONER_INVITES_COLLECTION,
|
|
17603
17197
|
PROCEDURES_COLLECTION,
|
|
17604
|
-
PRODUCTS_COLLECTION,
|
|
17605
17198
|
PatientInstructionStatus,
|
|
17606
17199
|
PatientRequirementOverallStatus,
|
|
17607
17200
|
PatientRequirementsService,
|
|
@@ -17619,30 +17212,18 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17619
17212
|
ProcedureService,
|
|
17620
17213
|
ProductService,
|
|
17621
17214
|
REGISTER_TOKENS_COLLECTION,
|
|
17622
|
-
REQUIREMENTS_COLLECTION,
|
|
17623
17215
|
REVIEWS_COLLECTION,
|
|
17624
|
-
RelationshipError,
|
|
17625
|
-
RequirementError,
|
|
17626
|
-
RequirementNotFoundError,
|
|
17627
|
-
RequirementService,
|
|
17628
17216
|
RequirementType,
|
|
17629
17217
|
ReviewService,
|
|
17630
|
-
SUBCATEGORIES_COLLECTION,
|
|
17631
17218
|
SYNCED_CALENDARS_COLLECTION,
|
|
17632
17219
|
SearchLocationEnum,
|
|
17633
|
-
SubcategoryError,
|
|
17634
|
-
SubcategoryNotFoundError,
|
|
17635
17220
|
SubcategoryService,
|
|
17636
17221
|
SubscriptionModel,
|
|
17637
17222
|
SyncedCalendarProvider,
|
|
17638
|
-
TECHNOLOGIES_COLLECTION,
|
|
17639
|
-
TechnologyError,
|
|
17640
|
-
TechnologyNotFoundError,
|
|
17641
17223
|
TechnologyService,
|
|
17642
17224
|
TimeUnit,
|
|
17643
17225
|
TimestampUtils,
|
|
17644
17226
|
TreatmentBenefit,
|
|
17645
|
-
TreatmentBenefitError,
|
|
17646
17227
|
USERS_COLLECTION,
|
|
17647
17228
|
USER_FORMS_SUBCOLLECTION,
|
|
17648
17229
|
UserRole,
|
|
@@ -17665,15 +17246,9 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17665
17246
|
beforeAfterPerZoneSchema,
|
|
17666
17247
|
billingPerZoneSchema,
|
|
17667
17248
|
blockingConditionSchema,
|
|
17668
|
-
blockingConditionSchemaBackoffice,
|
|
17669
17249
|
buildPractitionerData,
|
|
17670
17250
|
calendarEventSchema,
|
|
17671
17251
|
calendarEventTimeSchema,
|
|
17672
|
-
categorySchema,
|
|
17673
|
-
categoryUpdateSchema,
|
|
17674
|
-
certificationLevelSchema,
|
|
17675
|
-
certificationRequirementSchema,
|
|
17676
|
-
certificationSpecialtySchema,
|
|
17677
17252
|
checkEmailExists,
|
|
17678
17253
|
cleanupFirebaseUser,
|
|
17679
17254
|
clinicAdminOptionsSchema,
|
|
@@ -17692,7 +17267,6 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17692
17267
|
clinicTagsSchema,
|
|
17693
17268
|
contactPersonSchema,
|
|
17694
17269
|
contraindicationSchema,
|
|
17695
|
-
contraindicationSchemaBackoffice,
|
|
17696
17270
|
createAdminTokenSchema,
|
|
17697
17271
|
createAppointmentSchema,
|
|
17698
17272
|
createBlockingEventSchema,
|
|
@@ -17775,7 +17349,6 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17775
17349
|
preRequirementNotificationSchema,
|
|
17776
17350
|
procedureCategorizationSchema,
|
|
17777
17351
|
procedureExtendedInfoSchema,
|
|
17778
|
-
procedureFamilySchemaBackoffice,
|
|
17779
17352
|
procedureInfoSchema,
|
|
17780
17353
|
procedureReviewInfoSchema,
|
|
17781
17354
|
procedureReviewSchema,
|
|
@@ -17784,26 +17357,15 @@ var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
|
17784
17357
|
requesterInfoSchema,
|
|
17785
17358
|
requirementImportanceSchema,
|
|
17786
17359
|
requirementInstructionDueNotificationSchema,
|
|
17787
|
-
requirementSchema,
|
|
17788
|
-
requirementTypeSchema,
|
|
17789
|
-
requirementUpdateSchema,
|
|
17790
17360
|
rescheduleAppointmentSchema,
|
|
17791
17361
|
reviewSchema,
|
|
17792
17362
|
searchAppointmentsSchema,
|
|
17793
17363
|
searchPatientsSchema,
|
|
17794
17364
|
sharedClinicContactInfoSchema,
|
|
17795
17365
|
sharedClinicLocationSchema,
|
|
17796
|
-
subcategorySchema,
|
|
17797
|
-
subcategoryUpdateSchema,
|
|
17798
17366
|
syncedCalendarEventSchema,
|
|
17799
|
-
technologyRequirementsSchema,
|
|
17800
|
-
technologySchema,
|
|
17801
|
-
technologyUpdateSchema,
|
|
17802
17367
|
timeSlotSchema,
|
|
17803
|
-
timeUnitSchemaBackoffice,
|
|
17804
|
-
timeframeSchema,
|
|
17805
17368
|
timestampSchema,
|
|
17806
|
-
treatmentBenefitSchemaBackoffice,
|
|
17807
17369
|
updateAllergySchema,
|
|
17808
17370
|
updateAppointmentSchema,
|
|
17809
17371
|
updateBlockingConditionSchema,
|