@blackcode_sa/metaestetics-api 1.8.7 → 1.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backoffice/index.d.mts +273 -364
- package/dist/backoffice/index.d.ts +273 -364
- package/dist/index.d.mts +313 -16255
- package/dist/index.d.ts +313 -16255
- package/dist/index.js +184 -1012
- package/dist/index.mjs +85 -768
- package/package.json +2 -2
- package/src/config/index.ts +9 -0
- package/src/index.ts +3 -3
- package/src/services/calendar/index.ts +1 -0
- package/src/services/clinic/clinic-admin.service.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -309,14 +309,14 @@ var updateFilledDocumentDataSchema = z.object({
|
|
|
309
309
|
});
|
|
310
310
|
|
|
311
311
|
// src/backoffice/types/static/pricing.types.ts
|
|
312
|
-
var PricingMeasure = /* @__PURE__ */ ((
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return
|
|
312
|
+
var PricingMeasure = /* @__PURE__ */ ((PricingMeasure2) => {
|
|
313
|
+
PricingMeasure2["PER_ML"] = "per_ml";
|
|
314
|
+
PricingMeasure2["PER_ZONE"] = "per_zone";
|
|
315
|
+
PricingMeasure2["PER_AREA"] = "per_area";
|
|
316
|
+
PricingMeasure2["PER_SESSION"] = "per_session";
|
|
317
|
+
PricingMeasure2["PER_TREATMENT"] = "per_treatment";
|
|
318
|
+
PricingMeasure2["PER_PACKAGE"] = "per_package";
|
|
319
|
+
return PricingMeasure2;
|
|
320
320
|
})(PricingMeasure || {});
|
|
321
321
|
var Currency = /* @__PURE__ */ ((Currency2) => {
|
|
322
322
|
Currency2["EUR"] = "EUR";
|
|
@@ -3893,8 +3893,8 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
|
|
|
3893
3893
|
return querySnapshot.docs.map((doc37) => doc37.data());
|
|
3894
3894
|
}
|
|
3895
3895
|
async function updateClinicAdmin(db, adminId, data) {
|
|
3896
|
-
const
|
|
3897
|
-
if (!
|
|
3896
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3897
|
+
if (!admin) {
|
|
3898
3898
|
throw new Error("Clinic admin not found");
|
|
3899
3899
|
}
|
|
3900
3900
|
const updatedData = {
|
|
@@ -3909,15 +3909,15 @@ async function updateClinicAdmin(db, adminId, data) {
|
|
|
3909
3909
|
return updatedAdmin;
|
|
3910
3910
|
}
|
|
3911
3911
|
async function deleteClinicAdmin(db, adminId) {
|
|
3912
|
-
const
|
|
3913
|
-
if (!
|
|
3912
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3913
|
+
if (!admin) {
|
|
3914
3914
|
throw new Error("Clinic admin not found");
|
|
3915
3915
|
}
|
|
3916
3916
|
await deleteDoc2(doc5(db, CLINIC_ADMINS_COLLECTION, adminId));
|
|
3917
3917
|
}
|
|
3918
3918
|
async function addClinicToManaged(db, adminId, clinicId, requesterId, clinicService) {
|
|
3919
|
-
const
|
|
3920
|
-
if (!
|
|
3919
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3920
|
+
if (!admin) {
|
|
3921
3921
|
throw new Error("Clinic admin not found");
|
|
3922
3922
|
}
|
|
3923
3923
|
if (requesterId && requesterId !== adminId) {
|
|
@@ -3925,22 +3925,22 @@ async function addClinicToManaged(db, adminId, clinicId, requesterId, clinicServ
|
|
|
3925
3925
|
if (!requester) {
|
|
3926
3926
|
throw new Error("Requester admin not found");
|
|
3927
3927
|
}
|
|
3928
|
-
if (!requester.isGroupOwner || requester.clinicGroupId !==
|
|
3928
|
+
if (!requester.isGroupOwner || requester.clinicGroupId !== admin.clinicGroupId) {
|
|
3929
3929
|
throw new Error("Only group owner can add clinics to other admins");
|
|
3930
3930
|
}
|
|
3931
3931
|
}
|
|
3932
|
-
if (
|
|
3932
|
+
if (admin.clinicsManaged.includes(clinicId)) {
|
|
3933
3933
|
return;
|
|
3934
3934
|
}
|
|
3935
3935
|
await updateClinicAdmin(db, adminId, {
|
|
3936
|
-
clinicsManaged: [...
|
|
3936
|
+
clinicsManaged: [...admin.clinicsManaged, clinicId]
|
|
3937
3937
|
});
|
|
3938
3938
|
if (clinicService) {
|
|
3939
3939
|
const clinic = await clinicService.getClinic(clinicId);
|
|
3940
3940
|
if (clinic) {
|
|
3941
3941
|
await updateClinicAdmin(db, adminId, {
|
|
3942
3942
|
clinicsManagedInfo: [
|
|
3943
|
-
...
|
|
3943
|
+
...admin.clinicsManagedInfo,
|
|
3944
3944
|
{
|
|
3945
3945
|
id: clinic.id,
|
|
3946
3946
|
featuredPhoto: clinic.featuredPhotos[0] || "",
|
|
@@ -3955,8 +3955,8 @@ async function addClinicToManaged(db, adminId, clinicId, requesterId, clinicServ
|
|
|
3955
3955
|
}
|
|
3956
3956
|
}
|
|
3957
3957
|
async function removeClinicFromManaged(db, adminId, clinicId, requesterId) {
|
|
3958
|
-
const
|
|
3959
|
-
if (!
|
|
3958
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3959
|
+
if (!admin) {
|
|
3960
3960
|
throw new Error("Clinic admin not found");
|
|
3961
3961
|
}
|
|
3962
3962
|
if (requesterId && requesterId !== adminId) {
|
|
@@ -3964,53 +3964,53 @@ async function removeClinicFromManaged(db, adminId, clinicId, requesterId) {
|
|
|
3964
3964
|
if (!requester) {
|
|
3965
3965
|
throw new Error("Requester admin not found");
|
|
3966
3966
|
}
|
|
3967
|
-
if (!requester.isGroupOwner || requester.clinicGroupId !==
|
|
3967
|
+
if (!requester.isGroupOwner || requester.clinicGroupId !== admin.clinicGroupId) {
|
|
3968
3968
|
throw new Error("Only group owner can remove clinics from other admins");
|
|
3969
3969
|
}
|
|
3970
3970
|
}
|
|
3971
|
-
if (!
|
|
3971
|
+
if (!admin.clinicsManaged.includes(clinicId)) {
|
|
3972
3972
|
return;
|
|
3973
3973
|
}
|
|
3974
3974
|
await updateClinicAdmin(db, adminId, {
|
|
3975
|
-
clinicsManaged:
|
|
3976
|
-
clinicsManagedInfo:
|
|
3975
|
+
clinicsManaged: admin.clinicsManaged.filter((id) => id !== clinicId),
|
|
3976
|
+
clinicsManagedInfo: admin.clinicsManagedInfo.filter(
|
|
3977
3977
|
(info) => info.id !== clinicId
|
|
3978
3978
|
)
|
|
3979
3979
|
});
|
|
3980
3980
|
}
|
|
3981
3981
|
async function getManagedClinics(db, adminId, clinicService) {
|
|
3982
|
-
const
|
|
3983
|
-
if (!
|
|
3982
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3983
|
+
if (!admin) {
|
|
3984
3984
|
throw new Error("Clinic admin not found");
|
|
3985
3985
|
}
|
|
3986
|
-
if (
|
|
3986
|
+
if (admin.clinicsManaged.length === 0) {
|
|
3987
3987
|
return [];
|
|
3988
3988
|
}
|
|
3989
3989
|
return clinicService.getClinicsByAdmin(adminId);
|
|
3990
3990
|
}
|
|
3991
3991
|
async function getActiveManagedClinics(db, adminId, clinicService) {
|
|
3992
|
-
const
|
|
3993
|
-
if (!
|
|
3992
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
3993
|
+
if (!admin) {
|
|
3994
3994
|
throw new Error("Clinic admin not found");
|
|
3995
3995
|
}
|
|
3996
|
-
if (
|
|
3996
|
+
if (admin.clinicsManaged.length === 0) {
|
|
3997
3997
|
return [];
|
|
3998
3998
|
}
|
|
3999
3999
|
return clinicService.getActiveClinicsByAdmin(adminId);
|
|
4000
4000
|
}
|
|
4001
4001
|
async function syncOwnerClinics(db, adminId, clinicService, clinicGroupService) {
|
|
4002
|
-
const
|
|
4003
|
-
if (!
|
|
4002
|
+
const admin = await getClinicAdmin(db, adminId);
|
|
4003
|
+
if (!admin) {
|
|
4004
4004
|
throw new Error("Clinic admin not found");
|
|
4005
4005
|
}
|
|
4006
|
-
if (!
|
|
4006
|
+
if (!admin.isGroupOwner) {
|
|
4007
4007
|
return;
|
|
4008
4008
|
}
|
|
4009
|
-
const group = await clinicGroupService.getClinicGroup(
|
|
4009
|
+
const group = await clinicGroupService.getClinicGroup(admin.clinicGroupId);
|
|
4010
4010
|
if (!group) {
|
|
4011
4011
|
throw new Error("Clinic group not found");
|
|
4012
4012
|
}
|
|
4013
|
-
const clinics = await clinicService.getClinicsByGroup(
|
|
4013
|
+
const clinics = await clinicService.getClinicsByGroup(admin.clinicGroupId);
|
|
4014
4014
|
await updateClinicAdmin(db, adminId, {
|
|
4015
4015
|
clinicsManaged: clinics.map((clinic) => clinic.id),
|
|
4016
4016
|
clinicsManagedInfo: clinics.map((clinic) => ({
|
|
@@ -8249,20 +8249,20 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
8249
8249
|
}
|
|
8250
8250
|
try {
|
|
8251
8251
|
console.log("[CLINIC] Checking admin permissions");
|
|
8252
|
-
const
|
|
8253
|
-
if (!
|
|
8252
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8253
|
+
if (!admin) {
|
|
8254
8254
|
console.error("[CLINIC] Admin not found", { adminId });
|
|
8255
8255
|
throw new Error("Admin not found");
|
|
8256
8256
|
}
|
|
8257
|
-
const hasPermission =
|
|
8257
|
+
const hasPermission = admin.isGroupOwner && admin.clinicGroupId === clinic.clinicGroupId || admin.clinicsManaged.includes(clinicId) && clinic.admins && clinic.admins.includes(adminId);
|
|
8258
8258
|
if (!hasPermission) {
|
|
8259
8259
|
console.error(
|
|
8260
8260
|
"[CLINIC] Admin does not have permission to update this clinic",
|
|
8261
8261
|
{
|
|
8262
8262
|
adminId,
|
|
8263
8263
|
clinicId,
|
|
8264
|
-
isGroupOwner:
|
|
8265
|
-
clinicsManaged:
|
|
8264
|
+
isGroupOwner: admin.isGroupOwner,
|
|
8265
|
+
clinicsManaged: admin.clinicsManaged,
|
|
8266
8266
|
isClinicAdmin: clinic.admins && clinic.admins.includes(adminId)
|
|
8267
8267
|
}
|
|
8268
8268
|
);
|
|
@@ -8412,13 +8412,13 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
8412
8412
|
return updatedClinic;
|
|
8413
8413
|
}
|
|
8414
8414
|
async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService, clinicGroupService) {
|
|
8415
|
-
const
|
|
8416
|
-
if (!
|
|
8415
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8416
|
+
if (!admin) {
|
|
8417
8417
|
throw new Error("Admin not found");
|
|
8418
8418
|
}
|
|
8419
|
-
let clinicIds = [...
|
|
8420
|
-
if (
|
|
8421
|
-
const group = await clinicGroupService.getClinicGroup(
|
|
8419
|
+
let clinicIds = [...admin.clinicsManaged];
|
|
8420
|
+
if (admin.isGroupOwner && options.includeGroupClinics) {
|
|
8421
|
+
const group = await clinicGroupService.getClinicGroup(admin.clinicGroupId);
|
|
8422
8422
|
if (group) {
|
|
8423
8423
|
clinicIds = [.../* @__PURE__ */ new Set([...clinicIds, ...group.clinics])];
|
|
8424
8424
|
}
|
|
@@ -8553,11 +8553,11 @@ async function addTags(db, clinicId, adminId, newTags, clinicAdminService, app)
|
|
|
8553
8553
|
if (!clinic) {
|
|
8554
8554
|
throw new Error("Clinic not found");
|
|
8555
8555
|
}
|
|
8556
|
-
const
|
|
8557
|
-
if (!
|
|
8556
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8557
|
+
if (!admin) {
|
|
8558
8558
|
throw new Error("Admin not found");
|
|
8559
8559
|
}
|
|
8560
|
-
const hasPermission =
|
|
8560
|
+
const hasPermission = admin.isGroupOwner && admin.clinicGroupId === clinic.clinicGroupId || admin.clinicsManaged.includes(clinicId) && clinic.admins && clinic.admins.includes(adminId);
|
|
8561
8561
|
if (!hasPermission) {
|
|
8562
8562
|
throw new Error("Admin does not have permission to update this clinic");
|
|
8563
8563
|
}
|
|
@@ -8578,11 +8578,11 @@ async function removeTags(db, clinicId, adminId, tagsToRemove, clinicAdminServic
|
|
|
8578
8578
|
if (!clinic) {
|
|
8579
8579
|
throw new Error("Clinic not found");
|
|
8580
8580
|
}
|
|
8581
|
-
const
|
|
8582
|
-
if (!
|
|
8581
|
+
const admin = await clinicAdminService.getClinicAdmin(adminId);
|
|
8582
|
+
if (!admin) {
|
|
8583
8583
|
throw new Error("Admin not found");
|
|
8584
8584
|
}
|
|
8585
|
-
const hasPermission =
|
|
8585
|
+
const hasPermission = admin.isGroupOwner && admin.clinicGroupId === clinic.clinicGroupId || admin.clinicsManaged.includes(clinicId) && clinic.admins && clinic.admins.includes(adminId);
|
|
8586
8586
|
if (!hasPermission) {
|
|
8587
8587
|
throw new Error("Admin does not have permission to update this clinic");
|
|
8588
8588
|
}
|
|
@@ -15784,576 +15784,6 @@ var ReviewService = class extends BaseService {
|
|
|
15784
15784
|
}
|
|
15785
15785
|
};
|
|
15786
15786
|
|
|
15787
|
-
// src/validations/calendar.schema.ts
|
|
15788
|
-
import { z as z27 } from "zod";
|
|
15789
|
-
import { Timestamp as Timestamp34 } from "firebase/firestore";
|
|
15790
|
-
|
|
15791
|
-
// src/validations/profile-info.schema.ts
|
|
15792
|
-
import { z as z26 } from "zod";
|
|
15793
|
-
import { Timestamp as Timestamp33 } from "firebase/firestore";
|
|
15794
|
-
var clinicBranchInfoSchema = z26.object({
|
|
15795
|
-
id: z26.string(),
|
|
15796
|
-
featuredPhoto: z26.string(),
|
|
15797
|
-
name: z26.string(),
|
|
15798
|
-
description: z26.string(),
|
|
15799
|
-
location: clinicLocationSchema,
|
|
15800
|
-
contactInfo: clinicContactInfoSchema
|
|
15801
|
-
});
|
|
15802
|
-
var practitionerProfileInfoSchema = z26.object({
|
|
15803
|
-
id: z26.string(),
|
|
15804
|
-
practitionerPhoto: z26.string().nullable(),
|
|
15805
|
-
name: z26.string(),
|
|
15806
|
-
email: z26.string().email(),
|
|
15807
|
-
phone: z26.string().nullable(),
|
|
15808
|
-
certification: practitionerCertificationSchema
|
|
15809
|
-
});
|
|
15810
|
-
var patientProfileInfoSchema = z26.object({
|
|
15811
|
-
id: z26.string(),
|
|
15812
|
-
fullName: z26.string(),
|
|
15813
|
-
email: z26.string().email(),
|
|
15814
|
-
phone: z26.string().nullable(),
|
|
15815
|
-
dateOfBirth: z26.instanceof(Timestamp33),
|
|
15816
|
-
gender: z26.nativeEnum(Gender)
|
|
15817
|
-
});
|
|
15818
|
-
|
|
15819
|
-
// src/validations/calendar.schema.ts
|
|
15820
|
-
var MIN_APPOINTMENT_DURATION2 = 15;
|
|
15821
|
-
var calendarEventTimeSchema = z27.object({
|
|
15822
|
-
start: z27.instanceof(Date).or(z27.instanceof(Timestamp34)),
|
|
15823
|
-
end: z27.instanceof(Date).or(z27.instanceof(Timestamp34))
|
|
15824
|
-
}).refine(
|
|
15825
|
-
(data) => {
|
|
15826
|
-
const startDate = data.start instanceof Timestamp34 ? data.start.toDate() : data.start;
|
|
15827
|
-
const endDate = data.end instanceof Timestamp34 ? data.end.toDate() : data.end;
|
|
15828
|
-
return startDate < endDate;
|
|
15829
|
-
},
|
|
15830
|
-
{
|
|
15831
|
-
message: "End time must be after start time",
|
|
15832
|
-
path: ["end"]
|
|
15833
|
-
}
|
|
15834
|
-
).refine(
|
|
15835
|
-
(data) => {
|
|
15836
|
-
const startDate = data.start instanceof Timestamp34 ? data.start.toDate() : data.start;
|
|
15837
|
-
return startDate > /* @__PURE__ */ new Date();
|
|
15838
|
-
},
|
|
15839
|
-
{
|
|
15840
|
-
message: "Appointment must be scheduled in the future",
|
|
15841
|
-
path: ["start"]
|
|
15842
|
-
}
|
|
15843
|
-
);
|
|
15844
|
-
var timeSlotSchema2 = z27.object({
|
|
15845
|
-
start: z27.date(),
|
|
15846
|
-
end: z27.date(),
|
|
15847
|
-
isAvailable: z27.boolean()
|
|
15848
|
-
}).refine((data) => data.start < data.end, {
|
|
15849
|
-
message: "End time must be after start time",
|
|
15850
|
-
path: ["end"]
|
|
15851
|
-
});
|
|
15852
|
-
var syncedCalendarEventSchema = z27.object({
|
|
15853
|
-
eventId: z27.string(),
|
|
15854
|
-
syncedCalendarProvider: z27.nativeEnum(SyncedCalendarProvider),
|
|
15855
|
-
syncedAt: z27.instanceof(Date).or(z27.instanceof(Timestamp34))
|
|
15856
|
-
});
|
|
15857
|
-
var procedureInfoSchema = z27.object({
|
|
15858
|
-
name: z27.string(),
|
|
15859
|
-
description: z27.string(),
|
|
15860
|
-
duration: z27.number().min(MIN_APPOINTMENT_DURATION2),
|
|
15861
|
-
price: z27.number().min(0),
|
|
15862
|
-
currency: z27.nativeEnum(Currency)
|
|
15863
|
-
});
|
|
15864
|
-
var procedureCategorizationSchema = z27.object({
|
|
15865
|
-
procedureFamily: z27.string(),
|
|
15866
|
-
// Replace with proper enum when available
|
|
15867
|
-
procedureCategory: z27.string(),
|
|
15868
|
-
// Replace with proper enum when available
|
|
15869
|
-
procedureSubcategory: z27.string(),
|
|
15870
|
-
// Replace with proper enum when available
|
|
15871
|
-
procedureTechnology: z27.string(),
|
|
15872
|
-
// Replace with proper enum when available
|
|
15873
|
-
procedureProduct: z27.string()
|
|
15874
|
-
// Replace with proper enum when available
|
|
15875
|
-
});
|
|
15876
|
-
var createCalendarEventSchema = z27.object({
|
|
15877
|
-
id: z27.string(),
|
|
15878
|
-
clinicBranchId: z27.string().nullable().optional(),
|
|
15879
|
-
clinicBranchInfo: clinicBranchInfoSchema.nullable().optional(),
|
|
15880
|
-
practitionerProfileId: z27.string().nullable().optional(),
|
|
15881
|
-
practitionerProfileInfo: practitionerProfileInfoSchema.nullable().optional(),
|
|
15882
|
-
patientProfileId: z27.string().nullable().optional(),
|
|
15883
|
-
patientProfileInfo: patientProfileInfoSchema.nullable().optional(),
|
|
15884
|
-
procedureId: z27.string().nullable().optional(),
|
|
15885
|
-
procedureInfo: procedureInfoSchema.nullable().optional(),
|
|
15886
|
-
procedureCategorization: procedureCategorizationSchema.nullable().optional(),
|
|
15887
|
-
appointmentId: z27.string().nullable().optional(),
|
|
15888
|
-
syncedCalendarEventId: z27.array(syncedCalendarEventSchema).nullable().optional(),
|
|
15889
|
-
eventName: z27.string(),
|
|
15890
|
-
eventLocation: clinicLocationSchema.optional(),
|
|
15891
|
-
eventTime: calendarEventTimeSchema,
|
|
15892
|
-
description: z27.string().optional(),
|
|
15893
|
-
status: z27.nativeEnum(CalendarEventStatus),
|
|
15894
|
-
syncStatus: z27.nativeEnum(CalendarSyncStatus),
|
|
15895
|
-
eventType: z27.nativeEnum(CalendarEventType),
|
|
15896
|
-
createdAt: z27.any(),
|
|
15897
|
-
// FieldValue for server timestamp
|
|
15898
|
-
updatedAt: z27.any()
|
|
15899
|
-
// FieldValue for server timestamp
|
|
15900
|
-
});
|
|
15901
|
-
var updateCalendarEventSchema = z27.object({
|
|
15902
|
-
syncedCalendarEventId: z27.array(syncedCalendarEventSchema).nullable().optional(),
|
|
15903
|
-
appointmentId: z27.string().nullable().optional(),
|
|
15904
|
-
eventName: z27.string().optional(),
|
|
15905
|
-
eventTime: calendarEventTimeSchema.optional(),
|
|
15906
|
-
description: z27.string().optional(),
|
|
15907
|
-
status: z27.nativeEnum(CalendarEventStatus).optional(),
|
|
15908
|
-
syncStatus: z27.nativeEnum(CalendarSyncStatus).optional(),
|
|
15909
|
-
eventType: z27.nativeEnum(CalendarEventType).optional(),
|
|
15910
|
-
updatedAt: z27.any()
|
|
15911
|
-
// FieldValue for server timestamp
|
|
15912
|
-
});
|
|
15913
|
-
var calendarEventSchema = z27.object({
|
|
15914
|
-
id: z27.string(),
|
|
15915
|
-
clinicBranchId: z27.string().nullable().optional(),
|
|
15916
|
-
clinicBranchInfo: clinicBranchInfoSchema.nullable().optional(),
|
|
15917
|
-
// Will be replaced with proper clinic info schema
|
|
15918
|
-
practitionerProfileId: z27.string().nullable().optional(),
|
|
15919
|
-
practitionerProfileInfo: practitionerProfileInfoSchema.nullable().optional(),
|
|
15920
|
-
patientProfileId: z27.string().nullable().optional(),
|
|
15921
|
-
patientProfileInfo: patientProfileInfoSchema.nullable().optional(),
|
|
15922
|
-
procedureId: z27.string().nullable().optional(),
|
|
15923
|
-
procedureInfo: procedureInfoSchema.nullable().optional(),
|
|
15924
|
-
procedureCategorization: procedureCategorizationSchema.nullable().optional(),
|
|
15925
|
-
appointmentId: z27.string().nullable().optional(),
|
|
15926
|
-
syncedCalendarEventId: z27.array(syncedCalendarEventSchema).nullable().optional(),
|
|
15927
|
-
eventName: z27.string(),
|
|
15928
|
-
eventLocation: clinicLocationSchema.optional(),
|
|
15929
|
-
eventTime: calendarEventTimeSchema,
|
|
15930
|
-
description: z27.string().optional(),
|
|
15931
|
-
status: z27.nativeEnum(CalendarEventStatus),
|
|
15932
|
-
syncStatus: z27.nativeEnum(CalendarSyncStatus),
|
|
15933
|
-
eventType: z27.nativeEnum(CalendarEventType),
|
|
15934
|
-
createdAt: z27.instanceof(Date).or(z27.instanceof(Timestamp34)),
|
|
15935
|
-
updatedAt: z27.instanceof(Date).or(z27.instanceof(Timestamp34))
|
|
15936
|
-
});
|
|
15937
|
-
var createBlockingEventSchema = z27.object({
|
|
15938
|
-
entityType: z27.enum(["practitioner", "clinic"]),
|
|
15939
|
-
entityId: z27.string().min(1, "Entity ID is required"),
|
|
15940
|
-
eventName: z27.string().min(1, "Event name is required").max(200, "Event name too long"),
|
|
15941
|
-
eventTime: calendarEventTimeSchema,
|
|
15942
|
-
eventType: z27.enum([
|
|
15943
|
-
"blocking" /* BLOCKING */,
|
|
15944
|
-
"break" /* BREAK */,
|
|
15945
|
-
"free_day" /* FREE_DAY */,
|
|
15946
|
-
"other" /* OTHER */
|
|
15947
|
-
]),
|
|
15948
|
-
description: z27.string().max(1e3, "Description too long").optional()
|
|
15949
|
-
});
|
|
15950
|
-
var updateBlockingEventSchema = z27.object({
|
|
15951
|
-
entityType: z27.enum(["practitioner", "clinic"]),
|
|
15952
|
-
entityId: z27.string().min(1, "Entity ID is required"),
|
|
15953
|
-
eventId: z27.string().min(1, "Event ID is required"),
|
|
15954
|
-
eventName: z27.string().min(1, "Event name is required").max(200, "Event name too long").optional(),
|
|
15955
|
-
eventTime: calendarEventTimeSchema.optional(),
|
|
15956
|
-
description: z27.string().max(1e3, "Description too long").optional()
|
|
15957
|
-
});
|
|
15958
|
-
|
|
15959
|
-
// src/validations/notification.schema.ts
|
|
15960
|
-
import { z as z28 } from "zod";
|
|
15961
|
-
var baseNotificationSchema = z28.object({
|
|
15962
|
-
id: z28.string().optional(),
|
|
15963
|
-
userId: z28.string(),
|
|
15964
|
-
notificationTime: z28.any(),
|
|
15965
|
-
// Timestamp
|
|
15966
|
-
notificationType: z28.nativeEnum(NotificationType),
|
|
15967
|
-
notificationTokens: z28.array(z28.string()),
|
|
15968
|
-
status: z28.nativeEnum(NotificationStatus),
|
|
15969
|
-
createdAt: z28.any().optional(),
|
|
15970
|
-
// Timestamp
|
|
15971
|
-
updatedAt: z28.any().optional(),
|
|
15972
|
-
// Timestamp
|
|
15973
|
-
title: z28.string(),
|
|
15974
|
-
body: z28.string(),
|
|
15975
|
-
isRead: z28.boolean(),
|
|
15976
|
-
userRole: z28.nativeEnum(UserRole)
|
|
15977
|
-
});
|
|
15978
|
-
var preRequirementNotificationSchema = baseNotificationSchema.extend({
|
|
15979
|
-
notificationType: z28.literal("preRequirementInstructionDue" /* PRE_REQUIREMENT_INSTRUCTION_DUE */),
|
|
15980
|
-
treatmentId: z28.string(),
|
|
15981
|
-
requirements: z28.array(z28.string()),
|
|
15982
|
-
deadline: z28.any()
|
|
15983
|
-
// Timestamp
|
|
15984
|
-
});
|
|
15985
|
-
var postRequirementNotificationSchema = baseNotificationSchema.extend({
|
|
15986
|
-
notificationType: z28.literal(
|
|
15987
|
-
"postRequirementInstructionDue" /* POST_REQUIREMENT_INSTRUCTION_DUE */
|
|
15988
|
-
),
|
|
15989
|
-
treatmentId: z28.string(),
|
|
15990
|
-
requirements: z28.array(z28.string()),
|
|
15991
|
-
deadline: z28.any()
|
|
15992
|
-
// Timestamp
|
|
15993
|
-
});
|
|
15994
|
-
var requirementInstructionDueNotificationSchema = baseNotificationSchema.extend({
|
|
15995
|
-
notificationType: z28.literal("requirementInstructionDue" /* REQUIREMENT_INSTRUCTION_DUE */),
|
|
15996
|
-
appointmentId: z28.string(),
|
|
15997
|
-
patientRequirementInstanceId: z28.string(),
|
|
15998
|
-
instructionId: z28.string(),
|
|
15999
|
-
originalRequirementId: z28.string().optional()
|
|
16000
|
-
});
|
|
16001
|
-
var appointmentReminderNotificationSchema = baseNotificationSchema.extend({
|
|
16002
|
-
notificationType: z28.literal("appointmentReminder" /* APPOINTMENT_REMINDER */),
|
|
16003
|
-
appointmentId: z28.string(),
|
|
16004
|
-
appointmentTime: z28.any(),
|
|
16005
|
-
// Timestamp
|
|
16006
|
-
treatmentType: z28.string(),
|
|
16007
|
-
doctorName: z28.string()
|
|
16008
|
-
});
|
|
16009
|
-
var appointmentNotificationSchema = baseNotificationSchema.extend({
|
|
16010
|
-
notificationType: z28.literal("appointmentStatusChange" /* APPOINTMENT_STATUS_CHANGE */),
|
|
16011
|
-
appointmentId: z28.string(),
|
|
16012
|
-
appointmentStatus: z28.string(),
|
|
16013
|
-
previousStatus: z28.string(),
|
|
16014
|
-
reason: z28.string().optional()
|
|
16015
|
-
});
|
|
16016
|
-
var notificationSchema = z28.discriminatedUnion("notificationType", [
|
|
16017
|
-
preRequirementNotificationSchema,
|
|
16018
|
-
postRequirementNotificationSchema,
|
|
16019
|
-
requirementInstructionDueNotificationSchema,
|
|
16020
|
-
appointmentReminderNotificationSchema,
|
|
16021
|
-
appointmentNotificationSchema
|
|
16022
|
-
]);
|
|
16023
|
-
|
|
16024
|
-
// src/validations/patient/patient-requirements.schema.ts
|
|
16025
|
-
import { z as z30 } from "zod";
|
|
16026
|
-
|
|
16027
|
-
// src/backoffice/validations/schemas.ts
|
|
16028
|
-
import { z as z29 } from "zod";
|
|
16029
|
-
|
|
16030
|
-
// src/backoffice/types/static/treatment-benefit.types.ts
|
|
16031
|
-
var TreatmentBenefit = /* @__PURE__ */ ((TreatmentBenefit2) => {
|
|
16032
|
-
TreatmentBenefit2["WRINKLE_REDUCTION"] = "wrinkle_reduction";
|
|
16033
|
-
TreatmentBenefit2["SKIN_TIGHTENING"] = "skin_tightening";
|
|
16034
|
-
TreatmentBenefit2["COLLAGEN_PRODUCTION"] = "collagen_production";
|
|
16035
|
-
TreatmentBenefit2["ACNE_REDUCTION"] = "acne_reduction";
|
|
16036
|
-
TreatmentBenefit2["SCAR_REDUCTION"] = "scar_reduction";
|
|
16037
|
-
TreatmentBenefit2["PIGMENTATION_IMPROVEMENT"] = "pigmentation_improvement";
|
|
16038
|
-
TreatmentBenefit2["HAIR_REMOVAL"] = "hair_removal";
|
|
16039
|
-
TreatmentBenefit2["MUSCLE_TONING"] = "muscle_toning";
|
|
16040
|
-
TreatmentBenefit2["FAT_REDUCTION"] = "fat_reduction";
|
|
16041
|
-
TreatmentBenefit2["CELLULITE_REDUCTION"] = "cellulite_reduction";
|
|
16042
|
-
TreatmentBenefit2["SKIN_REJUVENATION"] = "skin_rejuvenation";
|
|
16043
|
-
TreatmentBenefit2["PORE_REDUCTION"] = "pore_reduction";
|
|
16044
|
-
TreatmentBenefit2["TEXTURE_IMPROVEMENT"] = "texture_improvement";
|
|
16045
|
-
TreatmentBenefit2["HYDRATION_BOOST"] = "hydration_boost";
|
|
16046
|
-
TreatmentBenefit2["CIRCULATION_IMPROVEMENT"] = "circulation_improvement";
|
|
16047
|
-
return TreatmentBenefit2;
|
|
16048
|
-
})(TreatmentBenefit || {});
|
|
16049
|
-
|
|
16050
|
-
// src/backoffice/types/requirement.types.ts
|
|
16051
|
-
var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
|
|
16052
|
-
TimeUnit2["HOURS"] = "hours";
|
|
16053
|
-
TimeUnit2["DAYS"] = "days";
|
|
16054
|
-
return TimeUnit2;
|
|
16055
|
-
})(TimeUnit || {});
|
|
16056
|
-
var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
|
|
16057
|
-
RequirementType2["PRE"] = "pre";
|
|
16058
|
-
RequirementType2["POST"] = "post";
|
|
16059
|
-
return RequirementType2;
|
|
16060
|
-
})(RequirementType || {});
|
|
16061
|
-
|
|
16062
|
-
// src/backoffice/validations/schemas.ts
|
|
16063
|
-
var blockingConditionSchemaBackoffice = z29.nativeEnum(BlockingCondition);
|
|
16064
|
-
var contraindicationSchemaBackoffice = z29.nativeEnum(Contraindication);
|
|
16065
|
-
var treatmentBenefitSchemaBackoffice = z29.nativeEnum(TreatmentBenefit);
|
|
16066
|
-
var procedureFamilySchemaBackoffice = z29.nativeEnum(ProcedureFamily);
|
|
16067
|
-
var timeUnitSchemaBackoffice = z29.nativeEnum(TimeUnit);
|
|
16068
|
-
var requirementTypeSchema = z29.nativeEnum(RequirementType);
|
|
16069
|
-
var certificationLevelSchema = z29.nativeEnum(CertificationLevel);
|
|
16070
|
-
var certificationSpecialtySchema = z29.nativeEnum(
|
|
16071
|
-
CertificationSpecialty
|
|
16072
|
-
);
|
|
16073
|
-
var certificationRequirementSchema = z29.object({
|
|
16074
|
-
minimumLevel: certificationLevelSchema,
|
|
16075
|
-
requiredSpecialties: z29.array(certificationSpecialtySchema).max(5, "Maximum 5 specialties allowed").optional()
|
|
16076
|
-
});
|
|
16077
|
-
var timeframeSchema = z29.object({
|
|
16078
|
-
duration: z29.number().min(1, "Duration must be positive"),
|
|
16079
|
-
unit: timeUnitSchemaBackoffice,
|
|
16080
|
-
notifyAt: z29.array(z29.number()).min(1, "At least one notification point is required")
|
|
16081
|
-
});
|
|
16082
|
-
var requirementSchema = z29.object({
|
|
16083
|
-
name: z29.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
16084
|
-
description: z29.string().min(1, "Description is required"),
|
|
16085
|
-
type: requirementTypeSchema,
|
|
16086
|
-
timeframe: timeframeSchema,
|
|
16087
|
-
importance: z29.enum(["low", "medium", "high"]),
|
|
16088
|
-
isActive: z29.boolean().default(true)
|
|
16089
|
-
});
|
|
16090
|
-
var technologyRequirementsSchema = z29.object({
|
|
16091
|
-
pre: z29.array(requirementSchema),
|
|
16092
|
-
post: z29.array(requirementSchema)
|
|
16093
|
-
});
|
|
16094
|
-
var technologySchema = z29.object({
|
|
16095
|
-
name: z29.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
16096
|
-
description: z29.string().max(1e3, "Description is too long").optional(),
|
|
16097
|
-
technicalDetails: z29.string().max(2e3, "Technical details are too long").optional(),
|
|
16098
|
-
family: procedureFamilySchemaBackoffice,
|
|
16099
|
-
categoryId: z29.string().min(1, "Category ID is required"),
|
|
16100
|
-
subcategoryId: z29.string().min(1, "Subcategory ID is required"),
|
|
16101
|
-
requirements: technologyRequirementsSchema.default({
|
|
16102
|
-
pre: [],
|
|
16103
|
-
post: []
|
|
16104
|
-
}),
|
|
16105
|
-
blockingConditions: z29.array(blockingConditionSchemaBackoffice),
|
|
16106
|
-
contraindications: z29.array(contraindicationSchemaBackoffice),
|
|
16107
|
-
documentationTemplates: z29.array(documentTemplateSchema),
|
|
16108
|
-
benefits: z29.array(treatmentBenefitSchemaBackoffice),
|
|
16109
|
-
certificationRequirement: certificationRequirementSchema,
|
|
16110
|
-
isActive: z29.boolean().default(true)
|
|
16111
|
-
});
|
|
16112
|
-
var categorySchema = z29.object({
|
|
16113
|
-
name: z29.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
16114
|
-
description: z29.string().optional(),
|
|
16115
|
-
family: procedureFamilySchemaBackoffice,
|
|
16116
|
-
isActive: z29.boolean().default(true)
|
|
16117
|
-
});
|
|
16118
|
-
var subcategorySchema = z29.object({
|
|
16119
|
-
name: z29.string().min(1, "Name is required").max(100, "Name is too long"),
|
|
16120
|
-
description: z29.string().optional(),
|
|
16121
|
-
categoryId: z29.string().min(1, "Category ID is required"),
|
|
16122
|
-
isActive: z29.boolean().default(true)
|
|
16123
|
-
});
|
|
16124
|
-
var categoryUpdateSchema = categorySchema.partial();
|
|
16125
|
-
var subcategoryUpdateSchema = subcategorySchema.partial();
|
|
16126
|
-
var technologyUpdateSchema = technologySchema.partial();
|
|
16127
|
-
var requirementUpdateSchema = requirementSchema.partial();
|
|
16128
|
-
|
|
16129
|
-
// src/validations/patient/patient-requirements.schema.ts
|
|
16130
|
-
var patientInstructionStatusSchema = z30.nativeEnum(
|
|
16131
|
-
PatientInstructionStatus
|
|
16132
|
-
);
|
|
16133
|
-
var patientRequirementInstructionSchema = z30.object({
|
|
16134
|
-
instructionId: z30.string().min(1, "Instruction ID is required."),
|
|
16135
|
-
instructionText: z30.string().min(1, "Instruction text is required."),
|
|
16136
|
-
dueTime: z30.any(),
|
|
16137
|
-
// Firestore Timestamp
|
|
16138
|
-
actionableWindow: z30.number().default(1),
|
|
16139
|
-
status: patientInstructionStatusSchema,
|
|
16140
|
-
originalNotifyAtValue: z30.number(),
|
|
16141
|
-
originalTimeframeUnit: timeUnitSchemaBackoffice,
|
|
16142
|
-
// Use the correctly imported timeUnitSchema
|
|
16143
|
-
notificationId: z30.string().optional(),
|
|
16144
|
-
actionTakenAt: z30.any().optional().nullable(),
|
|
16145
|
-
// Firestore Timestamp or null
|
|
16146
|
-
updatedAt: z30.any()
|
|
16147
|
-
// Firestore Timestamp
|
|
16148
|
-
});
|
|
16149
|
-
var patientRequirementOverallStatusSchema = z30.nativeEnum(
|
|
16150
|
-
PatientRequirementOverallStatus
|
|
16151
|
-
);
|
|
16152
|
-
var requirementImportanceSchema = z30.enum(["low", "medium", "high"]);
|
|
16153
|
-
var patientRequirementInstanceSchema = z30.object({
|
|
16154
|
-
id: z30.string().min(1, "Instance ID is required."),
|
|
16155
|
-
patientId: z30.string().min(1, "Patient ID is required."),
|
|
16156
|
-
appointmentId: z30.string().min(1, "Appointment ID is required."),
|
|
16157
|
-
originalRequirementId: z30.string().min(1, "Original Requirement ID is required."),
|
|
16158
|
-
requirementType: requirementTypeSchema,
|
|
16159
|
-
requirementName: z30.string().min(1, "Requirement name is required."),
|
|
16160
|
-
requirementDescription: z30.string(),
|
|
16161
|
-
requirementImportance: requirementImportanceSchema,
|
|
16162
|
-
// Use the locally defined schema
|
|
16163
|
-
overallStatus: patientRequirementOverallStatusSchema,
|
|
16164
|
-
instructions: z30.array(patientRequirementInstructionSchema).min(1, "At least one instruction is required."),
|
|
16165
|
-
createdAt: z30.any(),
|
|
16166
|
-
// Firestore Timestamp
|
|
16167
|
-
updatedAt: z30.any()
|
|
16168
|
-
// Firestore Timestamp
|
|
16169
|
-
});
|
|
16170
|
-
var updatePatientInstructionStatusSchema = z30.object({
|
|
16171
|
-
status: z30.literal("actionTaken" /* ACTION_TAKEN */),
|
|
16172
|
-
actionTakenAt: z30.any()
|
|
16173
|
-
// Should be a Timestamp from the server
|
|
16174
|
-
});
|
|
16175
|
-
|
|
16176
|
-
// src/utils/TimestampUtils.ts
|
|
16177
|
-
import * as admin from "firebase-admin";
|
|
16178
|
-
import { Timestamp as ClientTimestamp } from "firebase/firestore";
|
|
16179
|
-
var IS_SERVER_ENV = process.env.NODE_ENV === "production" || process.env.FUNCTIONS_EMULATOR === "true" || process.env.FIREBASE_CONFIG !== void 0;
|
|
16180
|
-
var TimestampUtils = class {
|
|
16181
|
-
/**
|
|
16182
|
-
* Enables server mode where admin timestamps are preserved when saving
|
|
16183
|
-
* to Firestore via the admin SDK
|
|
16184
|
-
*/
|
|
16185
|
-
static enableServerMode() {
|
|
16186
|
-
this.serverMode = true;
|
|
16187
|
-
}
|
|
16188
|
-
/**
|
|
16189
|
-
* Disables server mode - use this only for client-side or mixed environments
|
|
16190
|
-
*/
|
|
16191
|
-
static disableServerMode() {
|
|
16192
|
-
this.serverMode = false;
|
|
16193
|
-
}
|
|
16194
|
-
/**
|
|
16195
|
-
* Converts an admin Firestore Timestamp to a client Firestore Timestamp
|
|
16196
|
-
* In server mode, returns the original admin timestamp for storage consistency
|
|
16197
|
-
*
|
|
16198
|
-
* @param adminTimestamp - Admin SDK Timestamp (from firebase-admin)
|
|
16199
|
-
* @returns A client SDK Timestamp (from firebase/firestore) with same seconds/nanoseconds,
|
|
16200
|
-
* or the original admin timestamp in server mode,
|
|
16201
|
-
* or null if input is null
|
|
16202
|
-
*/
|
|
16203
|
-
static adminToClient(adminTimestamp) {
|
|
16204
|
-
if (!adminTimestamp) return null;
|
|
16205
|
-
if (this.serverMode) {
|
|
16206
|
-
return adminTimestamp;
|
|
16207
|
-
}
|
|
16208
|
-
return new ClientTimestamp(
|
|
16209
|
-
adminTimestamp.seconds,
|
|
16210
|
-
adminTimestamp.nanoseconds
|
|
16211
|
-
);
|
|
16212
|
-
}
|
|
16213
|
-
/**
|
|
16214
|
-
* Converts a client Firestore Timestamp to an admin Firestore Timestamp
|
|
16215
|
-
* @param clientTimestamp - Client SDK Timestamp (from firebase/firestore)
|
|
16216
|
-
* @returns An admin SDK Timestamp (from firebase-admin) with same seconds/nanoseconds or null if input is null
|
|
16217
|
-
*/
|
|
16218
|
-
static clientToAdmin(clientTimestamp) {
|
|
16219
|
-
if (!clientTimestamp) return null;
|
|
16220
|
-
return new admin.firestore.Timestamp(
|
|
16221
|
-
clientTimestamp.seconds,
|
|
16222
|
-
clientTimestamp.nanoseconds
|
|
16223
|
-
);
|
|
16224
|
-
}
|
|
16225
|
-
/**
|
|
16226
|
-
* Creates a timestamp for the current time in the appropriate format based on environment
|
|
16227
|
-
* @returns A timestamp for the current time (admin timestamp in server mode, client in client mode)
|
|
16228
|
-
*/
|
|
16229
|
-
static nowAsTimestamp() {
|
|
16230
|
-
const now = admin.firestore.Timestamp.now();
|
|
16231
|
-
if (this.serverMode) {
|
|
16232
|
-
return now;
|
|
16233
|
-
}
|
|
16234
|
-
return this.adminToClient(now);
|
|
16235
|
-
}
|
|
16236
|
-
/**
|
|
16237
|
-
* @deprecated Use nowAsTimestamp() instead for better cross-environment compatibility
|
|
16238
|
-
*/
|
|
16239
|
-
static nowAsClient() {
|
|
16240
|
-
const now = admin.firestore.Timestamp.now();
|
|
16241
|
-
return this.adminToClient(now);
|
|
16242
|
-
}
|
|
16243
|
-
/**
|
|
16244
|
-
* Converts a Date object to a timestamp in the appropriate format based on environment
|
|
16245
|
-
* @param date - JavaScript Date object
|
|
16246
|
-
* @returns A timestamp (admin timestamp in server mode, client in client mode) or null if input is null
|
|
16247
|
-
*/
|
|
16248
|
-
static dateToTimestamp(date) {
|
|
16249
|
-
if (!date) return null;
|
|
16250
|
-
if (this.serverMode) {
|
|
16251
|
-
return admin.firestore.Timestamp.fromDate(date);
|
|
16252
|
-
}
|
|
16253
|
-
return ClientTimestamp.fromDate(date);
|
|
16254
|
-
}
|
|
16255
|
-
/**
|
|
16256
|
-
* @deprecated Use dateToTimestamp() instead for better cross-environment compatibility
|
|
16257
|
-
*/
|
|
16258
|
-
static dateToClientTimestamp(date) {
|
|
16259
|
-
if (!date) return null;
|
|
16260
|
-
return ClientTimestamp.fromDate(date);
|
|
16261
|
-
}
|
|
16262
|
-
/**
|
|
16263
|
-
* @deprecated Use dateToTimestamp() instead for better cross-environment compatibility
|
|
16264
|
-
*/
|
|
16265
|
-
static dateToAdminTimestamp(date) {
|
|
16266
|
-
if (!date) return null;
|
|
16267
|
-
return admin.firestore.Timestamp.fromDate(date);
|
|
16268
|
-
}
|
|
16269
|
-
/**
|
|
16270
|
-
* Gets a server timestamp field value for use in create/update operations
|
|
16271
|
-
* Works in both admin and client environments
|
|
16272
|
-
*/
|
|
16273
|
-
static serverTimestamp() {
|
|
16274
|
-
if (this.serverMode) {
|
|
16275
|
-
return admin.firestore.FieldValue.serverTimestamp();
|
|
16276
|
-
}
|
|
16277
|
-
throw new Error("Server timestamp in client mode not implemented");
|
|
16278
|
-
}
|
|
16279
|
-
/**
|
|
16280
|
-
* For objects with mixed timestamp types, ensures all timestamps are
|
|
16281
|
-
* in the correct format for the current environment
|
|
16282
|
-
*/
|
|
16283
|
-
static normalizeTimestamps(obj) {
|
|
16284
|
-
if (!obj || typeof obj !== "object") {
|
|
16285
|
-
return obj;
|
|
16286
|
-
}
|
|
16287
|
-
if (obj instanceof admin.firestore.Timestamp) {
|
|
16288
|
-
return this.serverMode ? obj : this.adminToClient(obj);
|
|
16289
|
-
}
|
|
16290
|
-
if (obj instanceof ClientTimestamp && this.serverMode) {
|
|
16291
|
-
return this.clientToAdmin(obj);
|
|
16292
|
-
}
|
|
16293
|
-
if (Array.isArray(obj)) {
|
|
16294
|
-
return obj.map((item) => this.normalizeTimestamps(item));
|
|
16295
|
-
}
|
|
16296
|
-
const result = { ...obj };
|
|
16297
|
-
for (const key in result) {
|
|
16298
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
16299
|
-
result[key] = this.normalizeTimestamps(result[key]);
|
|
16300
|
-
}
|
|
16301
|
-
}
|
|
16302
|
-
return result;
|
|
16303
|
-
}
|
|
16304
|
-
/**
|
|
16305
|
-
* @deprecated Use normalizeTimestamps() instead for better cross-environment compatibility
|
|
16306
|
-
*/
|
|
16307
|
-
static convertObjectTimestampsAdminToClient(obj) {
|
|
16308
|
-
if (!obj || typeof obj !== "object") {
|
|
16309
|
-
return obj;
|
|
16310
|
-
}
|
|
16311
|
-
if (obj instanceof admin.firestore.Timestamp) {
|
|
16312
|
-
return this.adminToClient(obj);
|
|
16313
|
-
}
|
|
16314
|
-
if (Array.isArray(obj)) {
|
|
16315
|
-
return obj.map(
|
|
16316
|
-
(item) => this.convertObjectTimestampsAdminToClient(item)
|
|
16317
|
-
);
|
|
16318
|
-
}
|
|
16319
|
-
const result = { ...obj };
|
|
16320
|
-
for (const key in result) {
|
|
16321
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
16322
|
-
result[key] = this.convertObjectTimestampsAdminToClient(result[key]);
|
|
16323
|
-
}
|
|
16324
|
-
}
|
|
16325
|
-
return result;
|
|
16326
|
-
}
|
|
16327
|
-
/**
|
|
16328
|
-
* @deprecated Use normalizeTimestamps() instead for better cross-environment compatibility
|
|
16329
|
-
*/
|
|
16330
|
-
static convertObjectTimestampsClientToAdmin(obj) {
|
|
16331
|
-
if (!obj || typeof obj !== "object") {
|
|
16332
|
-
return obj;
|
|
16333
|
-
}
|
|
16334
|
-
if (obj instanceof ClientTimestamp) {
|
|
16335
|
-
return this.clientToAdmin(obj);
|
|
16336
|
-
}
|
|
16337
|
-
if (Array.isArray(obj)) {
|
|
16338
|
-
return obj.map(
|
|
16339
|
-
(item) => this.convertObjectTimestampsClientToAdmin(item)
|
|
16340
|
-
);
|
|
16341
|
-
}
|
|
16342
|
-
const result = { ...obj };
|
|
16343
|
-
for (const key in result) {
|
|
16344
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
16345
|
-
result[key] = this.convertObjectTimestampsClientToAdmin(result[key]);
|
|
16346
|
-
}
|
|
16347
|
-
}
|
|
16348
|
-
return result;
|
|
16349
|
-
}
|
|
16350
|
-
};
|
|
16351
|
-
/**
|
|
16352
|
-
* Flag to force server mode where admin timestamps are preserved
|
|
16353
|
-
* This should be true in Cloud Functions environments
|
|
16354
|
-
*/
|
|
16355
|
-
TimestampUtils.serverMode = IS_SERVER_ENV;
|
|
16356
|
-
|
|
16357
15787
|
// src/config/firebase.ts
|
|
16358
15788
|
import { initializeApp } from "firebase/app";
|
|
16359
15789
|
import { getFirestore as getFirestore2 } from "firebase/firestore";
|
|
@@ -17263,6 +16693,38 @@ var ProductService = class extends BaseService {
|
|
|
17263
16693
|
};
|
|
17264
16694
|
}
|
|
17265
16695
|
};
|
|
16696
|
+
|
|
16697
|
+
// src/backoffice/types/static/treatment-benefit.types.ts
|
|
16698
|
+
var TreatmentBenefit = /* @__PURE__ */ ((TreatmentBenefit2) => {
|
|
16699
|
+
TreatmentBenefit2["WRINKLE_REDUCTION"] = "wrinkle_reduction";
|
|
16700
|
+
TreatmentBenefit2["SKIN_TIGHTENING"] = "skin_tightening";
|
|
16701
|
+
TreatmentBenefit2["COLLAGEN_PRODUCTION"] = "collagen_production";
|
|
16702
|
+
TreatmentBenefit2["ACNE_REDUCTION"] = "acne_reduction";
|
|
16703
|
+
TreatmentBenefit2["SCAR_REDUCTION"] = "scar_reduction";
|
|
16704
|
+
TreatmentBenefit2["PIGMENTATION_IMPROVEMENT"] = "pigmentation_improvement";
|
|
16705
|
+
TreatmentBenefit2["HAIR_REMOVAL"] = "hair_removal";
|
|
16706
|
+
TreatmentBenefit2["MUSCLE_TONING"] = "muscle_toning";
|
|
16707
|
+
TreatmentBenefit2["FAT_REDUCTION"] = "fat_reduction";
|
|
16708
|
+
TreatmentBenefit2["CELLULITE_REDUCTION"] = "cellulite_reduction";
|
|
16709
|
+
TreatmentBenefit2["SKIN_REJUVENATION"] = "skin_rejuvenation";
|
|
16710
|
+
TreatmentBenefit2["PORE_REDUCTION"] = "pore_reduction";
|
|
16711
|
+
TreatmentBenefit2["TEXTURE_IMPROVEMENT"] = "texture_improvement";
|
|
16712
|
+
TreatmentBenefit2["HYDRATION_BOOST"] = "hydration_boost";
|
|
16713
|
+
TreatmentBenefit2["CIRCULATION_IMPROVEMENT"] = "circulation_improvement";
|
|
16714
|
+
return TreatmentBenefit2;
|
|
16715
|
+
})(TreatmentBenefit || {});
|
|
16716
|
+
|
|
16717
|
+
// src/backoffice/types/requirement.types.ts
|
|
16718
|
+
var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
|
|
16719
|
+
TimeUnit2["HOURS"] = "hours";
|
|
16720
|
+
TimeUnit2["DAYS"] = "days";
|
|
16721
|
+
return TimeUnit2;
|
|
16722
|
+
})(TimeUnit || {});
|
|
16723
|
+
var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
|
|
16724
|
+
RequirementType2["PRE"] = "pre";
|
|
16725
|
+
RequirementType2["POST"] = "post";
|
|
16726
|
+
return RequirementType2;
|
|
16727
|
+
})(RequirementType || {});
|
|
17266
16728
|
export {
|
|
17267
16729
|
APPOINTMENTS_COLLECTION,
|
|
17268
16730
|
AdminTokenStatus,
|
|
@@ -17354,164 +16816,19 @@ export {
|
|
|
17354
16816
|
SubcategoryService,
|
|
17355
16817
|
SubscriptionModel,
|
|
17356
16818
|
SyncedCalendarProvider,
|
|
16819
|
+
SyncedCalendarsService,
|
|
17357
16820
|
TechnologyService,
|
|
17358
16821
|
TimeUnit,
|
|
17359
|
-
TimestampUtils,
|
|
17360
16822
|
TreatmentBenefit,
|
|
17361
16823
|
USERS_COLLECTION,
|
|
17362
16824
|
USER_FORMS_SUBCOLLECTION,
|
|
17363
16825
|
UserRole,
|
|
17364
16826
|
UserService,
|
|
17365
|
-
addAllergySchema,
|
|
17366
|
-
addBlockingConditionSchema,
|
|
17367
|
-
addContraindicationSchema,
|
|
17368
|
-
addMedicationSchema,
|
|
17369
|
-
addressDataSchema,
|
|
17370
|
-
adminInfoSchema,
|
|
17371
|
-
adminTokenSchema,
|
|
17372
|
-
allergySchema,
|
|
17373
|
-
allergySubtypeSchema,
|
|
17374
|
-
appointmentMediaItemSchema,
|
|
17375
|
-
appointmentMetadataSchema,
|
|
17376
|
-
appointmentNotificationSchema,
|
|
17377
|
-
appointmentReminderNotificationSchema,
|
|
17378
|
-
appointmentStatusSchema,
|
|
17379
|
-
baseNotificationSchema,
|
|
17380
|
-
beforeAfterPerZoneSchema,
|
|
17381
|
-
billingPerZoneSchema,
|
|
17382
|
-
blockingConditionSchema,
|
|
17383
|
-
calendarEventSchema,
|
|
17384
|
-
calendarEventTimeSchema,
|
|
17385
|
-
clinicAdminOptionsSchema,
|
|
17386
|
-
clinicAdminSchema,
|
|
17387
|
-
clinicAdminSignupSchema,
|
|
17388
|
-
clinicBranchInfoSchema,
|
|
17389
|
-
clinicBranchSetupSchema,
|
|
17390
|
-
clinicContactInfoSchema,
|
|
17391
|
-
clinicGroupSchema,
|
|
17392
|
-
clinicGroupSetupSchema,
|
|
17393
|
-
clinicInfoSchema,
|
|
17394
|
-
clinicLocationSchema,
|
|
17395
|
-
clinicReviewInfoSchema,
|
|
17396
|
-
clinicReviewSchema,
|
|
17397
|
-
clinicSchema,
|
|
17398
|
-
clinicTagsSchema,
|
|
17399
|
-
contactPersonSchema,
|
|
17400
|
-
contraindicationSchema,
|
|
17401
|
-
createAdminTokenSchema,
|
|
17402
|
-
createAppointmentSchema,
|
|
17403
|
-
createBlockingEventSchema,
|
|
17404
|
-
createCalendarEventSchema,
|
|
17405
|
-
createClinicAdminSchema,
|
|
17406
|
-
createClinicGroupSchema,
|
|
17407
|
-
createClinicReviewSchema,
|
|
17408
|
-
createClinicSchema,
|
|
17409
|
-
createDefaultClinicGroupSchema,
|
|
17410
|
-
createDocumentTemplateSchema,
|
|
17411
|
-
createDraftPractitionerSchema,
|
|
17412
|
-
createFilledDocumentDataSchema,
|
|
17413
|
-
createManualPatientSchema,
|
|
17414
|
-
createPatientLocationInfoSchema,
|
|
17415
|
-
createPatientMedicalInfoSchema,
|
|
17416
|
-
createPatientProfileSchema,
|
|
17417
|
-
createPatientSensitiveInfoSchema,
|
|
17418
|
-
createPatientTokenSchema,
|
|
17419
|
-
createPractitionerReviewSchema,
|
|
17420
|
-
createPractitionerSchema,
|
|
17421
|
-
createPractitionerTokenSchema,
|
|
17422
|
-
createProcedureReviewSchema,
|
|
17423
|
-
createProcedureSchema,
|
|
17424
|
-
createReviewSchema,
|
|
17425
|
-
createUserOptionsSchema,
|
|
17426
|
-
doctorInfoSchema,
|
|
17427
|
-
documentElementSchema,
|
|
17428
|
-
documentElementWithoutIdSchema,
|
|
17429
|
-
documentTemplateSchema,
|
|
17430
|
-
emailSchema,
|
|
17431
|
-
emergencyContactSchema,
|
|
17432
|
-
filledDocumentSchema,
|
|
17433
|
-
filledDocumentStatusSchema,
|
|
17434
|
-
finalBillingSchema,
|
|
17435
|
-
finalizedDetailsSchema,
|
|
17436
|
-
gamificationSchema,
|
|
17437
16827
|
getFirebaseApp,
|
|
17438
16828
|
getFirebaseAuth,
|
|
17439
16829
|
getFirebaseDB,
|
|
17440
16830
|
getFirebaseFunctions,
|
|
17441
16831
|
getFirebaseInstance,
|
|
17442
16832
|
getFirebaseStorage,
|
|
17443
|
-
initializeFirebase
|
|
17444
|
-
linkedFormInfoSchema,
|
|
17445
|
-
locationDataSchema,
|
|
17446
|
-
mediaResourceSchema,
|
|
17447
|
-
mediaTypeSchema,
|
|
17448
|
-
medicationSchema,
|
|
17449
|
-
notificationSchema,
|
|
17450
|
-
passwordSchema,
|
|
17451
|
-
patientClinicSchema,
|
|
17452
|
-
patientDoctorSchema,
|
|
17453
|
-
patientInstructionStatusSchema,
|
|
17454
|
-
patientLocationInfoSchema,
|
|
17455
|
-
patientMedicalInfoSchema,
|
|
17456
|
-
patientProfileInfoSchema,
|
|
17457
|
-
patientProfileSchema,
|
|
17458
|
-
patientRequirementInstanceSchema,
|
|
17459
|
-
patientRequirementInstructionSchema,
|
|
17460
|
-
patientRequirementOverallStatusSchema,
|
|
17461
|
-
patientReviewInfoSchema,
|
|
17462
|
-
patientSensitiveInfoSchema,
|
|
17463
|
-
patientTokenSchema,
|
|
17464
|
-
paymentStatusSchema,
|
|
17465
|
-
postRequirementNotificationSchema,
|
|
17466
|
-
practitionerBasicInfoSchema,
|
|
17467
|
-
practitionerCertificationSchema,
|
|
17468
|
-
practitionerClinicWorkingHoursSchema,
|
|
17469
|
-
practitionerProfileInfoSchema,
|
|
17470
|
-
practitionerReviewInfoSchema,
|
|
17471
|
-
practitionerReviewSchema,
|
|
17472
|
-
practitionerSchema,
|
|
17473
|
-
practitionerSignupSchema,
|
|
17474
|
-
practitionerTokenSchema,
|
|
17475
|
-
practitionerWorkingHoursSchema,
|
|
17476
|
-
preRequirementNotificationSchema,
|
|
17477
|
-
procedureCategorizationSchema,
|
|
17478
|
-
procedureExtendedInfoSchema,
|
|
17479
|
-
procedureInfoSchema,
|
|
17480
|
-
procedureReviewInfoSchema,
|
|
17481
|
-
procedureReviewSchema,
|
|
17482
|
-
procedureSchema,
|
|
17483
|
-
procedureSummaryInfoSchema,
|
|
17484
|
-
requesterInfoSchema,
|
|
17485
|
-
requirementImportanceSchema,
|
|
17486
|
-
requirementInstructionDueNotificationSchema,
|
|
17487
|
-
rescheduleAppointmentSchema,
|
|
17488
|
-
reviewSchema,
|
|
17489
|
-
searchAppointmentsSchema,
|
|
17490
|
-
searchPatientsSchema,
|
|
17491
|
-
sharedClinicContactInfoSchema,
|
|
17492
|
-
sharedClinicLocationSchema,
|
|
17493
|
-
syncedCalendarEventSchema,
|
|
17494
|
-
timeSlotSchema2 as timeSlotSchema,
|
|
17495
|
-
timestampSchema,
|
|
17496
|
-
updateAllergySchema,
|
|
17497
|
-
updateAppointmentSchema,
|
|
17498
|
-
updateBlockingConditionSchema,
|
|
17499
|
-
updateBlockingEventSchema,
|
|
17500
|
-
updateCalendarEventSchema,
|
|
17501
|
-
updateClinicAdminSchema,
|
|
17502
|
-
updateClinicGroupSchema,
|
|
17503
|
-
updateClinicSchema,
|
|
17504
|
-
updateContraindicationSchema,
|
|
17505
|
-
updateDocumentTemplateSchema,
|
|
17506
|
-
updateFilledDocumentDataSchema,
|
|
17507
|
-
updateMedicationSchema,
|
|
17508
|
-
updatePatientInstructionStatusSchema,
|
|
17509
|
-
updatePatientMedicalInfoSchema,
|
|
17510
|
-
updateProcedureSchema,
|
|
17511
|
-
updateVitalStatsSchema,
|
|
17512
|
-
userRoleSchema,
|
|
17513
|
-
userRolesSchema,
|
|
17514
|
-
userSchema,
|
|
17515
|
-
vitalStatsSchema,
|
|
17516
|
-
workingHoursSchema
|
|
16833
|
+
initializeFirebase
|
|
17517
16834
|
};
|