@blackcode_sa/metaestetics-api 1.8.3 → 1.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backoffice/index.d.mts +33 -1
- package/dist/backoffice/index.d.ts +33 -1
- package/dist/backoffice/index.js +40 -0
- package/dist/backoffice/index.mjs +30 -0
- package/dist/index.d.mts +2515 -1
- package/dist/index.d.ts +2515 -1
- package/dist/index.js +1409 -128
- package/dist/index.mjs +1399 -128
- package/package.json +1 -1
- package/src/backoffice/types/README.md +12 -0
- package/src/backoffice/types/index.ts +8 -33
- package/src/backoffice/types/static/README.md +18 -0
- package/src/backoffice/types/static/index.ts +6 -0
- package/src/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -36,8 +36,14 @@ __export(index_exports, {
|
|
|
36
36
|
AppointmentService: () => AppointmentService,
|
|
37
37
|
AppointmentStatus: () => AppointmentStatus,
|
|
38
38
|
AuthService: () => AuthService,
|
|
39
|
+
BRANDS_COLLECTION: () => BRANDS_COLLECTION,
|
|
40
|
+
BackofficeError: () => BackofficeError,
|
|
39
41
|
BaseService: () => BaseService,
|
|
42
|
+
BlockingCondition: () => BlockingCondition,
|
|
43
|
+
BlockingConditionError: () => BlockingConditionError,
|
|
44
|
+
BrandService: () => BrandService,
|
|
40
45
|
CALENDAR_COLLECTION: () => CALENDAR_COLLECTION,
|
|
46
|
+
CATEGORIES_COLLECTION: () => CATEGORIES_COLLECTION,
|
|
41
47
|
CLINICS_COLLECTION: () => CLINICS_COLLECTION,
|
|
42
48
|
CLINIC_ADMINS_COLLECTION: () => CLINIC_ADMINS_COLLECTION,
|
|
43
49
|
CLINIC_GROUPS_COLLECTION: () => CLINIC_GROUPS_COLLECTION,
|
|
@@ -46,17 +52,28 @@ __export(index_exports, {
|
|
|
46
52
|
CalendarServiceV2: () => CalendarServiceV2,
|
|
47
53
|
CalendarServiceV3: () => CalendarServiceV3,
|
|
48
54
|
CalendarSyncStatus: () => CalendarSyncStatus,
|
|
55
|
+
CategoryError: () => CategoryError,
|
|
56
|
+
CategoryNotFoundError: () => CategoryNotFoundError,
|
|
57
|
+
CategoryService: () => CategoryService,
|
|
58
|
+
CertificationLevel: () => CertificationLevel,
|
|
59
|
+
CertificationSpecialty: () => CertificationSpecialty,
|
|
60
|
+
CircularReferenceError: () => CircularReferenceError,
|
|
49
61
|
ClinicAdminService: () => ClinicAdminService,
|
|
50
62
|
ClinicGroupService: () => ClinicGroupService,
|
|
51
63
|
ClinicPhotoTag: () => ClinicPhotoTag,
|
|
52
64
|
ClinicService: () => ClinicService,
|
|
53
65
|
ClinicTag: () => ClinicTag,
|
|
66
|
+
Contraindication: () => Contraindication,
|
|
67
|
+
ContraindicationError: () => ContraindicationError,
|
|
54
68
|
CosmeticAllergySubtype: () => CosmeticAllergySubtype,
|
|
69
|
+
Currency: () => Currency,
|
|
70
|
+
DEFAULT_CERTIFICATION_REQUIREMENT: () => DEFAULT_CERTIFICATION_REQUIREMENT2,
|
|
55
71
|
DEFAULT_MEDICAL_INFO: () => DEFAULT_MEDICAL_INFO,
|
|
56
72
|
DOCTOR_FORMS_SUBCOLLECTION: () => DOCTOR_FORMS_SUBCOLLECTION,
|
|
57
73
|
DOCUMENTATION_TEMPLATES_COLLECTION: () => DOCUMENTATION_TEMPLATES_COLLECTION,
|
|
58
74
|
DocumentElementType: () => DocumentElementType,
|
|
59
75
|
DocumentationTemplateService: () => DocumentationTemplateService,
|
|
76
|
+
DocumentationTemplateServiceBackoffice: () => DocumentationTemplateServiceBackoffice,
|
|
60
77
|
DynamicVariable: () => DynamicVariable,
|
|
61
78
|
EnvironmentalAllergySubtype: () => EnvironmentalAllergySubtype,
|
|
62
79
|
ExternalCalendarService: () => ExternalCalendarService,
|
|
@@ -67,6 +84,15 @@ __export(index_exports, {
|
|
|
67
84
|
Gender: () => Gender,
|
|
68
85
|
HeadingLevel: () => HeadingLevel,
|
|
69
86
|
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,
|
|
70
96
|
Language: () => Language,
|
|
71
97
|
ListType: () => ListType,
|
|
72
98
|
MEDIA_METADATA_COLLECTION: () => MEDIA_METADATA_COLLECTION,
|
|
@@ -88,6 +114,7 @@ __export(index_exports, {
|
|
|
88
114
|
PRACTITIONERS_COLLECTION: () => PRACTITIONERS_COLLECTION,
|
|
89
115
|
PRACTITIONER_INVITES_COLLECTION: () => PRACTITIONER_INVITES_COLLECTION,
|
|
90
116
|
PROCEDURES_COLLECTION: () => PROCEDURES_COLLECTION,
|
|
117
|
+
PRODUCTS_COLLECTION: () => PRODUCTS_COLLECTION,
|
|
91
118
|
PatientInstructionStatus: () => PatientInstructionStatus,
|
|
92
119
|
PatientRequirementOverallStatus: () => PatientRequirementOverallStatus,
|
|
93
120
|
PatientRequirementsService: () => PatientRequirementsService,
|
|
@@ -100,15 +127,35 @@ __export(index_exports, {
|
|
|
100
127
|
PractitionerService: () => PractitionerService,
|
|
101
128
|
PractitionerStatus: () => PractitionerStatus,
|
|
102
129
|
PractitionerTokenStatus: () => PractitionerTokenStatus,
|
|
130
|
+
PricingMeasure: () => PricingMeasure,
|
|
131
|
+
ProcedureFamily: () => ProcedureFamily,
|
|
103
132
|
ProcedureService: () => ProcedureService,
|
|
133
|
+
ProductService: () => ProductService,
|
|
104
134
|
REGISTER_TOKENS_COLLECTION: () => REGISTER_TOKENS_COLLECTION,
|
|
135
|
+
REQUIREMENTS_COLLECTION: () => REQUIREMENTS_COLLECTION,
|
|
105
136
|
REVIEWS_COLLECTION: () => REVIEWS_COLLECTION,
|
|
137
|
+
RelationshipError: () => RelationshipError,
|
|
138
|
+
RequirementError: () => RequirementError,
|
|
139
|
+
RequirementNotFoundError: () => RequirementNotFoundError,
|
|
140
|
+
RequirementService: () => RequirementService,
|
|
141
|
+
RequirementType: () => RequirementType,
|
|
106
142
|
ReviewService: () => ReviewService,
|
|
143
|
+
SUBCATEGORIES_COLLECTION: () => SUBCATEGORIES_COLLECTION,
|
|
107
144
|
SYNCED_CALENDARS_COLLECTION: () => SYNCED_CALENDARS_COLLECTION,
|
|
108
145
|
SearchLocationEnum: () => SearchLocationEnum,
|
|
146
|
+
SubcategoryError: () => SubcategoryError,
|
|
147
|
+
SubcategoryNotFoundError: () => SubcategoryNotFoundError,
|
|
148
|
+
SubcategoryService: () => SubcategoryService,
|
|
109
149
|
SubscriptionModel: () => SubscriptionModel,
|
|
110
150
|
SyncedCalendarProvider: () => SyncedCalendarProvider,
|
|
151
|
+
TECHNOLOGIES_COLLECTION: () => TECHNOLOGIES_COLLECTION,
|
|
152
|
+
TechnologyError: () => TechnologyError,
|
|
153
|
+
TechnologyNotFoundError: () => TechnologyNotFoundError,
|
|
154
|
+
TechnologyService: () => TechnologyService,
|
|
155
|
+
TimeUnit: () => TimeUnit,
|
|
111
156
|
TimestampUtils: () => TimestampUtils,
|
|
157
|
+
TreatmentBenefit: () => TreatmentBenefit,
|
|
158
|
+
TreatmentBenefitError: () => TreatmentBenefitError,
|
|
112
159
|
USERS_COLLECTION: () => USERS_COLLECTION,
|
|
113
160
|
USER_FORMS_SUBCOLLECTION: () => USER_FORMS_SUBCOLLECTION,
|
|
114
161
|
UserRole: () => UserRole,
|
|
@@ -131,9 +178,15 @@ __export(index_exports, {
|
|
|
131
178
|
beforeAfterPerZoneSchema: () => beforeAfterPerZoneSchema,
|
|
132
179
|
billingPerZoneSchema: () => billingPerZoneSchema,
|
|
133
180
|
blockingConditionSchema: () => blockingConditionSchema,
|
|
181
|
+
blockingConditionSchemaBackoffice: () => blockingConditionSchemaBackoffice,
|
|
134
182
|
buildPractitionerData: () => buildPractitionerData,
|
|
135
183
|
calendarEventSchema: () => calendarEventSchema,
|
|
136
184
|
calendarEventTimeSchema: () => calendarEventTimeSchema,
|
|
185
|
+
categorySchema: () => categorySchema,
|
|
186
|
+
categoryUpdateSchema: () => categoryUpdateSchema,
|
|
187
|
+
certificationLevelSchema: () => certificationLevelSchema,
|
|
188
|
+
certificationRequirementSchema: () => certificationRequirementSchema,
|
|
189
|
+
certificationSpecialtySchema: () => certificationSpecialtySchema,
|
|
137
190
|
checkEmailExists: () => checkEmailExists,
|
|
138
191
|
cleanupFirebaseUser: () => cleanupFirebaseUser,
|
|
139
192
|
clinicAdminOptionsSchema: () => clinicAdminOptionsSchema,
|
|
@@ -152,6 +205,7 @@ __export(index_exports, {
|
|
|
152
205
|
clinicTagsSchema: () => clinicTagsSchema,
|
|
153
206
|
contactPersonSchema: () => contactPersonSchema,
|
|
154
207
|
contraindicationSchema: () => contraindicationSchema,
|
|
208
|
+
contraindicationSchemaBackoffice: () => contraindicationSchemaBackoffice,
|
|
155
209
|
createAdminTokenSchema: () => createAdminTokenSchema,
|
|
156
210
|
createAppointmentSchema: () => createAppointmentSchema,
|
|
157
211
|
createBlockingEventSchema: () => createBlockingEventSchema,
|
|
@@ -234,6 +288,7 @@ __export(index_exports, {
|
|
|
234
288
|
preRequirementNotificationSchema: () => preRequirementNotificationSchema,
|
|
235
289
|
procedureCategorizationSchema: () => procedureCategorizationSchema,
|
|
236
290
|
procedureExtendedInfoSchema: () => procedureExtendedInfoSchema,
|
|
291
|
+
procedureFamilySchemaBackoffice: () => procedureFamilySchemaBackoffice,
|
|
237
292
|
procedureInfoSchema: () => procedureInfoSchema,
|
|
238
293
|
procedureReviewInfoSchema: () => procedureReviewInfoSchema,
|
|
239
294
|
procedureReviewSchema: () => procedureReviewSchema,
|
|
@@ -242,15 +297,26 @@ __export(index_exports, {
|
|
|
242
297
|
requesterInfoSchema: () => requesterInfoSchema,
|
|
243
298
|
requirementImportanceSchema: () => requirementImportanceSchema,
|
|
244
299
|
requirementInstructionDueNotificationSchema: () => requirementInstructionDueNotificationSchema,
|
|
300
|
+
requirementSchema: () => requirementSchema,
|
|
301
|
+
requirementTypeSchema: () => requirementTypeSchema,
|
|
302
|
+
requirementUpdateSchema: () => requirementUpdateSchema,
|
|
245
303
|
rescheduleAppointmentSchema: () => rescheduleAppointmentSchema,
|
|
246
304
|
reviewSchema: () => reviewSchema,
|
|
247
305
|
searchAppointmentsSchema: () => searchAppointmentsSchema,
|
|
248
306
|
searchPatientsSchema: () => searchPatientsSchema,
|
|
249
307
|
sharedClinicContactInfoSchema: () => sharedClinicContactInfoSchema,
|
|
250
308
|
sharedClinicLocationSchema: () => sharedClinicLocationSchema,
|
|
309
|
+
subcategorySchema: () => subcategorySchema,
|
|
310
|
+
subcategoryUpdateSchema: () => subcategoryUpdateSchema,
|
|
251
311
|
syncedCalendarEventSchema: () => syncedCalendarEventSchema,
|
|
312
|
+
technologyRequirementsSchema: () => technologyRequirementsSchema,
|
|
313
|
+
technologySchema: () => technologySchema,
|
|
314
|
+
technologyUpdateSchema: () => technologyUpdateSchema,
|
|
252
315
|
timeSlotSchema: () => timeSlotSchema2,
|
|
316
|
+
timeUnitSchemaBackoffice: () => timeUnitSchemaBackoffice,
|
|
317
|
+
timeframeSchema: () => timeframeSchema,
|
|
253
318
|
timestampSchema: () => timestampSchema,
|
|
319
|
+
treatmentBenefitSchemaBackoffice: () => treatmentBenefitSchemaBackoffice,
|
|
254
320
|
updateAllergySchema: () => updateAllergySchema,
|
|
255
321
|
updateAppointmentSchema: () => updateAppointmentSchema,
|
|
256
322
|
updateBlockingConditionSchema: () => updateBlockingConditionSchema,
|
|
@@ -1054,6 +1120,9 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
|
|
|
1054
1120
|
// src/types/procedure/index.ts
|
|
1055
1121
|
var PROCEDURES_COLLECTION = "procedures";
|
|
1056
1122
|
|
|
1123
|
+
// src/backoffice/types/technology.types.ts
|
|
1124
|
+
var TECHNOLOGIES_COLLECTION = "technologies";
|
|
1125
|
+
|
|
1057
1126
|
// src/services/appointment/utils/appointment.utils.ts
|
|
1058
1127
|
async function updateAppointmentUtil(db, appointmentId, data) {
|
|
1059
1128
|
try {
|
|
@@ -1230,7 +1299,7 @@ async function searchAppointmentsUtil(db, params) {
|
|
|
1230
1299
|
const q = (0, import_firestore.query)((0, import_firestore.collection)(db, APPOINTMENTS_COLLECTION), ...constraints);
|
|
1231
1300
|
const querySnapshot = await (0, import_firestore.getDocs)(q);
|
|
1232
1301
|
const appointments = querySnapshot.docs.map(
|
|
1233
|
-
(
|
|
1302
|
+
(doc38) => doc38.data()
|
|
1234
1303
|
);
|
|
1235
1304
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
1236
1305
|
return { appointments, lastDoc };
|
|
@@ -2037,7 +2106,7 @@ var AppointmentService = class extends BaseService {
|
|
|
2037
2106
|
);
|
|
2038
2107
|
const querySnapshot = await (0, import_firestore2.getDocs)(q);
|
|
2039
2108
|
const appointments = querySnapshot.docs.map(
|
|
2040
|
-
(
|
|
2109
|
+
(doc38) => doc38.data()
|
|
2041
2110
|
);
|
|
2042
2111
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
2043
2112
|
console.log(
|
|
@@ -2110,7 +2179,7 @@ var AppointmentService = class extends BaseService {
|
|
|
2110
2179
|
);
|
|
2111
2180
|
const querySnapshot = await (0, import_firestore2.getDocs)(q);
|
|
2112
2181
|
const appointments = querySnapshot.docs.map(
|
|
2113
|
-
(
|
|
2182
|
+
(doc38) => doc38.data()
|
|
2114
2183
|
);
|
|
2115
2184
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
2116
2185
|
console.log(
|
|
@@ -2404,16 +2473,16 @@ var CertificationLevel = /* @__PURE__ */ ((CertificationLevel2) => {
|
|
|
2404
2473
|
CertificationLevel2["PLASTIC_SURGEON"] = "plastic_surgeon";
|
|
2405
2474
|
return CertificationLevel2;
|
|
2406
2475
|
})(CertificationLevel || {});
|
|
2407
|
-
var CertificationSpecialty = /* @__PURE__ */ ((
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
return
|
|
2476
|
+
var CertificationSpecialty = /* @__PURE__ */ ((CertificationSpecialty3) => {
|
|
2477
|
+
CertificationSpecialty3["LASER"] = "laser";
|
|
2478
|
+
CertificationSpecialty3["INJECTABLES"] = "injectables";
|
|
2479
|
+
CertificationSpecialty3["CHEMICAL_PEELS"] = "chemical_peels";
|
|
2480
|
+
CertificationSpecialty3["MICRODERMABRASION"] = "microdermabrasion";
|
|
2481
|
+
CertificationSpecialty3["BODY_CONTOURING"] = "body_contouring";
|
|
2482
|
+
CertificationSpecialty3["SKIN_CARE"] = "skin_care";
|
|
2483
|
+
CertificationSpecialty3["WOUND_CARE"] = "wound_care";
|
|
2484
|
+
CertificationSpecialty3["ANESTHESIA"] = "anesthesia";
|
|
2485
|
+
return CertificationSpecialty3;
|
|
2417
2486
|
})(CertificationSpecialty || {});
|
|
2418
2487
|
|
|
2419
2488
|
// src/services/auth/utils/practitioner.utils.ts
|
|
@@ -3363,7 +3432,7 @@ var MediaService = class extends BaseService {
|
|
|
3363
3432
|
try {
|
|
3364
3433
|
const querySnapshot = await (0, import_firestore5.getDocs)(finalQuery);
|
|
3365
3434
|
const mediaList = querySnapshot.docs.map(
|
|
3366
|
-
(
|
|
3435
|
+
(doc38) => doc38.data()
|
|
3367
3436
|
);
|
|
3368
3437
|
console.log(`[MediaService] Found ${mediaList.length} media items.`);
|
|
3369
3438
|
return mediaList;
|
|
@@ -3417,8 +3486,8 @@ var getPatientsByClinicUtil = async (db, clinicId, options) => {
|
|
|
3417
3486
|
}
|
|
3418
3487
|
const patientsSnapshot = await (0, import_firestore6.getDocs)(q);
|
|
3419
3488
|
const patients = [];
|
|
3420
|
-
patientsSnapshot.forEach((
|
|
3421
|
-
patients.push(
|
|
3489
|
+
patientsSnapshot.forEach((doc38) => {
|
|
3490
|
+
patients.push(doc38.data());
|
|
3422
3491
|
});
|
|
3423
3492
|
console.log(
|
|
3424
3493
|
`[getPatientsByClinicUtil] Found ${patients.length} patients for clinic ID: ${clinicId}`
|
|
@@ -3771,8 +3840,8 @@ var getPatientsByPractitionerUtil = async (db, practitionerId, options) => {
|
|
|
3771
3840
|
}
|
|
3772
3841
|
const patientsSnapshot = await (0, import_firestore9.getDocs)(q);
|
|
3773
3842
|
const patients = [];
|
|
3774
|
-
patientsSnapshot.forEach((
|
|
3775
|
-
patients.push(
|
|
3843
|
+
patientsSnapshot.forEach((doc38) => {
|
|
3844
|
+
patients.push(doc38.data());
|
|
3776
3845
|
});
|
|
3777
3846
|
console.log(
|
|
3778
3847
|
`[getPatientsByPractitionerUtil] Found ${patients.length} patients for practitioner ID: ${practitionerId}`
|
|
@@ -4340,7 +4409,7 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
|
|
|
4340
4409
|
(0, import_firestore11.where)("clinicGroupId", "==", clinicGroupId)
|
|
4341
4410
|
);
|
|
4342
4411
|
const querySnapshot = await (0, import_firestore11.getDocs)(q);
|
|
4343
|
-
return querySnapshot.docs.map((
|
|
4412
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
4344
4413
|
}
|
|
4345
4414
|
async function updateClinicAdmin(db, adminId, data) {
|
|
4346
4415
|
const admin2 = await getClinicAdmin(db, adminId);
|
|
@@ -5003,9 +5072,9 @@ var updateAllergyUtil = async (db, patientId, data, requesterId, requesterRoles)
|
|
|
5003
5072
|
};
|
|
5004
5073
|
var removeAllergyUtil = async (db, patientId, allergyIndex, requesterId, requesterRoles) => {
|
|
5005
5074
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5006
|
-
const
|
|
5007
|
-
if (!
|
|
5008
|
-
const medicalInfo =
|
|
5075
|
+
const doc38 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5076
|
+
if (!doc38.exists()) throw new Error("Medical info not found");
|
|
5077
|
+
const medicalInfo = doc38.data();
|
|
5009
5078
|
if (allergyIndex >= medicalInfo.allergies.length) {
|
|
5010
5079
|
throw new Error("Invalid allergy index");
|
|
5011
5080
|
}
|
|
@@ -5032,9 +5101,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, requesterId, reque
|
|
|
5032
5101
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5033
5102
|
const validatedData = updateBlockingConditionSchema.parse(data);
|
|
5034
5103
|
const { conditionIndex, ...updateData } = validatedData;
|
|
5035
|
-
const
|
|
5036
|
-
if (!
|
|
5037
|
-
const medicalInfo =
|
|
5104
|
+
const doc38 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5105
|
+
if (!doc38.exists()) throw new Error("Medical info not found");
|
|
5106
|
+
const medicalInfo = doc38.data();
|
|
5038
5107
|
if (conditionIndex >= medicalInfo.blockingConditions.length) {
|
|
5039
5108
|
throw new Error("Invalid blocking condition index");
|
|
5040
5109
|
}
|
|
@@ -5051,9 +5120,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, requesterId, reque
|
|
|
5051
5120
|
};
|
|
5052
5121
|
var removeBlockingConditionUtil = async (db, patientId, conditionIndex, requesterId, requesterRoles) => {
|
|
5053
5122
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5054
|
-
const
|
|
5055
|
-
if (!
|
|
5056
|
-
const medicalInfo =
|
|
5123
|
+
const doc38 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5124
|
+
if (!doc38.exists()) throw new Error("Medical info not found");
|
|
5125
|
+
const medicalInfo = doc38.data();
|
|
5057
5126
|
if (conditionIndex >= medicalInfo.blockingConditions.length) {
|
|
5058
5127
|
throw new Error("Invalid blocking condition index");
|
|
5059
5128
|
}
|
|
@@ -5080,9 +5149,9 @@ var updateContraindicationUtil = async (db, patientId, data, requesterId, reques
|
|
|
5080
5149
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5081
5150
|
const validatedData = updateContraindicationSchema.parse(data);
|
|
5082
5151
|
const { contraindicationIndex, ...updateData } = validatedData;
|
|
5083
|
-
const
|
|
5084
|
-
if (!
|
|
5085
|
-
const medicalInfo =
|
|
5152
|
+
const doc38 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5153
|
+
if (!doc38.exists()) throw new Error("Medical info not found");
|
|
5154
|
+
const medicalInfo = doc38.data();
|
|
5086
5155
|
if (contraindicationIndex >= medicalInfo.contraindications.length) {
|
|
5087
5156
|
throw new Error("Invalid contraindication index");
|
|
5088
5157
|
}
|
|
@@ -5099,9 +5168,9 @@ var updateContraindicationUtil = async (db, patientId, data, requesterId, reques
|
|
|
5099
5168
|
};
|
|
5100
5169
|
var removeContraindicationUtil = async (db, patientId, contraindicationIndex, requesterId, requesterRoles) => {
|
|
5101
5170
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5102
|
-
const
|
|
5103
|
-
if (!
|
|
5104
|
-
const medicalInfo =
|
|
5171
|
+
const doc38 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5172
|
+
if (!doc38.exists()) throw new Error("Medical info not found");
|
|
5173
|
+
const medicalInfo = doc38.data();
|
|
5105
5174
|
if (contraindicationIndex >= medicalInfo.contraindications.length) {
|
|
5106
5175
|
throw new Error("Invalid contraindication index");
|
|
5107
5176
|
}
|
|
@@ -5128,9 +5197,9 @@ var updateMedicationUtil = async (db, patientId, data, requesterId, requesterRol
|
|
|
5128
5197
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5129
5198
|
const validatedData = updateMedicationSchema.parse(data);
|
|
5130
5199
|
const { medicationIndex, ...updateData } = validatedData;
|
|
5131
|
-
const
|
|
5132
|
-
if (!
|
|
5133
|
-
const medicalInfo =
|
|
5200
|
+
const doc38 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5201
|
+
if (!doc38.exists()) throw new Error("Medical info not found");
|
|
5202
|
+
const medicalInfo = doc38.data();
|
|
5134
5203
|
if (medicationIndex >= medicalInfo.currentMedications.length) {
|
|
5135
5204
|
throw new Error("Invalid medication index");
|
|
5136
5205
|
}
|
|
@@ -5147,9 +5216,9 @@ var updateMedicationUtil = async (db, patientId, data, requesterId, requesterRol
|
|
|
5147
5216
|
};
|
|
5148
5217
|
var removeMedicationUtil = async (db, patientId, medicationIndex, requesterId, requesterRoles) => {
|
|
5149
5218
|
await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
|
|
5150
|
-
const
|
|
5151
|
-
if (!
|
|
5152
|
-
const medicalInfo =
|
|
5219
|
+
const doc38 = await (0, import_firestore16.getDoc)(getMedicalInfoDocRef(db, patientId));
|
|
5220
|
+
if (!doc38.exists()) throw new Error("Medical info not found");
|
|
5221
|
+
const medicalInfo = doc38.data();
|
|
5153
5222
|
if (medicationIndex >= medicalInfo.currentMedications.length) {
|
|
5154
5223
|
throw new Error("Invalid medication index");
|
|
5155
5224
|
}
|
|
@@ -5436,7 +5505,7 @@ var searchPatientsUtil = async (db, params, requester) => {
|
|
|
5436
5505
|
const finalQuery = (0, import_firestore17.query)(patientsCollectionRef, ...constraints);
|
|
5437
5506
|
const querySnapshot = await (0, import_firestore17.getDocs)(finalQuery);
|
|
5438
5507
|
const patients = querySnapshot.docs.map(
|
|
5439
|
-
(
|
|
5508
|
+
(doc38) => doc38.data()
|
|
5440
5509
|
);
|
|
5441
5510
|
console.log(
|
|
5442
5511
|
`[searchPatientsUtil] Found ${patients.length} patients matching criteria.`
|
|
@@ -5468,8 +5537,8 @@ var getAllPatientsUtil = async (db, options) => {
|
|
|
5468
5537
|
}
|
|
5469
5538
|
const patientsSnapshot = await (0, import_firestore17.getDocs)(q);
|
|
5470
5539
|
const patients = [];
|
|
5471
|
-
patientsSnapshot.forEach((
|
|
5472
|
-
patients.push(
|
|
5540
|
+
patientsSnapshot.forEach((doc38) => {
|
|
5541
|
+
patients.push(doc38.data());
|
|
5473
5542
|
});
|
|
5474
5543
|
console.log(`[getAllPatientsUtil] Found ${patients.length} patients`);
|
|
5475
5544
|
return patients;
|
|
@@ -5591,7 +5660,7 @@ var getActiveInviteTokensByClinicUtil = async (db, clinicId) => {
|
|
|
5591
5660
|
if (querySnapshot.empty) {
|
|
5592
5661
|
return [];
|
|
5593
5662
|
}
|
|
5594
|
-
return querySnapshot.docs.map((
|
|
5663
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
5595
5664
|
};
|
|
5596
5665
|
var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
|
|
5597
5666
|
const tokensRef = (0, import_firestore18.collection)(
|
|
@@ -5609,7 +5678,7 @@ var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
|
|
|
5609
5678
|
if (querySnapshot.empty) {
|
|
5610
5679
|
return [];
|
|
5611
5680
|
}
|
|
5612
|
-
return querySnapshot.docs.map((
|
|
5681
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
5613
5682
|
};
|
|
5614
5683
|
|
|
5615
5684
|
// src/services/patient/patient.service.ts
|
|
@@ -6715,7 +6784,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6715
6784
|
(0, import_firestore21.where)("expiresAt", ">", import_firestore21.Timestamp.now())
|
|
6716
6785
|
);
|
|
6717
6786
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6718
|
-
return querySnapshot.docs.map((
|
|
6787
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
6719
6788
|
}
|
|
6720
6789
|
/**
|
|
6721
6790
|
* Gets a token by its string value and validates it
|
|
@@ -6825,7 +6894,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6825
6894
|
(0, import_firestore21.where)("status", "==", "active" /* ACTIVE */)
|
|
6826
6895
|
);
|
|
6827
6896
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6828
|
-
return querySnapshot.docs.map((
|
|
6897
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
6829
6898
|
}
|
|
6830
6899
|
/**
|
|
6831
6900
|
* Dohvata sve zdravstvene radnike za određenu kliniku
|
|
@@ -6837,7 +6906,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6837
6906
|
(0, import_firestore21.where)("isActive", "==", true)
|
|
6838
6907
|
);
|
|
6839
6908
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6840
|
-
return querySnapshot.docs.map((
|
|
6909
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
6841
6910
|
}
|
|
6842
6911
|
/**
|
|
6843
6912
|
* Dohvata sve draft zdravstvene radnike za određenu kliniku sa statusom DRAFT
|
|
@@ -6849,7 +6918,7 @@ var PractitionerService = class extends BaseService {
|
|
|
6849
6918
|
(0, import_firestore21.where)("status", "==", "draft" /* DRAFT */)
|
|
6850
6919
|
);
|
|
6851
6920
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6852
|
-
return querySnapshot.docs.map((
|
|
6921
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
6853
6922
|
}
|
|
6854
6923
|
/**
|
|
6855
6924
|
* Updates a practitioner
|
|
@@ -7063,7 +7132,7 @@ var PractitionerService = class extends BaseService {
|
|
|
7063
7132
|
);
|
|
7064
7133
|
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
7065
7134
|
const practitioners = querySnapshot.docs.map(
|
|
7066
|
-
(
|
|
7135
|
+
(doc38) => doc38.data()
|
|
7067
7136
|
);
|
|
7068
7137
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
7069
7138
|
return {
|
|
@@ -7134,8 +7203,8 @@ var PractitionerService = class extends BaseService {
|
|
|
7134
7203
|
console.log(
|
|
7135
7204
|
`[PRACTITIONER_SERVICE] Found ${querySnapshot.docs.length} practitioners with base query`
|
|
7136
7205
|
);
|
|
7137
|
-
let practitioners = querySnapshot.docs.map((
|
|
7138
|
-
return { ...
|
|
7206
|
+
let practitioners = querySnapshot.docs.map((doc38) => {
|
|
7207
|
+
return { ...doc38.data(), id: doc38.id };
|
|
7139
7208
|
});
|
|
7140
7209
|
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
7141
7210
|
if (filters.nameSearch && filters.nameSearch.trim() !== "") {
|
|
@@ -7619,7 +7688,7 @@ var UserService = class extends BaseService {
|
|
|
7619
7688
|
];
|
|
7620
7689
|
const q = (0, import_firestore22.query)((0, import_firestore22.collection)(this.db, USERS_COLLECTION), ...constraints);
|
|
7621
7690
|
const querySnapshot = await (0, import_firestore22.getDocs)(q);
|
|
7622
|
-
const users = querySnapshot.docs.map((
|
|
7691
|
+
const users = querySnapshot.docs.map((doc38) => doc38.data());
|
|
7623
7692
|
return users.map((userData) => userSchema.parse(userData));
|
|
7624
7693
|
}
|
|
7625
7694
|
/**
|
|
@@ -7983,7 +8052,7 @@ async function getAllActiveGroups(db) {
|
|
|
7983
8052
|
(0, import_firestore23.where)("isActive", "==", true)
|
|
7984
8053
|
);
|
|
7985
8054
|
const querySnapshot = await (0, import_firestore23.getDocs)(q);
|
|
7986
|
-
return querySnapshot.docs.map((
|
|
8055
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
7987
8056
|
}
|
|
7988
8057
|
async function updateClinicGroup(db, groupId, data, app) {
|
|
7989
8058
|
console.log("[CLINIC_GROUP] Updating clinic group", { groupId });
|
|
@@ -8423,7 +8492,7 @@ async function getClinicsByGroup(db, groupId) {
|
|
|
8423
8492
|
(0, import_firestore24.where)("isActive", "==", true)
|
|
8424
8493
|
);
|
|
8425
8494
|
const querySnapshot = await (0, import_firestore24.getDocs)(q);
|
|
8426
|
-
return querySnapshot.docs.map((
|
|
8495
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
8427
8496
|
}
|
|
8428
8497
|
async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
|
|
8429
8498
|
console.log("[CLINIC] Starting clinic update", { clinicId, adminId });
|
|
@@ -8617,7 +8686,7 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
|
|
|
8617
8686
|
}
|
|
8618
8687
|
const q = (0, import_firestore24.query)((0, import_firestore24.collection)(db, CLINICS_COLLECTION), ...constraints);
|
|
8619
8688
|
const querySnapshot = await (0, import_firestore24.getDocs)(q);
|
|
8620
|
-
return querySnapshot.docs.map((
|
|
8689
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
8621
8690
|
}
|
|
8622
8691
|
async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
|
|
8623
8692
|
return getClinicsByAdmin(
|
|
@@ -8662,11 +8731,11 @@ async function getAllClinics(db, pagination, lastDoc) {
|
|
|
8662
8731
|
}
|
|
8663
8732
|
const clinicsSnapshot = await (0, import_firestore24.getDocs)(clinicsQuery);
|
|
8664
8733
|
const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
|
|
8665
|
-
const clinics = clinicsSnapshot.docs.map((
|
|
8666
|
-
const data =
|
|
8734
|
+
const clinics = clinicsSnapshot.docs.map((doc38) => {
|
|
8735
|
+
const data = doc38.data();
|
|
8667
8736
|
return {
|
|
8668
8737
|
...data,
|
|
8669
|
-
id:
|
|
8738
|
+
id: doc38.id
|
|
8670
8739
|
};
|
|
8671
8740
|
});
|
|
8672
8741
|
return {
|
|
@@ -8693,8 +8762,8 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
|
|
|
8693
8762
|
];
|
|
8694
8763
|
const q = (0, import_firestore24.query)((0, import_firestore24.collection)(db, CLINICS_COLLECTION), ...constraints);
|
|
8695
8764
|
const querySnapshot = await (0, import_firestore24.getDocs)(q);
|
|
8696
|
-
for (const
|
|
8697
|
-
const clinic =
|
|
8765
|
+
for (const doc38 of querySnapshot.docs) {
|
|
8766
|
+
const clinic = doc38.data();
|
|
8698
8767
|
const distance = (0, import_geofire_common4.distanceBetween)(
|
|
8699
8768
|
[center.latitude, center.longitude],
|
|
8700
8769
|
[clinic.location.latitude, clinic.location.longitude]
|
|
@@ -8811,8 +8880,8 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
|
|
|
8811
8880
|
}
|
|
8812
8881
|
const q = (0, import_firestore25.query)((0, import_firestore25.collection)(db, CLINICS_COLLECTION), ...constraints);
|
|
8813
8882
|
const querySnapshot = await (0, import_firestore25.getDocs)(q);
|
|
8814
|
-
for (const
|
|
8815
|
-
const clinic =
|
|
8883
|
+
for (const doc38 of querySnapshot.docs) {
|
|
8884
|
+
const clinic = doc38.data();
|
|
8816
8885
|
const distance = (0, import_geofire_common5.distanceBetween)(
|
|
8817
8886
|
[center.latitude, center.longitude],
|
|
8818
8887
|
[clinic.location.latitude, clinic.location.longitude]
|
|
@@ -8900,8 +8969,8 @@ async function getClinicsByFilters(db, filters) {
|
|
|
8900
8969
|
console.log(
|
|
8901
8970
|
`[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics in geo bound`
|
|
8902
8971
|
);
|
|
8903
|
-
for (const
|
|
8904
|
-
const clinic = { ...
|
|
8972
|
+
for (const doc38 of querySnapshot.docs) {
|
|
8973
|
+
const clinic = { ...doc38.data(), id: doc38.id };
|
|
8905
8974
|
const distance = (0, import_geofire_common6.distanceBetween)(
|
|
8906
8975
|
[center.latitude, center.longitude],
|
|
8907
8976
|
[clinic.location.latitude, clinic.location.longitude]
|
|
@@ -8957,8 +9026,8 @@ async function getClinicsByFilters(db, filters) {
|
|
|
8957
9026
|
console.log(
|
|
8958
9027
|
`[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics with regular query`
|
|
8959
9028
|
);
|
|
8960
|
-
const clinics = querySnapshot.docs.map((
|
|
8961
|
-
return { ...
|
|
9029
|
+
const clinics = querySnapshot.docs.map((doc38) => {
|
|
9030
|
+
return { ...doc38.data(), id: doc38.id };
|
|
8962
9031
|
});
|
|
8963
9032
|
let filteredClinics = clinics;
|
|
8964
9033
|
if (filters.center) {
|
|
@@ -10579,7 +10648,7 @@ async function searchCalendarEventsUtil(db, params) {
|
|
|
10579
10648
|
const finalQuery = (0, import_firestore33.query)(collectionRef, ...constraints);
|
|
10580
10649
|
const querySnapshot = await (0, import_firestore33.getDocs)(finalQuery);
|
|
10581
10650
|
const events = querySnapshot.docs.map(
|
|
10582
|
-
(
|
|
10651
|
+
(doc38) => ({ id: doc38.id, ...doc38.data() })
|
|
10583
10652
|
);
|
|
10584
10653
|
return events;
|
|
10585
10654
|
} catch (error) {
|
|
@@ -10661,7 +10730,7 @@ async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
|
|
|
10661
10730
|
);
|
|
10662
10731
|
const q = (0, import_firestore34.query)(calendarsRef, (0, import_firestore34.orderBy)("createdAt", "desc"));
|
|
10663
10732
|
const querySnapshot = await (0, import_firestore34.getDocs)(q);
|
|
10664
|
-
return querySnapshot.docs.map((
|
|
10733
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
10665
10734
|
}
|
|
10666
10735
|
async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
|
|
10667
10736
|
const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
|
|
@@ -10678,7 +10747,7 @@ async function getPatientSyncedCalendarsUtil(db, patientId) {
|
|
|
10678
10747
|
);
|
|
10679
10748
|
const q = (0, import_firestore34.query)(calendarsRef, (0, import_firestore34.orderBy)("createdAt", "desc"));
|
|
10680
10749
|
const querySnapshot = await (0, import_firestore34.getDocs)(q);
|
|
10681
|
-
return querySnapshot.docs.map((
|
|
10750
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
10682
10751
|
}
|
|
10683
10752
|
async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
|
|
10684
10753
|
const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
|
|
@@ -10695,7 +10764,7 @@ async function getClinicSyncedCalendarsUtil(db, clinicId) {
|
|
|
10695
10764
|
);
|
|
10696
10765
|
const q = (0, import_firestore34.query)(calendarsRef, (0, import_firestore34.orderBy)("createdAt", "desc"));
|
|
10697
10766
|
const querySnapshot = await (0, import_firestore34.getDocs)(q);
|
|
10698
|
-
return querySnapshot.docs.map((
|
|
10767
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
10699
10768
|
}
|
|
10700
10769
|
async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
|
|
10701
10770
|
const calendarRef = getPractitionerSyncedCalendarDocRef(
|
|
@@ -12050,9 +12119,9 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
12050
12119
|
(0, import_firestore37.where)("eventTime.start", "<=", import_firestore36.Timestamp.fromDate(endDate))
|
|
12051
12120
|
);
|
|
12052
12121
|
const eventsSnapshot = await (0, import_firestore37.getDocs)(q);
|
|
12053
|
-
const events = eventsSnapshot.docs.map((
|
|
12054
|
-
id:
|
|
12055
|
-
...
|
|
12122
|
+
const events = eventsSnapshot.docs.map((doc38) => ({
|
|
12123
|
+
id: doc38.id,
|
|
12124
|
+
...doc38.data()
|
|
12056
12125
|
}));
|
|
12057
12126
|
const calendars = await this.syncedCalendarsService.getPractitionerSyncedCalendars(
|
|
12058
12127
|
doctorId
|
|
@@ -12686,7 +12755,7 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
12686
12755
|
])
|
|
12687
12756
|
);
|
|
12688
12757
|
const querySnapshot = await (0, import_firestore37.getDocs)(q);
|
|
12689
|
-
return querySnapshot.docs.map((
|
|
12758
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
12690
12759
|
}
|
|
12691
12760
|
/**
|
|
12692
12761
|
* Calculates available time slots based on working hours, schedule and existing appointments
|
|
@@ -13217,7 +13286,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
13217
13286
|
...constraints
|
|
13218
13287
|
);
|
|
13219
13288
|
const querySnapshot = await (0, import_firestore40.getDocs)(q);
|
|
13220
|
-
return querySnapshot.docs.map((
|
|
13289
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
13221
13290
|
} catch (error) {
|
|
13222
13291
|
console.error(
|
|
13223
13292
|
"[PractitionerInviteService] Error getting doctor invites:",
|
|
@@ -13246,7 +13315,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
13246
13315
|
...constraints
|
|
13247
13316
|
);
|
|
13248
13317
|
const querySnapshot = await (0, import_firestore40.getDocs)(q);
|
|
13249
|
-
return querySnapshot.docs.map((
|
|
13318
|
+
return querySnapshot.docs.map((doc38) => doc38.data());
|
|
13250
13319
|
} catch (error) {
|
|
13251
13320
|
console.error(
|
|
13252
13321
|
"[PractitionerInviteService] Error getting clinic invites:",
|
|
@@ -13402,7 +13471,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
13402
13471
|
);
|
|
13403
13472
|
const querySnapshot = await (0, import_firestore40.getDocs)(q);
|
|
13404
13473
|
let invites = querySnapshot.docs.map(
|
|
13405
|
-
(
|
|
13474
|
+
(doc38) => doc38.data()
|
|
13406
13475
|
);
|
|
13407
13476
|
if (filters.fromDate) {
|
|
13408
13477
|
invites = invites.filter(
|
|
@@ -13659,8 +13728,8 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13659
13728
|
const q = (0, import_firestore41.query)(versionsCollectionRef, (0, import_firestore41.orderBy)("version", "desc"));
|
|
13660
13729
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13661
13730
|
const versions = [];
|
|
13662
|
-
querySnapshot.forEach((
|
|
13663
|
-
versions.push(
|
|
13731
|
+
querySnapshot.forEach((doc38) => {
|
|
13732
|
+
versions.push(doc38.data());
|
|
13664
13733
|
});
|
|
13665
13734
|
return versions;
|
|
13666
13735
|
}
|
|
@@ -13691,9 +13760,9 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13691
13760
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13692
13761
|
const templates = [];
|
|
13693
13762
|
let lastVisible = null;
|
|
13694
|
-
querySnapshot.forEach((
|
|
13695
|
-
templates.push(
|
|
13696
|
-
lastVisible =
|
|
13763
|
+
querySnapshot.forEach((doc38) => {
|
|
13764
|
+
templates.push(doc38.data());
|
|
13765
|
+
lastVisible = doc38;
|
|
13697
13766
|
});
|
|
13698
13767
|
return {
|
|
13699
13768
|
templates,
|
|
@@ -13721,9 +13790,9 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13721
13790
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13722
13791
|
const templates = [];
|
|
13723
13792
|
let lastVisible = null;
|
|
13724
|
-
querySnapshot.forEach((
|
|
13725
|
-
templates.push(
|
|
13726
|
-
lastVisible =
|
|
13793
|
+
querySnapshot.forEach((doc38) => {
|
|
13794
|
+
templates.push(doc38.data());
|
|
13795
|
+
lastVisible = doc38;
|
|
13727
13796
|
});
|
|
13728
13797
|
return {
|
|
13729
13798
|
templates,
|
|
@@ -13750,9 +13819,9 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13750
13819
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13751
13820
|
const templates = [];
|
|
13752
13821
|
let lastVisible = null;
|
|
13753
|
-
querySnapshot.forEach((
|
|
13754
|
-
templates.push(
|
|
13755
|
-
lastVisible =
|
|
13822
|
+
querySnapshot.forEach((doc38) => {
|
|
13823
|
+
templates.push(doc38.data());
|
|
13824
|
+
lastVisible = doc38;
|
|
13756
13825
|
});
|
|
13757
13826
|
return {
|
|
13758
13827
|
templates,
|
|
@@ -13778,8 +13847,8 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
13778
13847
|
}
|
|
13779
13848
|
const querySnapshot = await (0, import_firestore41.getDocs)(q);
|
|
13780
13849
|
const templates = [];
|
|
13781
|
-
querySnapshot.forEach((
|
|
13782
|
-
templates.push(
|
|
13850
|
+
querySnapshot.forEach((doc38) => {
|
|
13851
|
+
templates.push(doc38.data());
|
|
13783
13852
|
});
|
|
13784
13853
|
return templates;
|
|
13785
13854
|
}
|
|
@@ -13974,9 +14043,9 @@ var FilledDocumentService = class extends BaseService {
|
|
|
13974
14043
|
const querySnapshot = await (0, import_firestore42.getDocs)(q);
|
|
13975
14044
|
const documents = [];
|
|
13976
14045
|
let lastVisible = null;
|
|
13977
|
-
querySnapshot.forEach((
|
|
13978
|
-
documents.push(
|
|
13979
|
-
lastVisible =
|
|
14046
|
+
querySnapshot.forEach((doc38) => {
|
|
14047
|
+
documents.push(doc38.data());
|
|
14048
|
+
lastVisible = doc38;
|
|
13980
14049
|
});
|
|
13981
14050
|
return {
|
|
13982
14051
|
documents,
|
|
@@ -14185,9 +14254,9 @@ var NotificationService = class extends BaseService {
|
|
|
14185
14254
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14186
14255
|
);
|
|
14187
14256
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14188
|
-
return querySnapshot.docs.map((
|
|
14189
|
-
id:
|
|
14190
|
-
...
|
|
14257
|
+
return querySnapshot.docs.map((doc38) => ({
|
|
14258
|
+
id: doc38.id,
|
|
14259
|
+
...doc38.data()
|
|
14191
14260
|
}));
|
|
14192
14261
|
}
|
|
14193
14262
|
/**
|
|
@@ -14201,9 +14270,9 @@ var NotificationService = class extends BaseService {
|
|
|
14201
14270
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14202
14271
|
);
|
|
14203
14272
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14204
|
-
return querySnapshot.docs.map((
|
|
14205
|
-
id:
|
|
14206
|
-
...
|
|
14273
|
+
return querySnapshot.docs.map((doc38) => ({
|
|
14274
|
+
id: doc38.id,
|
|
14275
|
+
...doc38.data()
|
|
14207
14276
|
}));
|
|
14208
14277
|
}
|
|
14209
14278
|
/**
|
|
@@ -14275,9 +14344,9 @@ var NotificationService = class extends BaseService {
|
|
|
14275
14344
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14276
14345
|
);
|
|
14277
14346
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14278
|
-
return querySnapshot.docs.map((
|
|
14279
|
-
id:
|
|
14280
|
-
...
|
|
14347
|
+
return querySnapshot.docs.map((doc38) => ({
|
|
14348
|
+
id: doc38.id,
|
|
14349
|
+
...doc38.data()
|
|
14281
14350
|
}));
|
|
14282
14351
|
}
|
|
14283
14352
|
/**
|
|
@@ -14290,9 +14359,9 @@ var NotificationService = class extends BaseService {
|
|
|
14290
14359
|
(0, import_firestore43.orderBy)("notificationTime", "desc")
|
|
14291
14360
|
);
|
|
14292
14361
|
const querySnapshot = await (0, import_firestore43.getDocs)(q);
|
|
14293
|
-
return querySnapshot.docs.map((
|
|
14294
|
-
id:
|
|
14295
|
-
...
|
|
14362
|
+
return querySnapshot.docs.map((doc38) => ({
|
|
14363
|
+
id: doc38.id,
|
|
14364
|
+
...doc38.data()
|
|
14296
14365
|
}));
|
|
14297
14366
|
}
|
|
14298
14367
|
};
|
|
@@ -14769,8 +14838,8 @@ var ProcedureService = class extends BaseService {
|
|
|
14769
14838
|
(0, import_firestore45.where)((0, import_firestore45.documentId)(), "in", chunk)
|
|
14770
14839
|
);
|
|
14771
14840
|
const practitionersSnapshot = await (0, import_firestore45.getDocs)(practitionersQuery);
|
|
14772
|
-
practitionersSnapshot.docs.forEach((
|
|
14773
|
-
practitionersMap.set(
|
|
14841
|
+
practitionersSnapshot.docs.forEach((doc38) => {
|
|
14842
|
+
practitionersMap.set(doc38.id, doc38.data());
|
|
14774
14843
|
});
|
|
14775
14844
|
}
|
|
14776
14845
|
if (practitionersMap.size !== practitionerIds.length) {
|
|
@@ -14852,8 +14921,8 @@ var ProcedureService = class extends BaseService {
|
|
|
14852
14921
|
(0, import_firestore45.where)((0, import_firestore45.documentId)(), "in", chunk)
|
|
14853
14922
|
);
|
|
14854
14923
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14855
|
-
snapshot.forEach((
|
|
14856
|
-
fetchedProcedures.push(
|
|
14924
|
+
snapshot.forEach((doc38) => {
|
|
14925
|
+
fetchedProcedures.push(doc38.data());
|
|
14857
14926
|
});
|
|
14858
14927
|
}
|
|
14859
14928
|
return fetchedProcedures;
|
|
@@ -14883,7 +14952,7 @@ var ProcedureService = class extends BaseService {
|
|
|
14883
14952
|
(0, import_firestore45.where)("isActive", "==", true)
|
|
14884
14953
|
);
|
|
14885
14954
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14886
|
-
return snapshot.docs.map((
|
|
14955
|
+
return snapshot.docs.map((doc38) => doc38.data());
|
|
14887
14956
|
}
|
|
14888
14957
|
/**
|
|
14889
14958
|
* Gets all procedures for a practitioner
|
|
@@ -14897,7 +14966,7 @@ var ProcedureService = class extends BaseService {
|
|
|
14897
14966
|
(0, import_firestore45.where)("isActive", "==", true)
|
|
14898
14967
|
);
|
|
14899
14968
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14900
|
-
return snapshot.docs.map((
|
|
14969
|
+
return snapshot.docs.map((doc38) => doc38.data());
|
|
14901
14970
|
}
|
|
14902
14971
|
/**
|
|
14903
14972
|
* Gets all inactive procedures for a practitioner
|
|
@@ -14911,7 +14980,7 @@ var ProcedureService = class extends BaseService {
|
|
|
14911
14980
|
(0, import_firestore45.where)("isActive", "==", false)
|
|
14912
14981
|
);
|
|
14913
14982
|
const snapshot = await (0, import_firestore45.getDocs)(q);
|
|
14914
|
-
return snapshot.docs.map((
|
|
14983
|
+
return snapshot.docs.map((doc38) => doc38.data());
|
|
14915
14984
|
}
|
|
14916
14985
|
/**
|
|
14917
14986
|
* Updates a procedure
|
|
@@ -15123,11 +15192,11 @@ var ProcedureService = class extends BaseService {
|
|
|
15123
15192
|
}
|
|
15124
15193
|
const proceduresSnapshot = await (0, import_firestore45.getDocs)(proceduresQuery);
|
|
15125
15194
|
const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
|
|
15126
|
-
const procedures = proceduresSnapshot.docs.map((
|
|
15127
|
-
const data =
|
|
15195
|
+
const procedures = proceduresSnapshot.docs.map((doc38) => {
|
|
15196
|
+
const data = doc38.data();
|
|
15128
15197
|
return {
|
|
15129
15198
|
...data,
|
|
15130
|
-
id:
|
|
15199
|
+
id: doc38.id
|
|
15131
15200
|
// Ensure ID is present
|
|
15132
15201
|
};
|
|
15133
15202
|
});
|
|
@@ -15209,8 +15278,8 @@ var ProcedureService = class extends BaseService {
|
|
|
15209
15278
|
console.log(
|
|
15210
15279
|
`[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures in geo bound`
|
|
15211
15280
|
);
|
|
15212
|
-
for (const
|
|
15213
|
-
const procedure = { ...
|
|
15281
|
+
for (const doc38 of querySnapshot.docs) {
|
|
15282
|
+
const procedure = { ...doc38.data(), id: doc38.id };
|
|
15214
15283
|
const distance = (0, import_geofire_common8.distanceBetween)(
|
|
15215
15284
|
[center.latitude, center.longitude],
|
|
15216
15285
|
[
|
|
@@ -15261,8 +15330,8 @@ var ProcedureService = class extends BaseService {
|
|
|
15261
15330
|
console.log(
|
|
15262
15331
|
`[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures with regular query`
|
|
15263
15332
|
);
|
|
15264
|
-
const procedures = querySnapshot.docs.map((
|
|
15265
|
-
return { ...
|
|
15333
|
+
const procedures = querySnapshot.docs.map((doc38) => {
|
|
15334
|
+
return { ...doc38.data(), id: doc38.id };
|
|
15266
15335
|
});
|
|
15267
15336
|
if (filters.location) {
|
|
15268
15337
|
const center = filters.location;
|
|
@@ -15595,7 +15664,7 @@ var ReviewService = class extends BaseService {
|
|
|
15595
15664
|
(0, import_firestore46.where)("patientId", "==", patientId)
|
|
15596
15665
|
);
|
|
15597
15666
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15598
|
-
return snapshot.docs.map((
|
|
15667
|
+
return snapshot.docs.map((doc38) => doc38.data());
|
|
15599
15668
|
}
|
|
15600
15669
|
/**
|
|
15601
15670
|
* Gets all reviews for a specific clinic
|
|
@@ -15608,7 +15677,7 @@ var ReviewService = class extends BaseService {
|
|
|
15608
15677
|
(0, import_firestore46.where)("clinicReview.clinicId", "==", clinicId)
|
|
15609
15678
|
);
|
|
15610
15679
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15611
|
-
return snapshot.docs.map((
|
|
15680
|
+
return snapshot.docs.map((doc38) => doc38.data());
|
|
15612
15681
|
}
|
|
15613
15682
|
/**
|
|
15614
15683
|
* Gets all reviews for a specific practitioner
|
|
@@ -15621,7 +15690,7 @@ var ReviewService = class extends BaseService {
|
|
|
15621
15690
|
(0, import_firestore46.where)("practitionerReview.practitionerId", "==", practitionerId)
|
|
15622
15691
|
);
|
|
15623
15692
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15624
|
-
return snapshot.docs.map((
|
|
15693
|
+
return snapshot.docs.map((doc38) => doc38.data());
|
|
15625
15694
|
}
|
|
15626
15695
|
/**
|
|
15627
15696
|
* Gets all reviews for a specific procedure
|
|
@@ -15634,7 +15703,7 @@ var ReviewService = class extends BaseService {
|
|
|
15634
15703
|
(0, import_firestore46.where)("procedureReview.procedureId", "==", procedureId)
|
|
15635
15704
|
);
|
|
15636
15705
|
const snapshot = await (0, import_firestore46.getDocs)(q);
|
|
15637
|
-
return snapshot.docs.map((
|
|
15706
|
+
return snapshot.docs.map((doc38) => doc38.data());
|
|
15638
15707
|
}
|
|
15639
15708
|
/**
|
|
15640
15709
|
* Gets all reviews for a specific appointment
|
|
@@ -15947,11 +16016,12 @@ var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
|
|
|
15947
16016
|
TimeUnit2["DAYS"] = "days";
|
|
15948
16017
|
return TimeUnit2;
|
|
15949
16018
|
})(TimeUnit || {});
|
|
15950
|
-
var RequirementType = /* @__PURE__ */ ((
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
return
|
|
16019
|
+
var RequirementType = /* @__PURE__ */ ((RequirementType3) => {
|
|
16020
|
+
RequirementType3["PRE"] = "pre";
|
|
16021
|
+
RequirementType3["POST"] = "post";
|
|
16022
|
+
return RequirementType3;
|
|
15954
16023
|
})(RequirementType || {});
|
|
16024
|
+
var REQUIREMENTS_COLLECTION = "backoffice_requirements";
|
|
15955
16025
|
|
|
15956
16026
|
// src/backoffice/validations/schemas.ts
|
|
15957
16027
|
var blockingConditionSchemaBackoffice = import_zod29.z.nativeEnum(BlockingCondition);
|
|
@@ -16300,6 +16370,1151 @@ var getFirebaseFunctions = async () => {
|
|
|
16300
16370
|
const instance = await getFirebaseInstance();
|
|
16301
16371
|
return instance.functions;
|
|
16302
16372
|
};
|
|
16373
|
+
|
|
16374
|
+
// src/backoffice/services/brand.service.ts
|
|
16375
|
+
var import_firestore51 = require("firebase/firestore");
|
|
16376
|
+
|
|
16377
|
+
// src/backoffice/types/brand.types.ts
|
|
16378
|
+
var BRANDS_COLLECTION = "brands";
|
|
16379
|
+
|
|
16380
|
+
// src/backoffice/services/brand.service.ts
|
|
16381
|
+
var BrandService = class extends BaseService {
|
|
16382
|
+
/**
|
|
16383
|
+
* Gets reference to brands collection
|
|
16384
|
+
*/
|
|
16385
|
+
getBrandsRef() {
|
|
16386
|
+
return (0, import_firestore51.collection)(this.db, BRANDS_COLLECTION);
|
|
16387
|
+
}
|
|
16388
|
+
/**
|
|
16389
|
+
* Creates a new brand
|
|
16390
|
+
*/
|
|
16391
|
+
async create(brand) {
|
|
16392
|
+
const now = /* @__PURE__ */ new Date();
|
|
16393
|
+
const newBrand = {
|
|
16394
|
+
...brand,
|
|
16395
|
+
createdAt: now,
|
|
16396
|
+
updatedAt: now,
|
|
16397
|
+
isActive: true
|
|
16398
|
+
};
|
|
16399
|
+
const docRef = await (0, import_firestore51.addDoc)(this.getBrandsRef(), newBrand);
|
|
16400
|
+
return { id: docRef.id, ...newBrand };
|
|
16401
|
+
}
|
|
16402
|
+
/**
|
|
16403
|
+
* Gets all active brands
|
|
16404
|
+
*/
|
|
16405
|
+
async getAll() {
|
|
16406
|
+
const q = (0, import_firestore51.query)(this.getBrandsRef(), (0, import_firestore51.where)("isActive", "==", true));
|
|
16407
|
+
const snapshot = await (0, import_firestore51.getDocs)(q);
|
|
16408
|
+
return snapshot.docs.map(
|
|
16409
|
+
(doc38) => ({
|
|
16410
|
+
id: doc38.id,
|
|
16411
|
+
...doc38.data()
|
|
16412
|
+
})
|
|
16413
|
+
);
|
|
16414
|
+
}
|
|
16415
|
+
/**
|
|
16416
|
+
* Updates a brand
|
|
16417
|
+
*/
|
|
16418
|
+
async update(brandId, brand) {
|
|
16419
|
+
const updateData = {
|
|
16420
|
+
...brand,
|
|
16421
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
16422
|
+
};
|
|
16423
|
+
const docRef = (0, import_firestore51.doc)(this.getBrandsRef(), brandId);
|
|
16424
|
+
await (0, import_firestore51.updateDoc)(docRef, updateData);
|
|
16425
|
+
return this.getById(brandId);
|
|
16426
|
+
}
|
|
16427
|
+
/**
|
|
16428
|
+
* Soft deletes a brand
|
|
16429
|
+
*/
|
|
16430
|
+
async delete(brandId) {
|
|
16431
|
+
await this.update(brandId, {
|
|
16432
|
+
isActive: false
|
|
16433
|
+
});
|
|
16434
|
+
}
|
|
16435
|
+
/**
|
|
16436
|
+
* Gets a brand by ID
|
|
16437
|
+
*/
|
|
16438
|
+
async getById(brandId) {
|
|
16439
|
+
const docRef = (0, import_firestore51.doc)(this.getBrandsRef(), brandId);
|
|
16440
|
+
const docSnap = await (0, import_firestore51.getDoc)(docRef);
|
|
16441
|
+
if (!docSnap.exists()) return null;
|
|
16442
|
+
return {
|
|
16443
|
+
id: docSnap.id,
|
|
16444
|
+
...docSnap.data()
|
|
16445
|
+
};
|
|
16446
|
+
}
|
|
16447
|
+
};
|
|
16448
|
+
|
|
16449
|
+
// src/backoffice/services/category.service.ts
|
|
16450
|
+
var import_firestore52 = require("firebase/firestore");
|
|
16451
|
+
|
|
16452
|
+
// src/backoffice/types/category.types.ts
|
|
16453
|
+
var CATEGORIES_COLLECTION = "backoffice_categories";
|
|
16454
|
+
|
|
16455
|
+
// src/backoffice/services/category.service.ts
|
|
16456
|
+
var CategoryService = class extends BaseService {
|
|
16457
|
+
/**
|
|
16458
|
+
* Referenca na Firestore kolekciju kategorija
|
|
16459
|
+
*/
|
|
16460
|
+
get categoriesRef() {
|
|
16461
|
+
return (0, import_firestore52.collection)(this.db, CATEGORIES_COLLECTION);
|
|
16462
|
+
}
|
|
16463
|
+
/**
|
|
16464
|
+
* Kreira novu kategoriju u sistemu
|
|
16465
|
+
* @param category - Podaci za novu kategoriju
|
|
16466
|
+
* @returns Kreirana kategorija sa generisanim ID-em
|
|
16467
|
+
*/
|
|
16468
|
+
async create(category) {
|
|
16469
|
+
const now = /* @__PURE__ */ new Date();
|
|
16470
|
+
const newCategory = {
|
|
16471
|
+
...category,
|
|
16472
|
+
createdAt: now,
|
|
16473
|
+
updatedAt: now,
|
|
16474
|
+
isActive: true
|
|
16475
|
+
};
|
|
16476
|
+
const docRef = await (0, import_firestore52.addDoc)(this.categoriesRef, newCategory);
|
|
16477
|
+
return { id: docRef.id, ...newCategory };
|
|
16478
|
+
}
|
|
16479
|
+
/**
|
|
16480
|
+
* Vraća sve aktivne kategorije
|
|
16481
|
+
* @returns Lista aktivnih kategorija
|
|
16482
|
+
*/
|
|
16483
|
+
async getAll() {
|
|
16484
|
+
const q = (0, import_firestore52.query)(this.categoriesRef, (0, import_firestore52.where)("isActive", "==", true));
|
|
16485
|
+
const snapshot = await (0, import_firestore52.getDocs)(q);
|
|
16486
|
+
return snapshot.docs.map(
|
|
16487
|
+
(doc38) => ({
|
|
16488
|
+
id: doc38.id,
|
|
16489
|
+
...doc38.data()
|
|
16490
|
+
})
|
|
16491
|
+
);
|
|
16492
|
+
}
|
|
16493
|
+
/**
|
|
16494
|
+
* Vraća sve aktivne kategorije za određenu familiju procedura
|
|
16495
|
+
* @param family - Familija procedura (aesthetics/surgery)
|
|
16496
|
+
* @returns Lista kategorija koje pripadaju traženoj familiji
|
|
16497
|
+
*/
|
|
16498
|
+
async getAllByFamily(family) {
|
|
16499
|
+
const q = (0, import_firestore52.query)(
|
|
16500
|
+
this.categoriesRef,
|
|
16501
|
+
(0, import_firestore52.where)("family", "==", family),
|
|
16502
|
+
(0, import_firestore52.where)("isActive", "==", true)
|
|
16503
|
+
);
|
|
16504
|
+
const snapshot = await (0, import_firestore52.getDocs)(q);
|
|
16505
|
+
return snapshot.docs.map(
|
|
16506
|
+
(doc38) => ({
|
|
16507
|
+
id: doc38.id,
|
|
16508
|
+
...doc38.data()
|
|
16509
|
+
})
|
|
16510
|
+
);
|
|
16511
|
+
}
|
|
16512
|
+
/**
|
|
16513
|
+
* Ažurira postojeću kategoriju
|
|
16514
|
+
* @param id - ID kategorije koja se ažurira
|
|
16515
|
+
* @param category - Novi podaci za kategoriju
|
|
16516
|
+
* @returns Ažurirana kategorija
|
|
16517
|
+
*/
|
|
16518
|
+
async update(id, category) {
|
|
16519
|
+
const updateData = {
|
|
16520
|
+
...category,
|
|
16521
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
16522
|
+
};
|
|
16523
|
+
const docRef = (0, import_firestore52.doc)(this.categoriesRef, id);
|
|
16524
|
+
await (0, import_firestore52.updateDoc)(docRef, updateData);
|
|
16525
|
+
return this.getById(id);
|
|
16526
|
+
}
|
|
16527
|
+
/**
|
|
16528
|
+
* Soft delete kategorije (postavlja isActive na false)
|
|
16529
|
+
* @param id - ID kategorije koja se briše
|
|
16530
|
+
*/
|
|
16531
|
+
async delete(id) {
|
|
16532
|
+
await this.update(id, { isActive: false });
|
|
16533
|
+
}
|
|
16534
|
+
/**
|
|
16535
|
+
* Vraća kategoriju po ID-u
|
|
16536
|
+
* @param id - ID tražene kategorije
|
|
16537
|
+
* @returns Kategorija ili null ako ne postoji
|
|
16538
|
+
*/
|
|
16539
|
+
async getById(id) {
|
|
16540
|
+
const docRef = (0, import_firestore52.doc)(this.categoriesRef, id);
|
|
16541
|
+
const docSnap = await (0, import_firestore52.getDoc)(docRef);
|
|
16542
|
+
if (!docSnap.exists()) return null;
|
|
16543
|
+
return {
|
|
16544
|
+
id: docSnap.id,
|
|
16545
|
+
...docSnap.data()
|
|
16546
|
+
};
|
|
16547
|
+
}
|
|
16548
|
+
};
|
|
16549
|
+
|
|
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
|
+
// src/backoffice/services/subcategory.service.ts
|
|
16855
|
+
var import_firestore55 = require("firebase/firestore");
|
|
16856
|
+
|
|
16857
|
+
// src/backoffice/types/subcategory.types.ts
|
|
16858
|
+
var SUBCATEGORIES_COLLECTION = "subcategories";
|
|
16859
|
+
|
|
16860
|
+
// src/backoffice/services/subcategory.service.ts
|
|
16861
|
+
var SubcategoryService = class extends BaseService {
|
|
16862
|
+
/**
|
|
16863
|
+
* Vraća referencu na Firestore kolekciju podkategorija za određenu kategoriju
|
|
16864
|
+
* @param categoryId - ID roditeljske kategorije
|
|
16865
|
+
*/
|
|
16866
|
+
getSubcategoriesRef(categoryId) {
|
|
16867
|
+
return (0, import_firestore55.collection)(
|
|
16868
|
+
this.db,
|
|
16869
|
+
CATEGORIES_COLLECTION,
|
|
16870
|
+
categoryId,
|
|
16871
|
+
SUBCATEGORIES_COLLECTION
|
|
16872
|
+
);
|
|
16873
|
+
}
|
|
16874
|
+
/**
|
|
16875
|
+
* Kreira novu podkategoriju u okviru kategorije
|
|
16876
|
+
* @param categoryId - ID kategorije kojoj će pripadati nova podkategorija
|
|
16877
|
+
* @param subcategory - Podaci za novu podkategoriju
|
|
16878
|
+
* @returns Kreirana podkategorija sa generisanim ID-em
|
|
16879
|
+
*/
|
|
16880
|
+
async create(categoryId, subcategory) {
|
|
16881
|
+
const now = /* @__PURE__ */ new Date();
|
|
16882
|
+
const newSubcategory = {
|
|
16883
|
+
...subcategory,
|
|
16884
|
+
categoryId,
|
|
16885
|
+
createdAt: now,
|
|
16886
|
+
updatedAt: now,
|
|
16887
|
+
isActive: true
|
|
16888
|
+
};
|
|
16889
|
+
const docRef = await (0, import_firestore55.addDoc)(
|
|
16890
|
+
this.getSubcategoriesRef(categoryId),
|
|
16891
|
+
newSubcategory
|
|
16892
|
+
);
|
|
16893
|
+
return { id: docRef.id, ...newSubcategory };
|
|
16894
|
+
}
|
|
16895
|
+
/**
|
|
16896
|
+
* Vraća sve aktivne podkategorije za određenu kategoriju
|
|
16897
|
+
* @param categoryId - ID kategorije čije podkategorije tražimo
|
|
16898
|
+
* @returns Lista aktivnih podkategorija
|
|
16899
|
+
*/
|
|
16900
|
+
async getAllByCategoryId(categoryId) {
|
|
16901
|
+
const q = (0, import_firestore55.query)(
|
|
16902
|
+
this.getSubcategoriesRef(categoryId),
|
|
16903
|
+
(0, import_firestore55.where)("isActive", "==", true)
|
|
16904
|
+
);
|
|
16905
|
+
const snapshot = await (0, import_firestore55.getDocs)(q);
|
|
16906
|
+
return snapshot.docs.map(
|
|
16907
|
+
(doc38) => ({
|
|
16908
|
+
id: doc38.id,
|
|
16909
|
+
...doc38.data()
|
|
16910
|
+
})
|
|
16911
|
+
);
|
|
16912
|
+
}
|
|
16913
|
+
/**
|
|
16914
|
+
* Ažurira postojeću podkategoriju
|
|
16915
|
+
* @param categoryId - ID kategorije kojoj pripada podkategorija
|
|
16916
|
+
* @param subcategoryId - ID podkategorije koja se ažurira
|
|
16917
|
+
* @param subcategory - Novi podaci za podkategoriju
|
|
16918
|
+
* @returns Ažurirana podkategorija
|
|
16919
|
+
*/
|
|
16920
|
+
async update(categoryId, subcategoryId, subcategory) {
|
|
16921
|
+
const updateData = {
|
|
16922
|
+
...subcategory,
|
|
16923
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
16924
|
+
};
|
|
16925
|
+
const docRef = (0, import_firestore55.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
16926
|
+
await (0, import_firestore55.updateDoc)(docRef, updateData);
|
|
16927
|
+
return this.getById(categoryId, subcategoryId);
|
|
16928
|
+
}
|
|
16929
|
+
/**
|
|
16930
|
+
* Soft delete podkategorije (postavlja isActive na false)
|
|
16931
|
+
* @param categoryId - ID kategorije kojoj pripada podkategorija
|
|
16932
|
+
* @param subcategoryId - ID podkategorije koja se briše
|
|
16933
|
+
*/
|
|
16934
|
+
async delete(categoryId, subcategoryId) {
|
|
16935
|
+
await this.update(categoryId, subcategoryId, { isActive: false });
|
|
16936
|
+
}
|
|
16937
|
+
/**
|
|
16938
|
+
* Vraća podkategoriju po ID-u
|
|
16939
|
+
* @param categoryId - ID kategorije kojoj pripada podkategorija
|
|
16940
|
+
* @param subcategoryId - ID tražene podkategorije
|
|
16941
|
+
* @returns Podkategorija ili null ako ne postoji
|
|
16942
|
+
*/
|
|
16943
|
+
async getById(categoryId, subcategoryId) {
|
|
16944
|
+
const docRef = (0, import_firestore55.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
16945
|
+
const docSnap = await (0, import_firestore55.getDoc)(docRef);
|
|
16946
|
+
if (!docSnap.exists()) return null;
|
|
16947
|
+
return {
|
|
16948
|
+
id: docSnap.id,
|
|
16949
|
+
...docSnap.data()
|
|
16950
|
+
};
|
|
16951
|
+
}
|
|
16952
|
+
};
|
|
16953
|
+
|
|
16954
|
+
// src/backoffice/services/technology.service.ts
|
|
16955
|
+
var import_firestore56 = require("firebase/firestore");
|
|
16956
|
+
var DEFAULT_CERTIFICATION_REQUIREMENT = {
|
|
16957
|
+
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
16958
|
+
requiredSpecialties: []
|
|
16959
|
+
};
|
|
16960
|
+
var TechnologyService = class extends BaseService {
|
|
16961
|
+
/**
|
|
16962
|
+
* Vraća referencu na Firestore kolekciju tehnologija
|
|
16963
|
+
*/
|
|
16964
|
+
getTechnologiesRef() {
|
|
16965
|
+
return (0, import_firestore56.collection)(this.db, TECHNOLOGIES_COLLECTION);
|
|
16966
|
+
}
|
|
16967
|
+
/**
|
|
16968
|
+
* Kreira novu tehnologiju
|
|
16969
|
+
* @param technology - Podaci za novu tehnologiju
|
|
16970
|
+
* @returns Kreirana tehnologija sa generisanim ID-em
|
|
16971
|
+
*/
|
|
16972
|
+
async create(technology) {
|
|
16973
|
+
const now = /* @__PURE__ */ new Date();
|
|
16974
|
+
const newTechnology = {
|
|
16975
|
+
...technology,
|
|
16976
|
+
createdAt: now,
|
|
16977
|
+
updatedAt: now,
|
|
16978
|
+
isActive: true,
|
|
16979
|
+
requirements: technology.requirements || {
|
|
16980
|
+
pre: [],
|
|
16981
|
+
post: []
|
|
16982
|
+
},
|
|
16983
|
+
blockingConditions: technology.blockingConditions || [],
|
|
16984
|
+
contraindications: technology.contraindications || [],
|
|
16985
|
+
benefits: technology.benefits || [],
|
|
16986
|
+
certificationRequirement: technology.certificationRequirement || DEFAULT_CERTIFICATION_REQUIREMENT
|
|
16987
|
+
};
|
|
16988
|
+
const docRef = await (0, import_firestore56.addDoc)(this.getTechnologiesRef(), newTechnology);
|
|
16989
|
+
return { id: docRef.id, ...newTechnology };
|
|
16990
|
+
}
|
|
16991
|
+
/**
|
|
16992
|
+
* Vraća sve aktivne tehnologije
|
|
16993
|
+
* @returns Lista aktivnih tehnologija
|
|
16994
|
+
*/
|
|
16995
|
+
async getAll() {
|
|
16996
|
+
const q = (0, import_firestore56.query)(this.getTechnologiesRef(), (0, import_firestore56.where)("isActive", "==", true));
|
|
16997
|
+
const snapshot = await (0, import_firestore56.getDocs)(q);
|
|
16998
|
+
return snapshot.docs.map(
|
|
16999
|
+
(doc38) => ({
|
|
17000
|
+
id: doc38.id,
|
|
17001
|
+
...doc38.data()
|
|
17002
|
+
})
|
|
17003
|
+
);
|
|
17004
|
+
}
|
|
17005
|
+
/**
|
|
17006
|
+
* Vraća sve aktivne tehnologije za određenu familiju
|
|
17007
|
+
* @param family - Familija procedura
|
|
17008
|
+
* @returns Lista aktivnih tehnologija
|
|
17009
|
+
*/
|
|
17010
|
+
async getAllByFamily(family) {
|
|
17011
|
+
const q = (0, import_firestore56.query)(
|
|
17012
|
+
this.getTechnologiesRef(),
|
|
17013
|
+
(0, import_firestore56.where)("isActive", "==", true),
|
|
17014
|
+
(0, import_firestore56.where)("family", "==", family)
|
|
17015
|
+
);
|
|
17016
|
+
const snapshot = await (0, import_firestore56.getDocs)(q);
|
|
17017
|
+
return snapshot.docs.map(
|
|
17018
|
+
(doc38) => ({
|
|
17019
|
+
id: doc38.id,
|
|
17020
|
+
...doc38.data()
|
|
17021
|
+
})
|
|
17022
|
+
);
|
|
17023
|
+
}
|
|
17024
|
+
/**
|
|
17025
|
+
* Vraća sve aktivne tehnologije za određenu kategoriju
|
|
17026
|
+
* @param categoryId - ID kategorije
|
|
17027
|
+
* @returns Lista aktivnih tehnologija
|
|
17028
|
+
*/
|
|
17029
|
+
async getAllByCategoryId(categoryId) {
|
|
17030
|
+
const q = (0, import_firestore56.query)(
|
|
17031
|
+
this.getTechnologiesRef(),
|
|
17032
|
+
(0, import_firestore56.where)("isActive", "==", true),
|
|
17033
|
+
(0, import_firestore56.where)("categoryId", "==", categoryId)
|
|
17034
|
+
);
|
|
17035
|
+
const snapshot = await (0, import_firestore56.getDocs)(q);
|
|
17036
|
+
return snapshot.docs.map(
|
|
17037
|
+
(doc38) => ({
|
|
17038
|
+
id: doc38.id,
|
|
17039
|
+
...doc38.data()
|
|
17040
|
+
})
|
|
17041
|
+
);
|
|
17042
|
+
}
|
|
17043
|
+
/**
|
|
17044
|
+
* Vraća sve aktivne tehnologije za određenu podkategoriju
|
|
17045
|
+
* @param subcategoryId - ID podkategorije
|
|
17046
|
+
* @returns Lista aktivnih tehnologija
|
|
17047
|
+
*/
|
|
17048
|
+
async getAllBySubcategoryId(subcategoryId) {
|
|
17049
|
+
const q = (0, import_firestore56.query)(
|
|
17050
|
+
this.getTechnologiesRef(),
|
|
17051
|
+
(0, import_firestore56.where)("isActive", "==", true),
|
|
17052
|
+
(0, import_firestore56.where)("subcategoryId", "==", subcategoryId)
|
|
17053
|
+
);
|
|
17054
|
+
const snapshot = await (0, import_firestore56.getDocs)(q);
|
|
17055
|
+
return snapshot.docs.map(
|
|
17056
|
+
(doc38) => ({
|
|
17057
|
+
id: doc38.id,
|
|
17058
|
+
...doc38.data()
|
|
17059
|
+
})
|
|
17060
|
+
);
|
|
17061
|
+
}
|
|
17062
|
+
/**
|
|
17063
|
+
* Ažurira postojeću tehnologiju
|
|
17064
|
+
* @param technologyId - ID tehnologije
|
|
17065
|
+
* @param technology - Novi podaci za tehnologiju
|
|
17066
|
+
* @returns Ažurirana tehnologija
|
|
17067
|
+
*/
|
|
17068
|
+
async update(technologyId, technology) {
|
|
17069
|
+
const updateData = {
|
|
17070
|
+
...technology,
|
|
17071
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17072
|
+
};
|
|
17073
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17074
|
+
await (0, import_firestore56.updateDoc)(docRef, updateData);
|
|
17075
|
+
return this.getById(technologyId);
|
|
17076
|
+
}
|
|
17077
|
+
/**
|
|
17078
|
+
* Soft delete tehnologije (postavlja isActive na false)
|
|
17079
|
+
* @param technologyId - ID tehnologije koja se briše
|
|
17080
|
+
*/
|
|
17081
|
+
async delete(technologyId) {
|
|
17082
|
+
await this.update(technologyId, {
|
|
17083
|
+
isActive: false
|
|
17084
|
+
});
|
|
17085
|
+
}
|
|
17086
|
+
/**
|
|
17087
|
+
* Vraća tehnologiju po ID-u
|
|
17088
|
+
* @param technologyId - ID tražene tehnologije
|
|
17089
|
+
* @returns Tehnologija ili null ako ne postoji
|
|
17090
|
+
*/
|
|
17091
|
+
async getById(technologyId) {
|
|
17092
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17093
|
+
const docSnap = await (0, import_firestore56.getDoc)(docRef);
|
|
17094
|
+
if (!docSnap.exists()) return null;
|
|
17095
|
+
return {
|
|
17096
|
+
id: docSnap.id,
|
|
17097
|
+
...docSnap.data()
|
|
17098
|
+
};
|
|
17099
|
+
}
|
|
17100
|
+
/**
|
|
17101
|
+
* Dodaje novi zahtev tehnologiji
|
|
17102
|
+
* @param technologyId - ID tehnologije
|
|
17103
|
+
* @param requirement - Zahtev koji se dodaje
|
|
17104
|
+
* @returns Ažurirana tehnologija sa novim zahtevom
|
|
17105
|
+
*/
|
|
17106
|
+
async addRequirement(technologyId, requirement) {
|
|
17107
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17108
|
+
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
17109
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17110
|
+
[requirementType]: (0, import_firestore56.arrayUnion)(requirement),
|
|
17111
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17112
|
+
});
|
|
17113
|
+
return this.getById(technologyId);
|
|
17114
|
+
}
|
|
17115
|
+
/**
|
|
17116
|
+
* Uklanja zahtev iz tehnologije
|
|
17117
|
+
* @param technologyId - ID tehnologije
|
|
17118
|
+
* @param requirement - Zahtev koji se uklanja
|
|
17119
|
+
* @returns Ažurirana tehnologija bez uklonjenog zahteva
|
|
17120
|
+
*/
|
|
17121
|
+
async removeRequirement(technologyId, requirement) {
|
|
17122
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17123
|
+
const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
|
|
17124
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17125
|
+
[requirementType]: (0, import_firestore56.arrayRemove)(requirement),
|
|
17126
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17127
|
+
});
|
|
17128
|
+
return this.getById(technologyId);
|
|
17129
|
+
}
|
|
17130
|
+
/**
|
|
17131
|
+
* Vraća sve zahteve za tehnologiju
|
|
17132
|
+
* @param technologyId - ID tehnologije
|
|
17133
|
+
* @param type - Opcioni filter za tip zahteva (pre/post)
|
|
17134
|
+
* @returns Lista zahteva
|
|
17135
|
+
*/
|
|
17136
|
+
async getRequirements(technologyId, type) {
|
|
17137
|
+
const technology = await this.getById(technologyId);
|
|
17138
|
+
if (!technology || !technology.requirements) return [];
|
|
17139
|
+
if (type) {
|
|
17140
|
+
return technology.requirements[type];
|
|
17141
|
+
}
|
|
17142
|
+
return [...technology.requirements.pre, ...technology.requirements.post];
|
|
17143
|
+
}
|
|
17144
|
+
/**
|
|
17145
|
+
* Ažurira postojeći zahtev
|
|
17146
|
+
* @param technologyId - ID tehnologije
|
|
17147
|
+
* @param oldRequirement - Stari zahtev koji se menja
|
|
17148
|
+
* @param newRequirement - Novi zahtev koji zamenjuje stari
|
|
17149
|
+
* @returns Ažurirana tehnologija
|
|
17150
|
+
*/
|
|
17151
|
+
async updateRequirement(technologyId, oldRequirement, newRequirement) {
|
|
17152
|
+
await this.removeRequirement(technologyId, oldRequirement);
|
|
17153
|
+
return this.addRequirement(technologyId, newRequirement);
|
|
17154
|
+
}
|
|
17155
|
+
/**
|
|
17156
|
+
* Dodaje blokirajući uslov tehnologiji
|
|
17157
|
+
* @param technologyId - ID tehnologije
|
|
17158
|
+
* @param condition - Blokirajući uslov koji se dodaje
|
|
17159
|
+
* @returns Ažurirana tehnologija
|
|
17160
|
+
*/
|
|
17161
|
+
async addBlockingCondition(technologyId, condition) {
|
|
17162
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17163
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17164
|
+
blockingConditions: (0, import_firestore56.arrayUnion)(condition),
|
|
17165
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17166
|
+
});
|
|
17167
|
+
return this.getById(technologyId);
|
|
17168
|
+
}
|
|
17169
|
+
/**
|
|
17170
|
+
* Uklanja blokirajući uslov iz tehnologije
|
|
17171
|
+
* @param technologyId - ID tehnologije
|
|
17172
|
+
* @param condition - Blokirajući uslov koji se uklanja
|
|
17173
|
+
* @returns Ažurirana tehnologija
|
|
17174
|
+
*/
|
|
17175
|
+
async removeBlockingCondition(technologyId, condition) {
|
|
17176
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17177
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17178
|
+
blockingConditions: (0, import_firestore56.arrayRemove)(condition),
|
|
17179
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17180
|
+
});
|
|
17181
|
+
return this.getById(technologyId);
|
|
17182
|
+
}
|
|
17183
|
+
/**
|
|
17184
|
+
* Dodaje kontraindikaciju tehnologiji
|
|
17185
|
+
* @param technologyId - ID tehnologije
|
|
17186
|
+
* @param contraindication - Kontraindikacija koja se dodaje
|
|
17187
|
+
* @returns Ažurirana tehnologija
|
|
17188
|
+
*/
|
|
17189
|
+
async addContraindication(technologyId, contraindication) {
|
|
17190
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17191
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17192
|
+
contraindications: (0, import_firestore56.arrayUnion)(contraindication),
|
|
17193
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17194
|
+
});
|
|
17195
|
+
return this.getById(technologyId);
|
|
17196
|
+
}
|
|
17197
|
+
/**
|
|
17198
|
+
* Uklanja kontraindikaciju iz tehnologije
|
|
17199
|
+
* @param technologyId - ID tehnologije
|
|
17200
|
+
* @param contraindication - Kontraindikacija koja se uklanja
|
|
17201
|
+
* @returns Ažurirana tehnologija
|
|
17202
|
+
*/
|
|
17203
|
+
async removeContraindication(technologyId, contraindication) {
|
|
17204
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17205
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17206
|
+
contraindications: (0, import_firestore56.arrayRemove)(contraindication),
|
|
17207
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17208
|
+
});
|
|
17209
|
+
return this.getById(technologyId);
|
|
17210
|
+
}
|
|
17211
|
+
/**
|
|
17212
|
+
* Dodaje benefit tehnologiji
|
|
17213
|
+
* @param technologyId - ID tehnologije
|
|
17214
|
+
* @param benefit - Benefit koji se dodaje
|
|
17215
|
+
* @returns Ažurirana tehnologija
|
|
17216
|
+
*/
|
|
17217
|
+
async addBenefit(technologyId, benefit) {
|
|
17218
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17219
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17220
|
+
benefits: (0, import_firestore56.arrayUnion)(benefit),
|
|
17221
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17222
|
+
});
|
|
17223
|
+
return this.getById(technologyId);
|
|
17224
|
+
}
|
|
17225
|
+
/**
|
|
17226
|
+
* Uklanja benefit iz tehnologije
|
|
17227
|
+
* @param technologyId - ID tehnologije
|
|
17228
|
+
* @param benefit - Benefit koji se uklanja
|
|
17229
|
+
* @returns Ažurirana tehnologija
|
|
17230
|
+
*/
|
|
17231
|
+
async removeBenefit(technologyId, benefit) {
|
|
17232
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17233
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17234
|
+
benefits: (0, import_firestore56.arrayRemove)(benefit),
|
|
17235
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17236
|
+
});
|
|
17237
|
+
return this.getById(technologyId);
|
|
17238
|
+
}
|
|
17239
|
+
/**
|
|
17240
|
+
* Vraća sve blokirajuće uslove za tehnologiju
|
|
17241
|
+
* @param technologyId - ID tehnologije
|
|
17242
|
+
* @returns Lista blokirajućih uslova
|
|
17243
|
+
*/
|
|
17244
|
+
async getBlockingConditions(technologyId) {
|
|
17245
|
+
const technology = await this.getById(technologyId);
|
|
17246
|
+
return (technology == null ? void 0 : technology.blockingConditions) || [];
|
|
17247
|
+
}
|
|
17248
|
+
/**
|
|
17249
|
+
* Vraća sve kontraindikacije za tehnologiju
|
|
17250
|
+
* @param technologyId - ID tehnologije
|
|
17251
|
+
* @returns Lista kontraindikacija
|
|
17252
|
+
*/
|
|
17253
|
+
async getContraindications(technologyId) {
|
|
17254
|
+
const technology = await this.getById(technologyId);
|
|
17255
|
+
return (technology == null ? void 0 : technology.contraindications) || [];
|
|
17256
|
+
}
|
|
17257
|
+
/**
|
|
17258
|
+
* Vraća sve benefite za tehnologiju
|
|
17259
|
+
* @param technologyId - ID tehnologije
|
|
17260
|
+
* @returns Lista benefita
|
|
17261
|
+
*/
|
|
17262
|
+
async getBenefits(technologyId) {
|
|
17263
|
+
const technology = await this.getById(technologyId);
|
|
17264
|
+
return (technology == null ? void 0 : technology.benefits) || [];
|
|
17265
|
+
}
|
|
17266
|
+
/**
|
|
17267
|
+
* Ažurira zahteve sertifikacije za tehnologiju
|
|
17268
|
+
* @param technologyId - ID tehnologije
|
|
17269
|
+
* @param certificationRequirement - Novi zahtevi sertifikacije
|
|
17270
|
+
* @returns Ažurirana tehnologija
|
|
17271
|
+
*/
|
|
17272
|
+
async updateCertificationRequirement(technologyId, certificationRequirement) {
|
|
17273
|
+
const docRef = (0, import_firestore56.doc)(this.getTechnologiesRef(), technologyId);
|
|
17274
|
+
await (0, import_firestore56.updateDoc)(docRef, {
|
|
17275
|
+
certificationRequirement,
|
|
17276
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
17277
|
+
});
|
|
17278
|
+
return this.getById(technologyId);
|
|
17279
|
+
}
|
|
17280
|
+
/**
|
|
17281
|
+
* Vraća zahteve sertifikacije za tehnologiju
|
|
17282
|
+
* @param technologyId - ID tehnologije
|
|
17283
|
+
* @returns Zahtevi sertifikacije ili null ako tehnologija ne postoji
|
|
17284
|
+
*/
|
|
17285
|
+
async getCertificationRequirement(technologyId) {
|
|
17286
|
+
const technology = await this.getById(technologyId);
|
|
17287
|
+
return (technology == null ? void 0 : technology.certificationRequirement) || null;
|
|
17288
|
+
}
|
|
17289
|
+
/**
|
|
17290
|
+
* Proverava da li doktor ima odgovarajuću sertifikaciju za izvođenje tehnologije
|
|
17291
|
+
*
|
|
17292
|
+
* @param requiredCertification - Zahtevana sertifikacija za tehnologiju
|
|
17293
|
+
* @param practitionerCertification - Sertifikacija zdravstvenog radnika
|
|
17294
|
+
* @returns true ako zdravstveni radnik ima odgovarajuću sertifikaciju, false ako nema
|
|
17295
|
+
*
|
|
17296
|
+
* @example
|
|
17297
|
+
* const isValid = technologyService.validateCertification(
|
|
17298
|
+
* {
|
|
17299
|
+
* minimumLevel: CertificationLevel.DOCTOR,
|
|
17300
|
+
* requiredSpecialties: [CertificationSpecialty.INJECTABLES]
|
|
17301
|
+
* },
|
|
17302
|
+
* {
|
|
17303
|
+
* level: CertificationLevel.SPECIALIST,
|
|
17304
|
+
* specialties: [CertificationSpecialty.INJECTABLES, CertificationSpecialty.LASER]
|
|
17305
|
+
* }
|
|
17306
|
+
* );
|
|
17307
|
+
*/
|
|
17308
|
+
validateCertification(requiredCertification, practitionerCertification) {
|
|
17309
|
+
const doctorLevel = Object.values(CertificationLevel).indexOf(
|
|
17310
|
+
practitionerCertification.level
|
|
17311
|
+
);
|
|
17312
|
+
const requiredLevel = Object.values(CertificationLevel).indexOf(
|
|
17313
|
+
requiredCertification.minimumLevel
|
|
17314
|
+
);
|
|
17315
|
+
if (doctorLevel < requiredLevel) return false;
|
|
17316
|
+
const requiredSpecialties = requiredCertification.requiredSpecialties || [];
|
|
17317
|
+
if (requiredSpecialties.length > 0) {
|
|
17318
|
+
const doctorSpecialties = practitionerCertification.specialties;
|
|
17319
|
+
const hasAllRequiredSpecialties = requiredSpecialties.every(
|
|
17320
|
+
(requiredSpecialty) => doctorSpecialties.includes(requiredSpecialty)
|
|
17321
|
+
);
|
|
17322
|
+
if (!hasAllRequiredSpecialties) return false;
|
|
17323
|
+
}
|
|
17324
|
+
return true;
|
|
17325
|
+
}
|
|
17326
|
+
/**
|
|
17327
|
+
* Vraća sve tehnologije koje je zdravstveni radnik sertifikovan da izvodi
|
|
17328
|
+
* zajedno sa listama dozvoljenih familija, kategorija i podkategorija
|
|
17329
|
+
*
|
|
17330
|
+
* @param practitioner - Profil zdravstvenog radnika
|
|
17331
|
+
* @returns Objekat koji sadrži:
|
|
17332
|
+
* - technologies: Lista tehnologija koje zdravstveni radnik može da izvodi
|
|
17333
|
+
* - families: Lista familija procedura koje zdravstveni radnik može da izvodi
|
|
17334
|
+
* - categories: Lista ID-eva kategorija koje zdravstveni radnik može da izvodi
|
|
17335
|
+
* - subcategories: Lista ID-eva podkategorija koje zdravstveni radnik može da izvodi
|
|
17336
|
+
*
|
|
17337
|
+
* @example
|
|
17338
|
+
* const practitioner = {
|
|
17339
|
+
* certification: {
|
|
17340
|
+
* level: CertificationLevel.DOCTOR,
|
|
17341
|
+
* specialties: [CertificationSpecialty.INJECTABLES]
|
|
17342
|
+
* }
|
|
17343
|
+
* };
|
|
17344
|
+
* const allowedTechnologies = await technologyService.getAllowedTechnologies(practitioner);
|
|
17345
|
+
* console.log(allowedTechnologies.families); // [ProcedureFamily.AESTHETICS]
|
|
17346
|
+
* console.log(allowedTechnologies.categories); // ["category1", "category2"]
|
|
17347
|
+
* console.log(allowedTechnologies.subcategories); // ["subcategory1", "subcategory2"]
|
|
17348
|
+
*/
|
|
17349
|
+
async getAllowedTechnologies(practitioner) {
|
|
17350
|
+
const allTechnologies = await this.getAll();
|
|
17351
|
+
const allowedTechnologies = allTechnologies.filter(
|
|
17352
|
+
(technology) => this.validateCertification(
|
|
17353
|
+
technology.certificationRequirement,
|
|
17354
|
+
practitioner.certification
|
|
17355
|
+
)
|
|
17356
|
+
);
|
|
17357
|
+
const families = [...new Set(allowedTechnologies.map((t) => t.family))];
|
|
17358
|
+
const categories = [
|
|
17359
|
+
...new Set(allowedTechnologies.map((t) => t.categoryId))
|
|
17360
|
+
];
|
|
17361
|
+
const subcategories = [
|
|
17362
|
+
...new Set(allowedTechnologies.map((t) => t.subcategoryId))
|
|
17363
|
+
];
|
|
17364
|
+
return {
|
|
17365
|
+
technologies: allowedTechnologies,
|
|
17366
|
+
families,
|
|
17367
|
+
categories,
|
|
17368
|
+
subcategories
|
|
17369
|
+
};
|
|
17370
|
+
}
|
|
17371
|
+
};
|
|
17372
|
+
|
|
17373
|
+
// src/backoffice/constants/certification.constants.ts
|
|
17374
|
+
var DEFAULT_CERTIFICATION_REQUIREMENT2 = {
|
|
17375
|
+
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
17376
|
+
requiredSpecialties: []
|
|
17377
|
+
};
|
|
17378
|
+
|
|
17379
|
+
// src/backoffice/errors/backoffice.errors.ts
|
|
17380
|
+
var BackofficeError = class extends Error {
|
|
17381
|
+
constructor(message) {
|
|
17382
|
+
super(message);
|
|
17383
|
+
this.name = "BackofficeError";
|
|
17384
|
+
}
|
|
17385
|
+
};
|
|
17386
|
+
var CategoryError = class extends BackofficeError {
|
|
17387
|
+
constructor(message) {
|
|
17388
|
+
super(message);
|
|
17389
|
+
this.name = "CategoryError";
|
|
17390
|
+
}
|
|
17391
|
+
};
|
|
17392
|
+
var CategoryNotFoundError = class extends CategoryError {
|
|
17393
|
+
constructor(id) {
|
|
17394
|
+
super(`Kategorija sa ID-em ${id} nije prona\u0111ena`);
|
|
17395
|
+
this.name = "CategoryNotFoundError";
|
|
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";
|
|
17480
|
+
}
|
|
17481
|
+
};
|
|
17482
|
+
var BlockingConditionError = class extends BackofficeError {
|
|
17483
|
+
constructor(message) {
|
|
17484
|
+
super(message);
|
|
17485
|
+
this.name = "BlockingConditionError";
|
|
17486
|
+
}
|
|
17487
|
+
};
|
|
17488
|
+
var InvalidBlockingConditionError = class extends BlockingConditionError {
|
|
17489
|
+
constructor(condition) {
|
|
17490
|
+
super(`Neva\u017Ee\u0107i blokiraju\u0107i uslov: ${condition}`);
|
|
17491
|
+
this.name = "InvalidBlockingConditionError";
|
|
17492
|
+
}
|
|
17493
|
+
};
|
|
17494
|
+
var ContraindicationError = class extends BackofficeError {
|
|
17495
|
+
constructor(message) {
|
|
17496
|
+
super(message);
|
|
17497
|
+
this.name = "ContraindicationError";
|
|
17498
|
+
}
|
|
17499
|
+
};
|
|
17500
|
+
var InvalidContraindicationError = class extends ContraindicationError {
|
|
17501
|
+
constructor(contraindication) {
|
|
17502
|
+
super(`Neva\u017Ee\u0107a kontraindikacija: ${contraindication}`);
|
|
17503
|
+
this.name = "InvalidContraindicationError";
|
|
17504
|
+
}
|
|
17505
|
+
};
|
|
17506
|
+
var TreatmentBenefitError = class extends BackofficeError {
|
|
17507
|
+
constructor(message) {
|
|
17508
|
+
super(message);
|
|
17509
|
+
this.name = "TreatmentBenefitError";
|
|
17510
|
+
}
|
|
17511
|
+
};
|
|
17512
|
+
var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
|
|
17513
|
+
constructor(benefit) {
|
|
17514
|
+
super(`Neva\u017Ee\u0107i benefit tretmana: ${benefit}`);
|
|
17515
|
+
this.name = "InvalidTreatmentBenefitError";
|
|
17516
|
+
}
|
|
17517
|
+
};
|
|
16303
17518
|
// Annotate the CommonJS export names for ESM import in node:
|
|
16304
17519
|
0 && (module.exports = {
|
|
16305
17520
|
APPOINTMENTS_COLLECTION,
|
|
@@ -16308,8 +17523,14 @@ var getFirebaseFunctions = async () => {
|
|
|
16308
17523
|
AppointmentService,
|
|
16309
17524
|
AppointmentStatus,
|
|
16310
17525
|
AuthService,
|
|
17526
|
+
BRANDS_COLLECTION,
|
|
17527
|
+
BackofficeError,
|
|
16311
17528
|
BaseService,
|
|
17529
|
+
BlockingCondition,
|
|
17530
|
+
BlockingConditionError,
|
|
17531
|
+
BrandService,
|
|
16312
17532
|
CALENDAR_COLLECTION,
|
|
17533
|
+
CATEGORIES_COLLECTION,
|
|
16313
17534
|
CLINICS_COLLECTION,
|
|
16314
17535
|
CLINIC_ADMINS_COLLECTION,
|
|
16315
17536
|
CLINIC_GROUPS_COLLECTION,
|
|
@@ -16318,17 +17539,28 @@ var getFirebaseFunctions = async () => {
|
|
|
16318
17539
|
CalendarServiceV2,
|
|
16319
17540
|
CalendarServiceV3,
|
|
16320
17541
|
CalendarSyncStatus,
|
|
17542
|
+
CategoryError,
|
|
17543
|
+
CategoryNotFoundError,
|
|
17544
|
+
CategoryService,
|
|
17545
|
+
CertificationLevel,
|
|
17546
|
+
CertificationSpecialty,
|
|
17547
|
+
CircularReferenceError,
|
|
16321
17548
|
ClinicAdminService,
|
|
16322
17549
|
ClinicGroupService,
|
|
16323
17550
|
ClinicPhotoTag,
|
|
16324
17551
|
ClinicService,
|
|
16325
17552
|
ClinicTag,
|
|
17553
|
+
Contraindication,
|
|
17554
|
+
ContraindicationError,
|
|
16326
17555
|
CosmeticAllergySubtype,
|
|
17556
|
+
Currency,
|
|
17557
|
+
DEFAULT_CERTIFICATION_REQUIREMENT,
|
|
16327
17558
|
DEFAULT_MEDICAL_INFO,
|
|
16328
17559
|
DOCTOR_FORMS_SUBCOLLECTION,
|
|
16329
17560
|
DOCUMENTATION_TEMPLATES_COLLECTION,
|
|
16330
17561
|
DocumentElementType,
|
|
16331
17562
|
DocumentationTemplateService,
|
|
17563
|
+
DocumentationTemplateServiceBackoffice,
|
|
16332
17564
|
DynamicVariable,
|
|
16333
17565
|
EnvironmentalAllergySubtype,
|
|
16334
17566
|
ExternalCalendarService,
|
|
@@ -16339,6 +17571,15 @@ var getFirebaseFunctions = async () => {
|
|
|
16339
17571
|
Gender,
|
|
16340
17572
|
HeadingLevel,
|
|
16341
17573
|
INVITE_TOKENS_COLLECTION,
|
|
17574
|
+
InvalidBlockingConditionError,
|
|
17575
|
+
InvalidCategoryDataError,
|
|
17576
|
+
InvalidContraindicationError,
|
|
17577
|
+
InvalidHierarchyError,
|
|
17578
|
+
InvalidRequirementDataError,
|
|
17579
|
+
InvalidSubcategoryDataError,
|
|
17580
|
+
InvalidTechnologyDataError,
|
|
17581
|
+
InvalidTimeframeError,
|
|
17582
|
+
InvalidTreatmentBenefitError,
|
|
16342
17583
|
Language,
|
|
16343
17584
|
ListType,
|
|
16344
17585
|
MEDIA_METADATA_COLLECTION,
|
|
@@ -16360,6 +17601,7 @@ var getFirebaseFunctions = async () => {
|
|
|
16360
17601
|
PRACTITIONERS_COLLECTION,
|
|
16361
17602
|
PRACTITIONER_INVITES_COLLECTION,
|
|
16362
17603
|
PROCEDURES_COLLECTION,
|
|
17604
|
+
PRODUCTS_COLLECTION,
|
|
16363
17605
|
PatientInstructionStatus,
|
|
16364
17606
|
PatientRequirementOverallStatus,
|
|
16365
17607
|
PatientRequirementsService,
|
|
@@ -16372,15 +17614,35 @@ var getFirebaseFunctions = async () => {
|
|
|
16372
17614
|
PractitionerService,
|
|
16373
17615
|
PractitionerStatus,
|
|
16374
17616
|
PractitionerTokenStatus,
|
|
17617
|
+
PricingMeasure,
|
|
17618
|
+
ProcedureFamily,
|
|
16375
17619
|
ProcedureService,
|
|
17620
|
+
ProductService,
|
|
16376
17621
|
REGISTER_TOKENS_COLLECTION,
|
|
17622
|
+
REQUIREMENTS_COLLECTION,
|
|
16377
17623
|
REVIEWS_COLLECTION,
|
|
17624
|
+
RelationshipError,
|
|
17625
|
+
RequirementError,
|
|
17626
|
+
RequirementNotFoundError,
|
|
17627
|
+
RequirementService,
|
|
17628
|
+
RequirementType,
|
|
16378
17629
|
ReviewService,
|
|
17630
|
+
SUBCATEGORIES_COLLECTION,
|
|
16379
17631
|
SYNCED_CALENDARS_COLLECTION,
|
|
16380
17632
|
SearchLocationEnum,
|
|
17633
|
+
SubcategoryError,
|
|
17634
|
+
SubcategoryNotFoundError,
|
|
17635
|
+
SubcategoryService,
|
|
16381
17636
|
SubscriptionModel,
|
|
16382
17637
|
SyncedCalendarProvider,
|
|
17638
|
+
TECHNOLOGIES_COLLECTION,
|
|
17639
|
+
TechnologyError,
|
|
17640
|
+
TechnologyNotFoundError,
|
|
17641
|
+
TechnologyService,
|
|
17642
|
+
TimeUnit,
|
|
16383
17643
|
TimestampUtils,
|
|
17644
|
+
TreatmentBenefit,
|
|
17645
|
+
TreatmentBenefitError,
|
|
16384
17646
|
USERS_COLLECTION,
|
|
16385
17647
|
USER_FORMS_SUBCOLLECTION,
|
|
16386
17648
|
UserRole,
|
|
@@ -16403,9 +17665,15 @@ var getFirebaseFunctions = async () => {
|
|
|
16403
17665
|
beforeAfterPerZoneSchema,
|
|
16404
17666
|
billingPerZoneSchema,
|
|
16405
17667
|
blockingConditionSchema,
|
|
17668
|
+
blockingConditionSchemaBackoffice,
|
|
16406
17669
|
buildPractitionerData,
|
|
16407
17670
|
calendarEventSchema,
|
|
16408
17671
|
calendarEventTimeSchema,
|
|
17672
|
+
categorySchema,
|
|
17673
|
+
categoryUpdateSchema,
|
|
17674
|
+
certificationLevelSchema,
|
|
17675
|
+
certificationRequirementSchema,
|
|
17676
|
+
certificationSpecialtySchema,
|
|
16409
17677
|
checkEmailExists,
|
|
16410
17678
|
cleanupFirebaseUser,
|
|
16411
17679
|
clinicAdminOptionsSchema,
|
|
@@ -16424,6 +17692,7 @@ var getFirebaseFunctions = async () => {
|
|
|
16424
17692
|
clinicTagsSchema,
|
|
16425
17693
|
contactPersonSchema,
|
|
16426
17694
|
contraindicationSchema,
|
|
17695
|
+
contraindicationSchemaBackoffice,
|
|
16427
17696
|
createAdminTokenSchema,
|
|
16428
17697
|
createAppointmentSchema,
|
|
16429
17698
|
createBlockingEventSchema,
|
|
@@ -16506,6 +17775,7 @@ var getFirebaseFunctions = async () => {
|
|
|
16506
17775
|
preRequirementNotificationSchema,
|
|
16507
17776
|
procedureCategorizationSchema,
|
|
16508
17777
|
procedureExtendedInfoSchema,
|
|
17778
|
+
procedureFamilySchemaBackoffice,
|
|
16509
17779
|
procedureInfoSchema,
|
|
16510
17780
|
procedureReviewInfoSchema,
|
|
16511
17781
|
procedureReviewSchema,
|
|
@@ -16514,15 +17784,26 @@ var getFirebaseFunctions = async () => {
|
|
|
16514
17784
|
requesterInfoSchema,
|
|
16515
17785
|
requirementImportanceSchema,
|
|
16516
17786
|
requirementInstructionDueNotificationSchema,
|
|
17787
|
+
requirementSchema,
|
|
17788
|
+
requirementTypeSchema,
|
|
17789
|
+
requirementUpdateSchema,
|
|
16517
17790
|
rescheduleAppointmentSchema,
|
|
16518
17791
|
reviewSchema,
|
|
16519
17792
|
searchAppointmentsSchema,
|
|
16520
17793
|
searchPatientsSchema,
|
|
16521
17794
|
sharedClinicContactInfoSchema,
|
|
16522
17795
|
sharedClinicLocationSchema,
|
|
17796
|
+
subcategorySchema,
|
|
17797
|
+
subcategoryUpdateSchema,
|
|
16523
17798
|
syncedCalendarEventSchema,
|
|
17799
|
+
technologyRequirementsSchema,
|
|
17800
|
+
technologySchema,
|
|
17801
|
+
technologyUpdateSchema,
|
|
16524
17802
|
timeSlotSchema,
|
|
17803
|
+
timeUnitSchemaBackoffice,
|
|
17804
|
+
timeframeSchema,
|
|
16525
17805
|
timestampSchema,
|
|
17806
|
+
treatmentBenefitSchemaBackoffice,
|
|
16526
17807
|
updateAllergySchema,
|
|
16527
17808
|
updateAppointmentSchema,
|
|
16528
17809
|
updateBlockingConditionSchema,
|