@blackcode_sa/metaestetics-api 1.14.46 → 1.14.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5362,7 +5362,8 @@ function addVisibilityAudit(updates, doctorId) {
5362
5362
  if (updates.showToPatient !== void 0 || updates.beforeNoteVisibleToPatient !== void 0 || updates.afterNoteVisibleToPatient !== void 0) {
5363
5363
  return {
5364
5364
  ...updates,
5365
- visibilityUpdatedAt: (0, import_firestore13.serverTimestamp)(),
5365
+ visibilityUpdatedAt: import_firestore13.Timestamp.now(),
5366
+ // Use client-side timestamp (Firestore limitation)
5366
5367
  visibilityUpdatedBy: doctorId
5367
5368
  };
5368
5369
  }
package/dist/index.mjs CHANGED
@@ -3393,7 +3393,7 @@ var AnalyticsCloudService = class {
3393
3393
 
3394
3394
  // src/services/appointment/appointment.service.ts
3395
3395
  import {
3396
- Timestamp as Timestamp6,
3396
+ Timestamp as Timestamp7,
3397
3397
  serverTimestamp as serverTimestamp7,
3398
3398
  arrayUnion,
3399
3399
  arrayRemove,
@@ -5243,12 +5243,13 @@ async function getRecommendedProceduresUtil(db, appointmentId) {
5243
5243
  }
5244
5244
 
5245
5245
  // src/services/appointment/utils/zone-photo.utils.ts
5246
- import { updateDoc as updateDoc6, serverTimestamp as serverTimestamp6, doc as doc9 } from "firebase/firestore";
5246
+ import { updateDoc as updateDoc6, serverTimestamp as serverTimestamp6, doc as doc9, Timestamp as Timestamp6 } from "firebase/firestore";
5247
5247
  function addVisibilityAudit(updates, doctorId) {
5248
5248
  if (updates.showToPatient !== void 0 || updates.beforeNoteVisibleToPatient !== void 0 || updates.afterNoteVisibleToPatient !== void 0) {
5249
5249
  return {
5250
5250
  ...updates,
5251
- visibilityUpdatedAt: serverTimestamp6(),
5251
+ visibilityUpdatedAt: Timestamp6.now(),
5252
+ // Use client-side timestamp (Firestore limitation)
5252
5253
  visibilityUpdatedBy: doctorId
5253
5254
  };
5254
5255
  }
@@ -5685,13 +5686,13 @@ var AppointmentService = class extends BaseService {
5685
5686
  }
5686
5687
  updateData.cancellationReason = details.cancellationReason;
5687
5688
  updateData.canceledBy = details.canceledBy;
5688
- updateData.cancellationTime = Timestamp6.now();
5689
+ updateData.cancellationTime = Timestamp7.now();
5689
5690
  }
5690
5691
  if (newStatus === "confirmed" /* CONFIRMED */) {
5691
- updateData.confirmationTime = Timestamp6.now();
5692
+ updateData.confirmationTime = Timestamp7.now();
5692
5693
  }
5693
5694
  if (newStatus === "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */) {
5694
- updateData.rescheduleTime = Timestamp6.now();
5695
+ updateData.rescheduleTime = Timestamp7.now();
5695
5696
  }
5696
5697
  return this.updateAppointment(appointmentId, updateData);
5697
5698
  }
@@ -5743,7 +5744,7 @@ var AppointmentService = class extends BaseService {
5743
5744
  status: "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */,
5744
5745
  appointmentStartTime: startTimestamp,
5745
5746
  appointmentEndTime: endTimestamp,
5746
- rescheduleTime: Timestamp6.now(),
5747
+ rescheduleTime: Timestamp7.now(),
5747
5748
  confirmationTime: null,
5748
5749
  updatedAt: serverTimestamp7()
5749
5750
  };
@@ -5763,19 +5764,19 @@ var AppointmentService = class extends BaseService {
5763
5764
  return value;
5764
5765
  }
5765
5766
  if (typeof value === "number") {
5766
- return Timestamp6.fromMillis(value);
5767
+ return Timestamp7.fromMillis(value);
5767
5768
  }
5768
5769
  if (typeof value === "string") {
5769
- return Timestamp6.fromDate(new Date(value));
5770
+ return Timestamp7.fromDate(new Date(value));
5770
5771
  }
5771
5772
  if (value instanceof Date) {
5772
- return Timestamp6.fromDate(value);
5773
+ return Timestamp7.fromDate(value);
5773
5774
  }
5774
5775
  if (value && typeof value._seconds === "number") {
5775
- return new Timestamp6(value._seconds, value._nanoseconds || 0);
5776
+ return new Timestamp7(value._seconds, value._nanoseconds || 0);
5776
5777
  }
5777
5778
  if (value && typeof value.seconds === "number") {
5778
- return new Timestamp6(value.seconds, value.nanoseconds || 0);
5779
+ return new Timestamp7(value.seconds, value.nanoseconds || 0);
5779
5780
  }
5780
5781
  throw new Error(`Invalid timestamp format: ${typeof value}, value: ${JSON.stringify(value)}`);
5781
5782
  }
@@ -5844,7 +5845,7 @@ var AppointmentService = class extends BaseService {
5844
5845
  }
5845
5846
  const updateData = {
5846
5847
  status: "in_progress" /* IN_PROGRESS */,
5847
- procedureActualStartTime: Timestamp6.now(),
5848
+ procedureActualStartTime: Timestamp7.now(),
5848
5849
  // Set actual start time
5849
5850
  updatedAt: serverTimestamp7()
5850
5851
  };
@@ -5860,7 +5861,7 @@ var AppointmentService = class extends BaseService {
5860
5861
  const appointment = await this.getAppointmentById(appointmentId);
5861
5862
  if (!appointment) throw new Error(`Appointment ${appointmentId} not found.`);
5862
5863
  let calculatedDurationMinutes = actualDurationMinutesInput;
5863
- const procedureCompletionTime = Timestamp6.now();
5864
+ const procedureCompletionTime = Timestamp7.now();
5864
5865
  if (calculatedDurationMinutes === void 0 && appointment.procedureActualStartTime) {
5865
5866
  const startTimeMillis = appointment.procedureActualStartTime.toMillis();
5866
5867
  const endTimeMillis = procedureCompletionTime.toMillis();
@@ -5892,7 +5893,7 @@ var AppointmentService = class extends BaseService {
5892
5893
  console.log(`[APPOINTMENT_SERVICE] Admin marking no-show for: ${appointmentId}`);
5893
5894
  const appointment = await this.getAppointmentById(appointmentId);
5894
5895
  if (!appointment) throw new Error(`Appointment ${appointmentId} not found.`);
5895
- if (Timestamp6.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
5896
+ if (Timestamp7.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
5896
5897
  throw new Error("Cannot mark no-show before appointment start time.");
5897
5898
  }
5898
5899
  return this.updateAppointmentStatus(appointmentId, "no_show" /* NO_SHOW */, {
@@ -5910,7 +5911,7 @@ var AppointmentService = class extends BaseService {
5910
5911
  const newMediaItem = {
5911
5912
  ...mediaItemData,
5912
5913
  id: this.generateId(),
5913
- uploadedAt: Timestamp6.now(),
5914
+ uploadedAt: Timestamp7.now(),
5914
5915
  uploadedBy: currentUser.uid
5915
5916
  };
5916
5917
  const updateData = {
@@ -5948,7 +5949,7 @@ var AppointmentService = class extends BaseService {
5948
5949
  const newReviewInfo = {
5949
5950
  ...reviewData,
5950
5951
  reviewId: this.generateId(),
5951
- reviewedAt: Timestamp6.now()
5952
+ reviewedAt: Timestamp7.now()
5952
5953
  };
5953
5954
  const updateData = {
5954
5955
  reviewInfo: newReviewInfo,
@@ -6006,9 +6007,9 @@ var AppointmentService = class extends BaseService {
6006
6007
  const constraints = [];
6007
6008
  constraints.push(where6("patientId", "==", patientId));
6008
6009
  constraints.push(where6("status", "in", upcomingStatuses));
6009
- constraints.push(where6("appointmentStartTime", ">=", Timestamp6.fromDate(effectiveStartDate)));
6010
+ constraints.push(where6("appointmentStartTime", ">=", Timestamp7.fromDate(effectiveStartDate)));
6010
6011
  if (options == null ? void 0 : options.endDate) {
6011
- constraints.push(where6("appointmentStartTime", "<=", Timestamp6.fromDate(options.endDate)));
6012
+ constraints.push(where6("appointmentStartTime", "<=", Timestamp7.fromDate(options.endDate)));
6012
6013
  }
6013
6014
  constraints.push(orderBy3("appointmentStartTime", "asc"));
6014
6015
  if (options == null ? void 0 : options.limit) {
@@ -6062,10 +6063,10 @@ var AppointmentService = class extends BaseService {
6062
6063
  constraints.push(where6("status", "in", pastStatuses));
6063
6064
  if (options == null ? void 0 : options.startDate) {
6064
6065
  constraints.push(
6065
- where6("appointmentStartTime", ">=", Timestamp6.fromDate(options.startDate))
6066
+ where6("appointmentStartTime", ">=", Timestamp7.fromDate(options.startDate))
6066
6067
  );
6067
6068
  }
6068
- constraints.push(where6("appointmentStartTime", "<=", Timestamp6.fromDate(effectiveEndDate)));
6069
+ constraints.push(where6("appointmentStartTime", "<=", Timestamp7.fromDate(effectiveEndDate)));
6069
6070
  constraints.push(orderBy3("appointmentStartTime", "desc"));
6070
6071
  if (options == null ? void 0 : options.limit) {
6071
6072
  constraints.push(limit3(options.limit));
@@ -7698,7 +7699,7 @@ import {
7698
7699
  where as where14,
7699
7700
  updateDoc as updateDoc17,
7700
7701
  deleteDoc as deleteDoc5,
7701
- Timestamp as Timestamp18,
7702
+ Timestamp as Timestamp19,
7702
7703
  setDoc as setDoc12,
7703
7704
  serverTimestamp as serverTimestamp18
7704
7705
  } from "firebase/firestore";
@@ -7806,7 +7807,7 @@ import {
7806
7807
  updateDoc as updateDoc15,
7807
7808
  serverTimestamp as serverTimestamp16
7808
7809
  } from "firebase/firestore";
7809
- import { Timestamp as Timestamp15 } from "firebase/firestore";
7810
+ import { Timestamp as Timestamp16 } from "firebase/firestore";
7810
7811
 
7811
7812
  // src/services/patient/utils/clinic.utils.ts
7812
7813
  import {
@@ -7835,7 +7836,7 @@ import { getDoc as getDoc12, updateDoc as updateDoc8, setDoc as setDoc4, serverT
7835
7836
 
7836
7837
  // src/validations/patient.schema.ts
7837
7838
  import { z as z7 } from "zod";
7838
- import { Timestamp as Timestamp8 } from "firebase/firestore";
7839
+ import { Timestamp as Timestamp9 } from "firebase/firestore";
7839
7840
 
7840
7841
  // src/validations/patient/medical-info.schema.ts
7841
7842
  import { z as z6 } from "zod";
@@ -7862,23 +7863,23 @@ var BlockingCondition = /* @__PURE__ */ ((BlockingCondition2) => {
7862
7863
 
7863
7864
  // src/validations/common.schema.ts
7864
7865
  import { z as z5 } from "zod";
7865
- import { Timestamp as Timestamp7 } from "firebase/firestore";
7866
+ import { Timestamp as Timestamp8 } from "firebase/firestore";
7866
7867
  var timestampSchema = z5.union([
7867
7868
  z5.object({
7868
7869
  seconds: z5.number(),
7869
7870
  nanoseconds: z5.number()
7870
7871
  }),
7871
- z5.instanceof(Timestamp7),
7872
+ z5.instanceof(Timestamp8),
7872
7873
  z5.instanceof(Date)
7873
7874
  // Add support for Date objects that Firestore returns on client
7874
7875
  ]).transform((data) => {
7875
- if (data instanceof Timestamp7) {
7876
+ if (data instanceof Timestamp8) {
7876
7877
  return data;
7877
7878
  }
7878
7879
  if (data instanceof Date) {
7879
- return Timestamp7.fromDate(data);
7880
+ return Timestamp8.fromDate(data);
7880
7881
  }
7881
- return new Timestamp7(data.seconds, data.nanoseconds);
7882
+ return new Timestamp8(data.seconds, data.nanoseconds);
7882
7883
  });
7883
7884
 
7884
7885
  // src/validations/patient/medical-info.schema.ts
@@ -8034,8 +8035,8 @@ var patientLocationInfoSchema = z7.object({
8034
8035
  patientId: z7.string(),
8035
8036
  userRef: z7.string().optional(),
8036
8037
  locationData: locationDataSchema,
8037
- createdAt: z7.instanceof(Timestamp8),
8038
- updatedAt: z7.instanceof(Timestamp8)
8038
+ createdAt: z7.instanceof(Timestamp9),
8039
+ updatedAt: z7.instanceof(Timestamp9)
8039
8040
  });
8040
8041
  var createPatientLocationInfoSchema = z7.object({
8041
8042
  patientId: z7.string(),
@@ -8048,26 +8049,26 @@ var patientSensitiveInfoSchema = z7.object({
8048
8049
  photoUrl: z7.string().nullable().optional(),
8049
8050
  firstName: z7.string().min(2),
8050
8051
  lastName: z7.string().min(2),
8051
- dateOfBirth: z7.instanceof(Timestamp8).nullable(),
8052
+ dateOfBirth: z7.instanceof(Timestamp9).nullable(),
8052
8053
  gender: z7.nativeEnum(Gender),
8053
8054
  email: z7.string().email().optional(),
8054
8055
  phoneNumber: z7.string().optional(),
8055
8056
  alternativePhoneNumber: z7.string().optional(),
8056
8057
  addressData: addressDataSchema.optional(),
8057
8058
  emergencyContacts: z7.array(emergencyContactSchema).optional(),
8058
- createdAt: z7.instanceof(Timestamp8),
8059
- updatedAt: z7.instanceof(Timestamp8)
8059
+ createdAt: z7.instanceof(Timestamp9),
8060
+ updatedAt: z7.instanceof(Timestamp9)
8060
8061
  });
8061
8062
  var patientDoctorSchema = z7.object({
8062
8063
  userRef: z7.string(),
8063
- assignedAt: z7.instanceof(Timestamp8),
8064
+ assignedAt: z7.instanceof(Timestamp9),
8064
8065
  assignedBy: z7.string().optional(),
8065
8066
  isActive: z7.boolean(),
8066
8067
  notes: z7.string().optional()
8067
8068
  });
8068
8069
  var patientClinicSchema = z7.object({
8069
8070
  clinicId: z7.string(),
8070
- assignedAt: z7.instanceof(Timestamp8),
8071
+ assignedAt: z7.instanceof(Timestamp9),
8071
8072
  assignedBy: z7.string().optional(),
8072
8073
  isActive: z7.boolean(),
8073
8074
  notes: z7.string().optional()
@@ -8083,14 +8084,14 @@ var patientProfileSchema = z7.object({
8083
8084
  isManual: z7.boolean().default(false),
8084
8085
  // Default to false if missing
8085
8086
  phoneNumber: z7.string().nullable().optional(),
8086
- dateOfBirth: z7.instanceof(Timestamp8).nullable().optional(),
8087
+ dateOfBirth: z7.instanceof(Timestamp9).nullable().optional(),
8087
8088
  doctors: z7.array(patientDoctorSchema),
8088
8089
  clinics: z7.array(patientClinicSchema),
8089
8090
  doctorIds: z7.array(z7.string()),
8090
8091
  clinicIds: z7.array(z7.string()),
8091
8092
  dismissedNextStepsRecommendations: z7.array(z7.string()).optional(),
8092
- createdAt: z7.instanceof(Timestamp8),
8093
- updatedAt: z7.instanceof(Timestamp8)
8093
+ createdAt: z7.instanceof(Timestamp9),
8094
+ updatedAt: z7.instanceof(Timestamp9)
8094
8095
  });
8095
8096
  var createPatientProfileSchema = z7.object({
8096
8097
  userRef: z7.string().optional(),
@@ -8111,7 +8112,7 @@ var createPatientSensitiveInfoSchema = z7.object({
8111
8112
  photoUrl: mediaResourceSchema.nullable().optional(),
8112
8113
  firstName: z7.string().min(2),
8113
8114
  lastName: z7.string().min(2),
8114
- dateOfBirth: z7.instanceof(Timestamp8).nullable(),
8115
+ dateOfBirth: z7.instanceof(Timestamp9).nullable(),
8115
8116
  gender: z7.nativeEnum(Gender),
8116
8117
  email: z7.string().email().optional(),
8117
8118
  phoneNumber: z7.string().optional(),
@@ -8123,7 +8124,7 @@ var createManualPatientSchema = z7.object({
8123
8124
  clinicId: z7.string().min(1, "Clinic ID is required"),
8124
8125
  firstName: z7.string().min(2, "First name is required"),
8125
8126
  lastName: z7.string().min(2, "Last name is required"),
8126
- dateOfBirth: z7.instanceof(Timestamp8).nullable(),
8127
+ dateOfBirth: z7.instanceof(Timestamp9).nullable(),
8127
8128
  gender: z7.nativeEnum(Gender),
8128
8129
  phoneNumber: z7.string().optional(),
8129
8130
  email: z7.string().email().optional(),
@@ -8304,13 +8305,13 @@ import {
8304
8305
  updateDoc as updateDoc7,
8305
8306
  setDoc as setDoc3,
8306
8307
  deleteDoc as deleteDoc3,
8307
- Timestamp as Timestamp10,
8308
+ Timestamp as Timestamp11,
8308
8309
  serverTimestamp as serverTimestamp8
8309
8310
  } from "firebase/firestore";
8310
8311
 
8311
8312
  // src/validations/clinic.schema.ts
8312
8313
  import { z as z10 } from "zod";
8313
- import { Timestamp as Timestamp9 } from "firebase/firestore";
8314
+ import { Timestamp as Timestamp10 } from "firebase/firestore";
8314
8315
 
8315
8316
  // src/validations/reviews.schema.ts
8316
8317
  import { z as z8 } from "zod";
@@ -8570,8 +8571,8 @@ var clinicAdminSchema = z10.object({
8570
8571
  clinicsManagedInfo: z10.array(clinicInfoSchema),
8571
8572
  contactInfo: contactPersonSchema,
8572
8573
  roleTitle: z10.string(),
8573
- createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8574
- updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8574
+ createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8575
+ updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8575
8576
  isActive: z10.boolean()
8576
8577
  });
8577
8578
  var adminTokenSchema = z10.object({
@@ -8580,9 +8581,9 @@ var adminTokenSchema = z10.object({
8580
8581
  email: z10.string().email().optional().nullable(),
8581
8582
  status: z10.nativeEnum(AdminTokenStatus),
8582
8583
  usedByUserRef: z10.string().optional(),
8583
- createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8584
+ createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8584
8585
  // Timestamp
8585
- expiresAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9))
8586
+ expiresAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10))
8586
8587
  // Timestamp
8587
8588
  });
8588
8589
  var stripeTransactionDataSchema = z10.object({
@@ -8603,9 +8604,9 @@ var billingInfoSchema = z10.object({
8603
8604
  planType: z10.string(),
8604
8605
  stripeSubscriptionId: z10.string().nullable(),
8605
8606
  stripePriceId: z10.string().nullable(),
8606
- currentPeriodStart: z10.instanceof(Date).or(z10.instanceof(Timestamp9)).nullable(),
8607
- currentPeriodEnd: z10.instanceof(Date).or(z10.instanceof(Timestamp9)).nullable(),
8608
- updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9))
8607
+ currentPeriodStart: z10.instanceof(Date).or(z10.instanceof(Timestamp10)).nullable(),
8608
+ currentPeriodEnd: z10.instanceof(Date).or(z10.instanceof(Timestamp10)).nullable(),
8609
+ updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10))
8609
8610
  });
8610
8611
  var billingTransactionSchema = z10.object({
8611
8612
  id: z10.string(),
@@ -8617,8 +8618,8 @@ var billingTransactionSchema = z10.object({
8617
8618
  stripeData: stripeTransactionDataSchema,
8618
8619
  planDetails: planDetailsSchema,
8619
8620
  metadata: z10.record(z10.any()).optional(),
8620
- timestamp: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8621
- createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9))
8621
+ timestamp: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8622
+ createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10))
8622
8623
  });
8623
8624
  var createBillingTransactionSchema = z10.object({
8624
8625
  type: z10.nativeEnum(BillingTransactionType),
@@ -8646,9 +8647,9 @@ var clinicGroupSchema = z10.object({
8646
8647
  adminsInfo: z10.array(adminInfoSchema),
8647
8648
  adminTokens: z10.array(adminTokenSchema),
8648
8649
  ownerId: z10.string().nullable(),
8649
- createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8650
+ createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8650
8651
  // Timestamp
8651
- updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8652
+ updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8652
8653
  // Timestamp
8653
8654
  isActive: z10.boolean(),
8654
8655
  logo: mediaResourceSchema.optional().nullable(),
@@ -8691,9 +8692,9 @@ var clinicSchema = z10.object({
8691
8692
  // Use the correct schema for aggregated procedure info
8692
8693
  reviewInfo: clinicReviewInfoSchema,
8693
8694
  admins: z10.array(z10.string()),
8694
- createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8695
+ createdAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8695
8696
  // Timestamp
8696
- updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp9)),
8697
+ updatedAt: z10.instanceof(Date).or(z10.instanceof(Timestamp10)),
8697
8698
  // Timestamp
8698
8699
  isActive: z10.boolean(),
8699
8700
  isVerified: z10.boolean(),
@@ -8937,8 +8938,8 @@ async function createClinicAdmin(db, data, clinicGroupService) {
8937
8938
  try {
8938
8939
  clinicAdminSchema.parse({
8939
8940
  ...adminData,
8940
- createdAt: Timestamp10.now(),
8941
- updatedAt: Timestamp10.now()
8941
+ createdAt: Timestamp11.now(),
8942
+ updatedAt: Timestamp11.now()
8942
8943
  });
8943
8944
  console.log("[CLINIC_ADMIN] Admin object validation passed");
8944
8945
  } catch (schemaError) {
@@ -9589,13 +9590,13 @@ import {
9589
9590
  arrayUnion as arrayUnion2,
9590
9591
  arrayRemove as arrayRemove2,
9591
9592
  serverTimestamp as serverTimestamp12,
9592
- Timestamp as Timestamp11
9593
+ Timestamp as Timestamp12
9593
9594
  } from "firebase/firestore";
9594
9595
  var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
9595
9596
  var _a;
9596
9597
  const newDoctor = {
9597
9598
  userRef: doctorRef,
9598
- assignedAt: Timestamp11.now(),
9599
+ assignedAt: Timestamp12.now(),
9599
9600
  assignedBy,
9600
9601
  isActive: true
9601
9602
  };
@@ -9614,7 +9615,7 @@ var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
9614
9615
  updatedDoctors[existingDoctorIndex] = {
9615
9616
  ...updatedDoctors[existingDoctorIndex],
9616
9617
  isActive: true,
9617
- assignedAt: Timestamp11.now(),
9618
+ assignedAt: Timestamp12.now(),
9618
9619
  assignedBy
9619
9620
  };
9620
9621
  updates.doctors = updatedDoctors;
@@ -9642,7 +9643,7 @@ var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
9642
9643
  var _a;
9643
9644
  const newClinic = {
9644
9645
  clinicId,
9645
- assignedAt: Timestamp11.now(),
9646
+ assignedAt: Timestamp12.now(),
9646
9647
  assignedBy,
9647
9648
  isActive: true
9648
9649
  };
@@ -9661,7 +9662,7 @@ var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
9661
9662
  updatedClinics[existingClinicIndex] = {
9662
9663
  ...updatedClinics[existingClinicIndex],
9663
9664
  isActive: true,
9664
- assignedAt: Timestamp11.now(),
9665
+ assignedAt: Timestamp12.now(),
9665
9666
  assignedBy
9666
9667
  };
9667
9668
  updates.clinics = updatedClinics;
@@ -9980,7 +9981,7 @@ import {
9980
9981
  arrayRemove as arrayRemove4,
9981
9982
  serverTimestamp as serverTimestamp14,
9982
9983
  increment,
9983
- Timestamp as Timestamp13,
9984
+ Timestamp as Timestamp14,
9984
9985
  collection as collection11,
9985
9986
  query as query11,
9986
9987
  where as where11,
@@ -10023,8 +10024,8 @@ var createPatientProfileUtil = async (db, data, generateId2) => {
10023
10024
  };
10024
10025
  patientProfileSchema.parse({
10025
10026
  ...patientData,
10026
- createdAt: Timestamp13.now(),
10027
- updatedAt: Timestamp13.now()
10027
+ createdAt: Timestamp14.now(),
10028
+ updatedAt: Timestamp14.now()
10028
10029
  });
10029
10030
  await setDoc8(getPatientDocRef(db, patientId), patientData);
10030
10031
  console.log(`[createPatientProfileUtil] Creating sensitive info document`);
@@ -10178,12 +10179,12 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
10178
10179
  photoUrl: "",
10179
10180
  firstName: "Name",
10180
10181
  lastName: "Surname",
10181
- dateOfBirth: Timestamp13.now(),
10182
+ dateOfBirth: Timestamp14.now(),
10182
10183
  gender: "prefer_not_to_say" /* PREFER_NOT_TO_SAY */,
10183
10184
  email: "test@example.com",
10184
10185
  phoneNumber: "",
10185
- createdAt: Timestamp13.now(),
10186
- updatedAt: Timestamp13.now()
10186
+ createdAt: Timestamp14.now(),
10187
+ updatedAt: Timestamp14.now()
10187
10188
  };
10188
10189
  await setDoc8(sensitiveInfoRef, defaultSensitiveInfo);
10189
10190
  console.log(
@@ -10197,7 +10198,7 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
10197
10198
  const defaultMedicalInfo = {
10198
10199
  ...DEFAULT_MEDICAL_INFO,
10199
10200
  patientId,
10200
- lastUpdated: Timestamp13.now(),
10201
+ lastUpdated: Timestamp14.now(),
10201
10202
  updatedBy: userRef
10202
10203
  };
10203
10204
  await setDoc8(medicalInfoRef, defaultMedicalInfo);
@@ -10315,7 +10316,7 @@ import {
10315
10316
  where as where12,
10316
10317
  setDoc as setDoc9,
10317
10318
  updateDoc as updateDoc13,
10318
- Timestamp as Timestamp14,
10319
+ Timestamp as Timestamp15,
10319
10320
  collectionGroup
10320
10321
  } from "firebase/firestore";
10321
10322
 
@@ -10365,8 +10366,8 @@ var createPatientTokenUtil = async (db, data, createdBy, generateId2) => {
10365
10366
  clinicId: validatedData.clinicId,
10366
10367
  status: "active" /* ACTIVE */,
10367
10368
  createdBy,
10368
- createdAt: Timestamp14.now(),
10369
- expiresAt: Timestamp14.fromDate(expiration)
10369
+ createdAt: Timestamp15.now(),
10370
+ expiresAt: Timestamp15.fromDate(expiration)
10370
10371
  };
10371
10372
  patientTokenSchema.parse(token);
10372
10373
  const tokenRef = doc17(
@@ -10392,7 +10393,7 @@ var validatePatientTokenUtil = async (db, tokenString) => {
10392
10393
  tokensRef,
10393
10394
  where12("token", "==", tokenString),
10394
10395
  where12("status", "==", "active" /* ACTIVE */),
10395
- where12("expiresAt", ">", Timestamp14.now())
10396
+ where12("expiresAt", ">", Timestamp15.now())
10396
10397
  );
10397
10398
  const tokenSnapshot = await getDocs12(q);
10398
10399
  if (!tokenSnapshot.empty) {
@@ -10412,7 +10413,7 @@ var markPatientTokenAsUsedUtil = async (db, tokenId, patientId, userId) => {
10412
10413
  await updateDoc13(tokenRef, {
10413
10414
  status: "used" /* USED */,
10414
10415
  usedBy: userId,
10415
- usedAt: Timestamp14.now()
10416
+ usedAt: Timestamp15.now()
10416
10417
  });
10417
10418
  };
10418
10419
  var getActiveInviteTokensByClinicUtil = async (db, clinicId) => {
@@ -10420,7 +10421,7 @@ var getActiveInviteTokensByClinicUtil = async (db, clinicId) => {
10420
10421
  collectionGroup(db, INVITE_TOKENS_COLLECTION),
10421
10422
  where12("clinicId", "==", clinicId),
10422
10423
  where12("status", "==", "active" /* ACTIVE */),
10423
- where12("expiresAt", ">", Timestamp14.now())
10424
+ where12("expiresAt", ">", Timestamp15.now())
10424
10425
  );
10425
10426
  const querySnapshot = await getDocs12(tokensQuery);
10426
10427
  if (querySnapshot.empty) {
@@ -10438,7 +10439,7 @@ var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
10438
10439
  const q = query12(
10439
10440
  tokensRef,
10440
10441
  where12("status", "==", "active" /* ACTIVE */),
10441
- where12("expiresAt", ">", Timestamp14.now())
10442
+ where12("expiresAt", ">", Timestamp15.now())
10442
10443
  );
10443
10444
  const querySnapshot = await getDocs12(q);
10444
10445
  if (querySnapshot.empty) {
@@ -10648,7 +10649,7 @@ var PatientService = class extends BaseService {
10648
10649
  }
10649
10650
  const patientId = this.generateId();
10650
10651
  const batch = writeBatch(this.db);
10651
- const now = Timestamp15.now();
10652
+ const now = Timestamp16.now();
10652
10653
  const patientProfileRef = getPatientDocRef(this.db, patientId);
10653
10654
  const newProfile = {
10654
10655
  id: patientId,
@@ -11334,7 +11335,7 @@ import {
11334
11335
  updateDoc as updateDoc16,
11335
11336
  setDoc as setDoc11,
11336
11337
  deleteDoc as deleteDoc4,
11337
- Timestamp as Timestamp17,
11338
+ Timestamp as Timestamp18,
11338
11339
  serverTimestamp as serverTimestamp17,
11339
11340
  limit as limit7,
11340
11341
  startAfter as startAfter6,
@@ -11345,7 +11346,7 @@ import {
11345
11346
 
11346
11347
  // src/validations/practitioner.schema.ts
11347
11348
  import { z as z16 } from "zod";
11348
- import { Timestamp as Timestamp16 } from "firebase/firestore";
11349
+ import { Timestamp as Timestamp17 } from "firebase/firestore";
11349
11350
 
11350
11351
  // src/backoffice/types/static/certification.types.ts
11351
11352
  var CertificationLevel = /* @__PURE__ */ ((CertificationLevel2) => {
@@ -11378,7 +11379,7 @@ var practitionerBasicInfoSchema = z16.object({
11378
11379
  title: z16.string().min(2).max(100),
11379
11380
  email: z16.string().email(),
11380
11381
  phoneNumber: z16.string().regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number").nullable(),
11381
- dateOfBirth: z16.instanceof(Timestamp16).or(z16.date()).nullable(),
11382
+ dateOfBirth: z16.instanceof(Timestamp17).or(z16.date()).nullable(),
11382
11383
  gender: z16.enum(["male", "female", "other"]),
11383
11384
  profileImageUrl: mediaResourceSchema.optional().nullable(),
11384
11385
  bio: z16.string().max(1e3).optional(),
@@ -11389,8 +11390,8 @@ var practitionerCertificationSchema = z16.object({
11389
11390
  specialties: z16.array(z16.nativeEnum(CertificationSpecialty)),
11390
11391
  licenseNumber: z16.string().min(3).max(50),
11391
11392
  issuingAuthority: z16.string().min(2).max(100),
11392
- issueDate: z16.instanceof(Timestamp16).or(z16.date()),
11393
- expiryDate: z16.instanceof(Timestamp16).or(z16.date()).optional().nullable(),
11393
+ issueDate: z16.instanceof(Timestamp17).or(z16.date()),
11394
+ expiryDate: z16.instanceof(Timestamp17).or(z16.date()).optional().nullable(),
11394
11395
  verificationStatus: z16.enum(["pending", "verified", "rejected"])
11395
11396
  });
11396
11397
  var timeSlotSchema = z16.object({
@@ -11407,8 +11408,8 @@ var practitionerWorkingHoursSchema = z16.object({
11407
11408
  friday: timeSlotSchema,
11408
11409
  saturday: timeSlotSchema,
11409
11410
  sunday: timeSlotSchema,
11410
- createdAt: z16.instanceof(Timestamp16).or(z16.date()),
11411
- updatedAt: z16.instanceof(Timestamp16).or(z16.date())
11411
+ createdAt: z16.instanceof(Timestamp17).or(z16.date()),
11412
+ updatedAt: z16.instanceof(Timestamp17).or(z16.date())
11412
11413
  });
11413
11414
  var practitionerClinicWorkingHoursSchema = z16.object({
11414
11415
  clinicId: z16.string().min(1),
@@ -11422,8 +11423,8 @@ var practitionerClinicWorkingHoursSchema = z16.object({
11422
11423
  sunday: timeSlotSchema
11423
11424
  }),
11424
11425
  isActive: z16.boolean(),
11425
- createdAt: z16.instanceof(Timestamp16).or(z16.date()),
11426
- updatedAt: z16.instanceof(Timestamp16).or(z16.date())
11426
+ createdAt: z16.instanceof(Timestamp17).or(z16.date()),
11427
+ updatedAt: z16.instanceof(Timestamp17).or(z16.date())
11427
11428
  });
11428
11429
  var practitionerSchema = z16.object({
11429
11430
  id: z16.string().min(1),
@@ -11440,8 +11441,8 @@ var practitionerSchema = z16.object({
11440
11441
  isActive: z16.boolean(),
11441
11442
  isVerified: z16.boolean(),
11442
11443
  status: z16.nativeEnum(PractitionerStatus),
11443
- createdAt: z16.instanceof(Timestamp16).or(z16.date()),
11444
- updatedAt: z16.instanceof(Timestamp16).or(z16.date())
11444
+ createdAt: z16.instanceof(Timestamp17).or(z16.date()),
11445
+ updatedAt: z16.instanceof(Timestamp17).or(z16.date())
11445
11446
  });
11446
11447
  var createPractitionerSchema = z16.object({
11447
11448
  userRef: z16.string().min(1),
@@ -11475,10 +11476,10 @@ var practitionerTokenSchema = z16.object({
11475
11476
  clinicId: z16.string().min(1),
11476
11477
  status: z16.nativeEnum(PractitionerTokenStatus),
11477
11478
  createdBy: z16.string().min(1),
11478
- createdAt: z16.instanceof(Timestamp16).or(z16.date()),
11479
- expiresAt: z16.instanceof(Timestamp16).or(z16.date()),
11479
+ createdAt: z16.instanceof(Timestamp17).or(z16.date()),
11480
+ expiresAt: z16.instanceof(Timestamp17).or(z16.date()),
11480
11481
  usedBy: z16.string().optional(),
11481
- usedAt: z16.instanceof(Timestamp16).or(z16.date()).optional()
11482
+ usedAt: z16.instanceof(Timestamp17).or(z16.date()).optional()
11482
11483
  });
11483
11484
  var createPractitionerTokenSchema = z16.object({
11484
11485
  practitionerId: z16.string().min(1),
@@ -11623,8 +11624,8 @@ var PractitionerService = class extends BaseService {
11623
11624
  };
11624
11625
  practitionerSchema.parse({
11625
11626
  ...practitioner,
11626
- createdAt: Timestamp17.now(),
11627
- updatedAt: Timestamp17.now()
11627
+ createdAt: Timestamp18.now(),
11628
+ updatedAt: Timestamp18.now()
11628
11629
  });
11629
11630
  const practitionerRef = doc20(
11630
11631
  this.db,
@@ -11730,8 +11731,8 @@ var PractitionerService = class extends BaseService {
11730
11731
  practitionerSchema.parse({
11731
11732
  ...practitionerData,
11732
11733
  userRef: "temp-for-validation",
11733
- createdAt: Timestamp17.now(),
11734
- updatedAt: Timestamp17.now()
11734
+ createdAt: Timestamp18.now(),
11735
+ updatedAt: Timestamp18.now()
11735
11736
  });
11736
11737
  await setDoc11(
11737
11738
  doc20(this.db, PRACTITIONERS_COLLECTION, practitionerData.id),
@@ -11751,8 +11752,8 @@ var PractitionerService = class extends BaseService {
11751
11752
  clinicId,
11752
11753
  status: "active" /* ACTIVE */,
11753
11754
  createdBy,
11754
- createdAt: Timestamp17.now(),
11755
- expiresAt: Timestamp17.fromDate(expiration)
11755
+ createdAt: Timestamp18.now(),
11756
+ expiresAt: Timestamp18.fromDate(expiration)
11756
11757
  };
11757
11758
  practitionerTokenSchema.parse(token);
11758
11759
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
@@ -11822,8 +11823,8 @@ var PractitionerService = class extends BaseService {
11822
11823
  clinicId: validatedData.clinicId,
11823
11824
  status: "active" /* ACTIVE */,
11824
11825
  createdBy,
11825
- createdAt: Timestamp17.now(),
11826
- expiresAt: Timestamp17.fromDate(expiration)
11826
+ createdAt: Timestamp18.now(),
11827
+ expiresAt: Timestamp18.fromDate(expiration)
11827
11828
  };
11828
11829
  practitionerTokenSchema.parse(token);
11829
11830
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${validatedData.practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
@@ -11849,7 +11850,7 @@ var PractitionerService = class extends BaseService {
11849
11850
  );
11850
11851
  const conditions = [
11851
11852
  where13("status", "==", "active" /* ACTIVE */),
11852
- where13("expiresAt", ">", Timestamp17.now())
11853
+ where13("expiresAt", ">", Timestamp18.now())
11853
11854
  ];
11854
11855
  if (clinicId) {
11855
11856
  conditions.push(where13("clinicId", "==", clinicId));
@@ -11876,14 +11877,14 @@ var PractitionerService = class extends BaseService {
11876
11877
  `[PRACTITIONER] Validating token for practitioner ${practitionerId}`,
11877
11878
  {
11878
11879
  tokenString,
11879
- timestamp: Timestamp17.now().toDate()
11880
+ timestamp: Timestamp18.now().toDate()
11880
11881
  }
11881
11882
  );
11882
11883
  const q = query13(
11883
11884
  tokensRef,
11884
11885
  where13("token", "==", tokenString),
11885
11886
  where13("status", "==", "active" /* ACTIVE */),
11886
- where13("expiresAt", ">", Timestamp17.now())
11887
+ where13("expiresAt", ">", Timestamp18.now())
11887
11888
  );
11888
11889
  try {
11889
11890
  const tokenSnapshot = await getDocs13(q);
@@ -11926,7 +11927,7 @@ var PractitionerService = class extends BaseService {
11926
11927
  await updateDoc16(tokenRef, {
11927
11928
  status: "used" /* USED */,
11928
11929
  usedBy: userId,
11929
- usedAt: Timestamp17.now()
11930
+ usedAt: Timestamp18.now()
11930
11931
  });
11931
11932
  }
11932
11933
  /**
@@ -13339,7 +13340,7 @@ var UserService = class extends BaseService {
13339
13340
  email: "",
13340
13341
  phoneNumber: "",
13341
13342
  title: "",
13342
- dateOfBirth: Timestamp18.now(),
13343
+ dateOfBirth: Timestamp19.now(),
13343
13344
  gender: "other",
13344
13345
  languages: ["Serbian"]
13345
13346
  },
@@ -13348,7 +13349,7 @@ var UserService = class extends BaseService {
13348
13349
  specialties: [],
13349
13350
  licenseNumber: "",
13350
13351
  issuingAuthority: "",
13351
- issueDate: Timestamp18.now(),
13352
+ issueDate: Timestamp19.now(),
13352
13353
  verificationStatus: "pending"
13353
13354
  },
13354
13355
  isActive: true,
@@ -13497,7 +13498,7 @@ var UserService = class extends BaseService {
13497
13498
  }
13498
13499
  const updateData = {
13499
13500
  acquisitionSource: data.acquisitionSource,
13500
- acquisitionSourceTimestamp: Timestamp18.now(),
13501
+ acquisitionSourceTimestamp: Timestamp19.now(),
13501
13502
  updatedAt: serverTimestamp18()
13502
13503
  };
13503
13504
  if (data.acquisitionSource === "other" /* OTHER */) {
@@ -13685,7 +13686,7 @@ import {
13685
13686
  where as where16,
13686
13687
  updateDoc as updateDoc18,
13687
13688
  setDoc as setDoc13,
13688
- Timestamp as Timestamp19
13689
+ Timestamp as Timestamp20
13689
13690
  } from "firebase/firestore";
13690
13691
  import { geohashForLocation as geohashForLocation2 } from "geofire-common";
13691
13692
  import { z as z19 } from "zod";
@@ -13809,7 +13810,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
13809
13810
  throw geohashError;
13810
13811
  }
13811
13812
  }
13812
- const now = Timestamp19.now();
13813
+ const now = Timestamp20.now();
13813
13814
  console.log("[CLINIC_GROUP] Preparing clinic group data object");
13814
13815
  const groupId = doc22(collection16(db, CLINIC_GROUPS_COLLECTION)).id;
13815
13816
  console.log("[CLINIC_GROUP] Logo value:", {
@@ -13948,7 +13949,7 @@ async function updateClinicGroup(db, groupId, data, app) {
13948
13949
  }
13949
13950
  updatedData = {
13950
13951
  ...updatedData,
13951
- updatedAt: Timestamp19.now()
13952
+ updatedAt: Timestamp20.now()
13952
13953
  };
13953
13954
  console.log("[CLINIC_GROUP] Updating clinic group in Firestore");
13954
13955
  await updateDoc18(doc22(db, CLINIC_GROUPS_COLLECTION, groupId), updatedData);
@@ -14032,10 +14033,10 @@ async function createAdminToken(db, groupId, creatorAdminId, app, data) {
14032
14033
  if (!group.admins.includes(creatorAdminId)) {
14033
14034
  throw new Error("Admin does not belong to this clinic group");
14034
14035
  }
14035
- const now = Timestamp19.now();
14036
+ const now = Timestamp20.now();
14036
14037
  const expiresInDays = (data == null ? void 0 : data.expiresInDays) || 7;
14037
14038
  const email = (data == null ? void 0 : data.email) || null;
14038
- const expiresAt = new Timestamp19(
14039
+ const expiresAt = new Timestamp20(
14039
14040
  now.seconds + expiresInDays * 24 * 60 * 60,
14040
14041
  now.nanoseconds
14041
14042
  );
@@ -14069,7 +14070,7 @@ async function verifyAndUseAdminToken(db, groupId, token, userRef, app) {
14069
14070
  if (adminToken.status !== "active" /* ACTIVE */) {
14070
14071
  throw new Error("Admin token is not active");
14071
14072
  }
14072
- const now = Timestamp19.now();
14073
+ const now = Timestamp20.now();
14073
14074
  if (adminToken.expiresAt.seconds < now.seconds) {
14074
14075
  const updatedTokens2 = group.adminTokens.map(
14075
14076
  (t) => t.id === adminToken.id ? { ...t, status: "expired" /* EXPIRED */ } : t
@@ -14358,7 +14359,7 @@ import {
14358
14359
  where as where17,
14359
14360
  updateDoc as updateDoc19,
14360
14361
  setDoc as setDoc14,
14361
- Timestamp as Timestamp20,
14362
+ Timestamp as Timestamp21,
14362
14363
  limit as limit9,
14363
14364
  startAfter as startAfter8
14364
14365
  } from "firebase/firestore";
@@ -14569,7 +14570,7 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
14569
14570
  }
14570
14571
  updatedData = {
14571
14572
  ...updatedData,
14572
- updatedAt: Timestamp20.now()
14573
+ updatedAt: Timestamp21.now()
14573
14574
  };
14574
14575
  console.log("[CLINIC] Updating clinic in Firestore");
14575
14576
  try {
@@ -16784,7 +16785,7 @@ var AuthService = class extends BaseService {
16784
16785
  };
16785
16786
 
16786
16787
  // src/services/calendar/calendar.v2.service.ts
16787
- import { Timestamp as Timestamp29, serverTimestamp as serverTimestamp26 } from "firebase/firestore";
16788
+ import { Timestamp as Timestamp30, serverTimestamp as serverTimestamp26 } from "firebase/firestore";
16788
16789
  import {
16789
16790
  doc as doc32,
16790
16791
  getDoc as getDoc33,
@@ -16808,7 +16809,7 @@ import {
16808
16809
  query as query22,
16809
16810
  where as where22,
16810
16811
  orderBy as orderBy8,
16811
- Timestamp as Timestamp23,
16812
+ Timestamp as Timestamp24,
16812
16813
  serverTimestamp as serverTimestamp21
16813
16814
  } from "firebase/firestore";
16814
16815
 
@@ -16864,8 +16865,8 @@ async function createClinicCalendarEventUtil(db, clinicId, eventData, generateId
16864
16865
  await setDoc17(eventRef, newEvent);
16865
16866
  return {
16866
16867
  ...newEvent,
16867
- createdAt: Timestamp23.now(),
16868
- updatedAt: Timestamp23.now()
16868
+ createdAt: Timestamp24.now(),
16869
+ updatedAt: Timestamp24.now()
16869
16870
  };
16870
16871
  }
16871
16872
  async function updateClinicCalendarEventUtil(db, clinicId, eventId, updateData) {
@@ -16912,7 +16913,7 @@ import {
16912
16913
  query as query23,
16913
16914
  where as where23,
16914
16915
  orderBy as orderBy9,
16915
- Timestamp as Timestamp24,
16916
+ Timestamp as Timestamp25,
16916
16917
  serverTimestamp as serverTimestamp22
16917
16918
  } from "firebase/firestore";
16918
16919
  async function createPatientCalendarEventUtil(db, patientId, eventData, generateId2) {
@@ -16927,8 +16928,8 @@ async function createPatientCalendarEventUtil(db, patientId, eventData, generate
16927
16928
  await setDoc18(eventRef, newEvent);
16928
16929
  return {
16929
16930
  ...newEvent,
16930
- createdAt: Timestamp24.now(),
16931
- updatedAt: Timestamp24.now()
16931
+ createdAt: Timestamp25.now(),
16932
+ updatedAt: Timestamp25.now()
16932
16933
  };
16933
16934
  }
16934
16935
  async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData) {
@@ -16956,7 +16957,7 @@ import {
16956
16957
  query as query24,
16957
16958
  where as where24,
16958
16959
  orderBy as orderBy10,
16959
- Timestamp as Timestamp25,
16960
+ Timestamp as Timestamp26,
16960
16961
  serverTimestamp as serverTimestamp23
16961
16962
  } from "firebase/firestore";
16962
16963
  async function createPractitionerCalendarEventUtil(db, practitionerId, eventData, generateId2) {
@@ -16975,8 +16976,8 @@ async function createPractitionerCalendarEventUtil(db, practitionerId, eventData
16975
16976
  await setDoc19(eventRef, newEvent);
16976
16977
  return {
16977
16978
  ...newEvent,
16978
- createdAt: Timestamp25.now(),
16979
- updatedAt: Timestamp25.now()
16979
+ createdAt: Timestamp26.now(),
16980
+ updatedAt: Timestamp26.now()
16980
16981
  };
16981
16982
  }
16982
16983
  async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId, updateData) {
@@ -17059,7 +17060,7 @@ import {
17059
17060
  query as query25,
17060
17061
  where as where25,
17061
17062
  orderBy as orderBy11,
17062
- Timestamp as Timestamp26,
17063
+ Timestamp as Timestamp27,
17063
17064
  serverTimestamp as serverTimestamp24
17064
17065
  } from "firebase/firestore";
17065
17066
  async function searchCalendarEventsUtil(db, params) {
@@ -17139,7 +17140,7 @@ async function searchCalendarEventsUtil(db, params) {
17139
17140
  }
17140
17141
  if (filters.dateRange) {
17141
17142
  const MAX_EVENT_DURATION_MS = 30 * 24 * 60 * 60 * 1e3;
17142
- const extendedStart = Timestamp26.fromMillis(
17143
+ const extendedStart = Timestamp27.fromMillis(
17143
17144
  filters.dateRange.start.toMillis() - MAX_EVENT_DURATION_MS
17144
17145
  );
17145
17146
  constraints.push(where25("eventTime.start", ">=", extendedStart));
@@ -17186,7 +17187,7 @@ import {
17186
17187
  deleteDoc as deleteDoc14,
17187
17188
  query as query26,
17188
17189
  orderBy as orderBy12,
17189
- Timestamp as Timestamp27,
17190
+ Timestamp as Timestamp28,
17190
17191
  serverTimestamp as serverTimestamp25
17191
17192
  } from "firebase/firestore";
17192
17193
  async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendarData, generateId2) {
@@ -17205,8 +17206,8 @@ async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendar
17205
17206
  await setDoc21(calendarRef, newCalendar);
17206
17207
  return {
17207
17208
  ...newCalendar,
17208
- createdAt: Timestamp27.now(),
17209
- updatedAt: Timestamp27.now()
17209
+ createdAt: Timestamp28.now(),
17210
+ updatedAt: Timestamp28.now()
17210
17211
  };
17211
17212
  }
17212
17213
  async function createPatientSyncedCalendarUtil(db, patientId, calendarData, generateId2) {
@@ -17221,8 +17222,8 @@ async function createPatientSyncedCalendarUtil(db, patientId, calendarData, gene
17221
17222
  await setDoc21(calendarRef, newCalendar);
17222
17223
  return {
17223
17224
  ...newCalendar,
17224
- createdAt: Timestamp27.now(),
17225
- updatedAt: Timestamp27.now()
17225
+ createdAt: Timestamp28.now(),
17226
+ updatedAt: Timestamp28.now()
17226
17227
  };
17227
17228
  }
17228
17229
  async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, generateId2) {
@@ -17237,8 +17238,8 @@ async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, genera
17237
17238
  await setDoc21(calendarRef, newCalendar);
17238
17239
  return {
17239
17240
  ...newCalendar,
17240
- createdAt: Timestamp27.now(),
17241
- updatedAt: Timestamp27.now()
17241
+ createdAt: Timestamp28.now(),
17242
+ updatedAt: Timestamp28.now()
17242
17243
  };
17243
17244
  }
17244
17245
  async function getPractitionerSyncedCalendarUtil(db, practitionerId, calendarId) {
@@ -17357,7 +17358,7 @@ async function deleteClinicSyncedCalendarUtil(db, clinicId, calendarId) {
17357
17358
  }
17358
17359
  async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarId) {
17359
17360
  const updateData = {
17360
- lastSyncedAt: Timestamp27.now()
17361
+ lastSyncedAt: Timestamp28.now()
17361
17362
  };
17362
17363
  switch (entityType) {
17363
17364
  case "practitioner":
@@ -17387,7 +17388,7 @@ async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarI
17387
17388
  }
17388
17389
 
17389
17390
  // src/services/calendar/utils/google-calendar.utils.ts
17390
- import { Timestamp as Timestamp28 } from "firebase/firestore";
17391
+ import { Timestamp as Timestamp29 } from "firebase/firestore";
17391
17392
  var GOOGLE_CALENDAR_API_URL = "https://www.googleapis.com/calendar/v3";
17392
17393
  var GOOGLE_OAUTH_URL = "https://oauth2.googleapis.com/token";
17393
17394
  var CLIENT_ID = "your-client-id";
@@ -17507,7 +17508,7 @@ async function ensureValidToken(db, entityType, entityId, syncedCalendar) {
17507
17508
  tokenExpiry.setSeconds(tokenExpiry.getSeconds() + expiresIn);
17508
17509
  const updateData = {
17509
17510
  accessToken,
17510
- tokenExpiry: Timestamp28.fromDate(tokenExpiry)
17511
+ tokenExpiry: Timestamp29.fromDate(tokenExpiry)
17511
17512
  };
17512
17513
  switch (entityType) {
17513
17514
  case "practitioner":
@@ -17682,8 +17683,8 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
17682
17683
  eventName: googleEvent.summary || "External Event",
17683
17684
  eventLocation: googleEvent.location,
17684
17685
  eventTime: {
17685
- start: Timestamp28.fromDate(start),
17686
- end: Timestamp28.fromDate(end)
17686
+ start: Timestamp29.fromDate(start),
17687
+ end: Timestamp29.fromDate(end)
17687
17688
  },
17688
17689
  description: googleEvent.description || "",
17689
17690
  // External events are always set as CONFIRMED - status updates will happen externally
@@ -17697,7 +17698,7 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
17697
17698
  {
17698
17699
  eventId: googleEvent.id,
17699
17700
  syncedCalendarProvider: "google" /* GOOGLE */,
17700
- syncedAt: Timestamp28.now()
17701
+ syncedAt: Timestamp29.now()
17701
17702
  }
17702
17703
  ]
17703
17704
  };
@@ -18475,7 +18476,7 @@ var CalendarServiceV2 = class extends BaseService {
18475
18476
  return 0;
18476
18477
  }
18477
18478
  let importedEventsCount = 0;
18478
- const currentTime = Timestamp29.now();
18479
+ const currentTime = Timestamp30.now();
18479
18480
  for (const calendar of activeCalendars) {
18480
18481
  try {
18481
18482
  let externalEvents = [];
@@ -18558,8 +18559,8 @@ var CalendarServiceV2 = class extends BaseService {
18558
18559
  await setDoc22(eventRef, newEvent);
18559
18560
  return {
18560
18561
  ...newEvent,
18561
- createdAt: Timestamp29.now(),
18562
- updatedAt: Timestamp29.now()
18562
+ createdAt: Timestamp30.now(),
18563
+ updatedAt: Timestamp30.now()
18563
18564
  };
18564
18565
  } catch (error) {
18565
18566
  console.error(
@@ -18645,8 +18646,8 @@ var CalendarServiceV2 = class extends BaseService {
18645
18646
  const q = query27(
18646
18647
  eventsRef,
18647
18648
  where27("syncStatus", "==", "external" /* EXTERNAL */),
18648
- where27("eventTime.start", ">=", Timestamp29.fromDate(startDate)),
18649
- where27("eventTime.start", "<=", Timestamp29.fromDate(endDate))
18649
+ where27("eventTime.start", ">=", Timestamp30.fromDate(startDate)),
18650
+ where27("eventTime.start", "<=", Timestamp30.fromDate(endDate))
18650
18651
  );
18651
18652
  const eventsSnapshot = await getDocs27(q);
18652
18653
  const events = eventsSnapshot.docs.map((doc47) => ({
@@ -18765,8 +18766,8 @@ var CalendarServiceV2 = class extends BaseService {
18765
18766
  await updateDoc27(eventRef, {
18766
18767
  eventName: externalEvent.summary || "External Event",
18767
18768
  eventTime: {
18768
- start: Timestamp29.fromDate(startTime),
18769
- end: Timestamp29.fromDate(endTime)
18769
+ start: Timestamp30.fromDate(startTime),
18770
+ end: Timestamp30.fromDate(endTime)
18770
18771
  },
18771
18772
  description: externalEvent.description || "",
18772
18773
  updatedAt: serverTimestamp26()
@@ -18844,8 +18845,8 @@ var CalendarServiceV2 = class extends BaseService {
18844
18845
  */
18845
18846
  async getPractitionerUpcomingAppointments(doctorId, startDate, endDate, status = "confirmed" /* CONFIRMED */) {
18846
18847
  const dateRange = {
18847
- start: Timestamp29.fromDate(startDate),
18848
- end: Timestamp29.fromDate(endDate)
18848
+ start: Timestamp30.fromDate(startDate),
18849
+ end: Timestamp30.fromDate(endDate)
18849
18850
  };
18850
18851
  const searchParams = {
18851
18852
  searchLocation: "practitioner" /* PRACTITIONER */,
@@ -18867,8 +18868,8 @@ var CalendarServiceV2 = class extends BaseService {
18867
18868
  */
18868
18869
  async getPatientAppointments(patientId, startDate, endDate, status) {
18869
18870
  const dateRange = {
18870
- start: Timestamp29.fromDate(startDate),
18871
- end: Timestamp29.fromDate(endDate)
18871
+ start: Timestamp30.fromDate(startDate),
18872
+ end: Timestamp30.fromDate(endDate)
18872
18873
  };
18873
18874
  const searchParams = {
18874
18875
  searchLocation: "patient" /* PATIENT */,
@@ -18893,8 +18894,8 @@ var CalendarServiceV2 = class extends BaseService {
18893
18894
  */
18894
18895
  async getClinicAppointments(clinicId, startDate, endDate, doctorId, status) {
18895
18896
  const dateRange = {
18896
- start: Timestamp29.fromDate(startDate),
18897
- end: Timestamp29.fromDate(endDate)
18897
+ start: Timestamp30.fromDate(startDate),
18898
+ end: Timestamp30.fromDate(endDate)
18898
18899
  };
18899
18900
  const searchParams = {
18900
18901
  searchLocation: "clinic" /* CLINIC */,
@@ -19158,7 +19159,7 @@ var CalendarServiceV2 = class extends BaseService {
19158
19159
  const newSyncEvent = {
19159
19160
  eventId: result.eventIds[0],
19160
19161
  syncedCalendarProvider: calendar.provider,
19161
- syncedAt: Timestamp29.now()
19162
+ syncedAt: Timestamp30.now()
19162
19163
  };
19163
19164
  await this.updateEventWithSyncId(
19164
19165
  entityType === "doctor" ? appointment.practitionerProfileId : appointment.patientProfileId,
@@ -19287,8 +19288,8 @@ var CalendarServiceV2 = class extends BaseService {
19287
19288
  const q = query27(
19288
19289
  appointmentsRef,
19289
19290
  where27("practitionerProfileId", "==", doctorId),
19290
- where27("eventTime.start", ">=", Timestamp29.fromDate(startOfDay)),
19291
- where27("eventTime.start", "<=", Timestamp29.fromDate(endOfDay)),
19291
+ where27("eventTime.start", ">=", Timestamp30.fromDate(startOfDay)),
19292
+ where27("eventTime.start", "<=", Timestamp30.fromDate(endOfDay)),
19292
19293
  where27("status", "in", [
19293
19294
  "confirmed" /* CONFIRMED */,
19294
19295
  "pending" /* PENDING */
@@ -19389,7 +19390,7 @@ var CalendarServiceV2 = class extends BaseService {
19389
19390
  fullName: `${sensitiveData.firstName} ${sensitiveData.lastName}`,
19390
19391
  email: sensitiveData.email || "",
19391
19392
  phone: sensitiveData.phoneNumber || null,
19392
- dateOfBirth: sensitiveData.dateOfBirth || Timestamp29.now(),
19393
+ dateOfBirth: sensitiveData.dateOfBirth || Timestamp30.now(),
19393
19394
  gender: sensitiveData.gender || "other" /* OTHER */
19394
19395
  };
19395
19396
  } else if (patientDoc.exists()) {
@@ -19398,7 +19399,7 @@ var CalendarServiceV2 = class extends BaseService {
19398
19399
  fullName: patientDoc.data().displayName,
19399
19400
  email: ((_a = patientDoc.data().contactInfo) == null ? void 0 : _a.email) || "",
19400
19401
  phone: patientDoc.data().phoneNumber || null,
19401
- dateOfBirth: patientDoc.data().dateOfBirth || Timestamp29.now(),
19402
+ dateOfBirth: patientDoc.data().dateOfBirth || Timestamp30.now(),
19402
19403
  gender: patientDoc.data().gender || "other" /* OTHER */
19403
19404
  };
19404
19405
  }
@@ -19420,7 +19421,7 @@ var CalendarServiceV2 = class extends BaseService {
19420
19421
  };
19421
19422
 
19422
19423
  // src/services/calendar/calendar.v3.service.ts
19423
- import { Timestamp as Timestamp30, serverTimestamp as serverTimestamp27 } from "firebase/firestore";
19424
+ import { Timestamp as Timestamp31, serverTimestamp as serverTimestamp27 } from "firebase/firestore";
19424
19425
  import { doc as doc33, getDoc as getDoc34, setDoc as setDoc23, updateDoc as updateDoc28, deleteDoc as deleteDoc15 } from "firebase/firestore";
19425
19426
  var CalendarServiceV3 = class extends BaseService {
19426
19427
  /**
@@ -19466,8 +19467,8 @@ var CalendarServiceV3 = class extends BaseService {
19466
19467
  await setDoc23(eventRef, eventData);
19467
19468
  return {
19468
19469
  ...eventData,
19469
- createdAt: Timestamp30.now(),
19470
- updatedAt: Timestamp30.now()
19470
+ createdAt: Timestamp31.now(),
19471
+ updatedAt: Timestamp31.now()
19471
19472
  };
19472
19473
  }
19473
19474
  /**
@@ -19732,7 +19733,7 @@ import {
19732
19733
  updateDoc as updateDoc29,
19733
19734
  setDoc as setDoc24,
19734
19735
  deleteDoc as deleteDoc16,
19735
- Timestamp as Timestamp31,
19736
+ Timestamp as Timestamp32,
19736
19737
  serverTimestamp as serverTimestamp28,
19737
19738
  orderBy as orderBy13,
19738
19739
  limit as limit12
@@ -19798,7 +19799,7 @@ var PractitionerInviteService = class extends BaseService {
19798
19799
  message: message || null,
19799
19800
  status: "pending" /* PENDING */
19800
19801
  };
19801
- const now = Timestamp31.now();
19802
+ const now = Timestamp32.now();
19802
19803
  const invite = {
19803
19804
  id: inviteId,
19804
19805
  ...inviteData,
@@ -19894,7 +19895,7 @@ var PractitionerInviteService = class extends BaseService {
19894
19895
  }
19895
19896
  const updateData = {
19896
19897
  status: "accepted" /* ACCEPTED */,
19897
- acceptedAt: Timestamp31.now(),
19898
+ acceptedAt: Timestamp32.now(),
19898
19899
  updatedAt: serverTimestamp28()
19899
19900
  };
19900
19901
  const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
@@ -19926,7 +19927,7 @@ var PractitionerInviteService = class extends BaseService {
19926
19927
  const updateData = {
19927
19928
  status: "rejected" /* REJECTED */,
19928
19929
  rejectionReason: rejectionReason || null,
19929
- rejectedAt: Timestamp31.now(),
19930
+ rejectedAt: Timestamp32.now(),
19930
19931
  updatedAt: serverTimestamp28()
19931
19932
  };
19932
19933
  const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
@@ -19958,7 +19959,7 @@ var PractitionerInviteService = class extends BaseService {
19958
19959
  const updateData = {
19959
19960
  status: "cancelled" /* CANCELLED */,
19960
19961
  cancelReason: cancelReason || null,
19961
- cancelledAt: Timestamp31.now(),
19962
+ cancelledAt: Timestamp32.now(),
19962
19963
  updatedAt: serverTimestamp28()
19963
19964
  };
19964
19965
  const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
@@ -20875,7 +20876,7 @@ import {
20875
20876
  updateDoc as updateDoc32,
20876
20877
  deleteDoc as deleteDoc18,
20877
20878
  orderBy as orderBy16,
20878
- Timestamp as Timestamp33,
20879
+ Timestamp as Timestamp34,
20879
20880
  addDoc as addDoc3,
20880
20881
  writeBatch as writeBatch5
20881
20882
  } from "firebase/firestore";
@@ -20885,7 +20886,7 @@ var NotificationService = class extends BaseService {
20885
20886
  */
20886
20887
  async createNotification(notification) {
20887
20888
  const notificationsRef = collection31(this.db, NOTIFICATIONS_COLLECTION);
20888
- const now = Timestamp33.now();
20889
+ const now = Timestamp34.now();
20889
20890
  const notificationData = {
20890
20891
  ...notification,
20891
20892
  createdAt: now,
@@ -20960,7 +20961,7 @@ var NotificationService = class extends BaseService {
20960
20961
  );
20961
20962
  await updateDoc32(notificationRef, {
20962
20963
  isRead: true,
20963
- updatedAt: Timestamp33.now()
20964
+ updatedAt: Timestamp34.now()
20964
20965
  });
20965
20966
  }
20966
20967
  /**
@@ -20977,7 +20978,7 @@ var NotificationService = class extends BaseService {
20977
20978
  );
20978
20979
  batch.update(notificationRef, {
20979
20980
  isRead: true,
20980
- updatedAt: Timestamp33.now()
20981
+ updatedAt: Timestamp34.now()
20981
20982
  });
20982
20983
  });
20983
20984
  await batch.commit();
@@ -20993,7 +20994,7 @@ var NotificationService = class extends BaseService {
20993
20994
  );
20994
20995
  await updateDoc32(notificationRef, {
20995
20996
  status,
20996
- updatedAt: Timestamp33.now()
20997
+ updatedAt: Timestamp34.now()
20997
20998
  });
20998
20999
  }
20999
21000
  /**
@@ -21048,7 +21049,7 @@ import {
21048
21049
  where as where32,
21049
21050
  doc as doc38,
21050
21051
  updateDoc as updateDoc33,
21051
- Timestamp as Timestamp34,
21052
+ Timestamp as Timestamp35,
21052
21053
  orderBy as orderBy17,
21053
21054
  limit as limit15,
21054
21055
  startAfter as startAfter13,
@@ -21183,7 +21184,7 @@ var PatientRequirementsService = class extends BaseService {
21183
21184
  `Instruction ${instructionId} is in status ${instructionToUpdate.status} and cannot be marked as completed.`
21184
21185
  );
21185
21186
  }
21186
- const now = Timestamp34.now();
21187
+ const now = Timestamp35.now();
21187
21188
  const updatedInstructions = [...instance.instructions];
21188
21189
  updatedInstructions[instructionIndex] = {
21189
21190
  ...instructionToUpdate,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.14.46",
4
+ "version": "1.14.47",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -1,4 +1,4 @@
1
- import { Firestore, updateDoc, serverTimestamp, doc } from 'firebase/firestore';
1
+ import { Firestore, updateDoc, serverTimestamp, doc, Timestamp } from 'firebase/firestore';
2
2
  import {
3
3
  Appointment,
4
4
  BeforeAfterPerZone,
@@ -9,6 +9,9 @@ import { MediaResource } from '../../media/media.service';
9
9
 
10
10
  /**
11
11
  * Updates visibility fields with audit trail
12
+ * Note: We use Timestamp.now() instead of serverTimestamp() because Firestore
13
+ * doesn't support serverTimestamp() inside arrays. The timestamp will be set
14
+ * on the client side, which is acceptable for audit purposes.
12
15
  * @param updates Partial updates object
13
16
  * @param doctorId ID of the doctor making the change
14
17
  */
@@ -24,7 +27,7 @@ function addVisibilityAudit(
24
27
  ) {
25
28
  return {
26
29
  ...updates,
27
- visibilityUpdatedAt: serverTimestamp() as any,
30
+ visibilityUpdatedAt: Timestamp.now(), // Use client-side timestamp (Firestore limitation)
28
31
  visibilityUpdatedBy: doctorId,
29
32
  };
30
33
  }