@blackcode_sa/metaestetics-api 1.7.4 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -580,6 +580,7 @@ import { z as z19 } from "zod";
580
580
 
581
581
  // src/validations/schemas.ts
582
582
  import { z as z3 } from "zod";
583
+ import { serverTimestamp } from "firebase/firestore";
583
584
  var emailSchema = z3.string().email("Invalid email format").min(5, "Email must be at least 5 characters").max(255, "Email must be less than 255 characters");
584
585
  var passwordSchema = z3.string().min(8, "Password must be at least 8 characters").max(100, "Password must be less than 100 characters").regex(
585
586
  /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d\w\W]{8,}$/,
@@ -591,8 +592,14 @@ var timestampSchema = z3.custom((data) => {
591
592
  if (data && typeof data === "object" && "isEqual" in data) {
592
593
  return true;
593
594
  }
594
- return data && typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data;
595
- }, "Must be a Timestamp object or serverTimestamp");
595
+ if (data && typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data) {
596
+ return true;
597
+ }
598
+ if (data === serverTimestamp) {
599
+ return true;
600
+ }
601
+ return false;
602
+ }, "Must be a Timestamp object, FieldValue or serverTimestamp function");
596
603
  var clinicAdminOptionsSchema = z3.object({
597
604
  isGroupOwner: z3.boolean(),
598
605
  groupToken: z3.string().optional(),
@@ -885,9 +892,9 @@ import {
885
892
  where as where7,
886
893
  updateDoc as updateDoc9,
887
894
  deleteDoc as deleteDoc3,
888
- Timestamp as Timestamp10,
895
+ Timestamp as Timestamp11,
889
896
  setDoc as setDoc8,
890
- serverTimestamp as serverTimestamp10
897
+ serverTimestamp as serverTimestamp11
891
898
  } from "firebase/firestore";
892
899
 
893
900
  // src/errors/user.errors.ts
@@ -999,9 +1006,9 @@ import {
999
1006
  updateDoc as updateDoc3,
1000
1007
  arrayUnion as arrayUnion2,
1001
1008
  arrayRemove as arrayRemove2,
1002
- serverTimestamp as serverTimestamp4,
1009
+ serverTimestamp as serverTimestamp5,
1003
1010
  increment,
1004
- Timestamp as Timestamp4,
1011
+ Timestamp as Timestamp5,
1005
1012
  collection as collection3,
1006
1013
  query as query3,
1007
1014
  where as where3,
@@ -1041,7 +1048,7 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
1041
1048
 
1042
1049
  // src/validations/patient.schema.ts
1043
1050
  import { z as z6 } from "zod";
1044
- import { Timestamp as Timestamp2 } from "firebase/firestore";
1051
+ import { Timestamp as Timestamp3 } from "firebase/firestore";
1045
1052
 
1046
1053
  // src/validations/patient/medical-info.schema.ts
1047
1054
  import { z as z5 } from "zod";
@@ -1134,18 +1141,18 @@ var Contraindication = /* @__PURE__ */ ((Contraindication2) => {
1134
1141
 
1135
1142
  // src/validations/common.schema.ts
1136
1143
  import { z as z4 } from "zod";
1137
- import { Timestamp } from "firebase/firestore";
1144
+ import { Timestamp as Timestamp2 } from "firebase/firestore";
1138
1145
  var timestampSchema2 = z4.union([
1139
1146
  z4.object({
1140
1147
  seconds: z4.number(),
1141
1148
  nanoseconds: z4.number()
1142
1149
  }),
1143
- z4.instanceof(Timestamp)
1150
+ z4.instanceof(Timestamp2)
1144
1151
  ]).transform((data) => {
1145
- if (data instanceof Timestamp) {
1152
+ if (data instanceof Timestamp2) {
1146
1153
  return data;
1147
1154
  }
1148
- return new Timestamp(data.seconds, data.nanoseconds);
1155
+ return new Timestamp2(data.seconds, data.nanoseconds);
1149
1156
  });
1150
1157
 
1151
1158
  // src/validations/patient/medical-info.schema.ts
@@ -1261,8 +1268,8 @@ var patientLocationInfoSchema = z6.object({
1261
1268
  patientId: z6.string(),
1262
1269
  userRef: z6.string(),
1263
1270
  locationData: locationDataSchema,
1264
- createdAt: z6.instanceof(Timestamp2),
1265
- updatedAt: z6.instanceof(Timestamp2)
1271
+ createdAt: z6.instanceof(Timestamp3),
1272
+ updatedAt: z6.instanceof(Timestamp3)
1266
1273
  });
1267
1274
  var createPatientLocationInfoSchema = z6.object({
1268
1275
  patientId: z6.string(),
@@ -1275,26 +1282,26 @@ var patientSensitiveInfoSchema = z6.object({
1275
1282
  photoUrl: z6.string().optional(),
1276
1283
  firstName: z6.string().min(2),
1277
1284
  lastName: z6.string().min(2),
1278
- dateOfBirth: z6.instanceof(Timestamp2).nullable(),
1285
+ dateOfBirth: z6.instanceof(Timestamp3).nullable(),
1279
1286
  gender: z6.nativeEnum(Gender),
1280
1287
  email: z6.string().email().optional(),
1281
1288
  phoneNumber: z6.string().optional(),
1282
1289
  alternativePhoneNumber: z6.string().optional(),
1283
1290
  addressData: addressDataSchema.optional(),
1284
1291
  emergencyContacts: z6.array(emergencyContactSchema).optional(),
1285
- createdAt: z6.instanceof(Timestamp2),
1286
- updatedAt: z6.instanceof(Timestamp2)
1292
+ createdAt: z6.instanceof(Timestamp3),
1293
+ updatedAt: z6.instanceof(Timestamp3)
1287
1294
  });
1288
1295
  var patientDoctorSchema = z6.object({
1289
1296
  userRef: z6.string(),
1290
- assignedAt: z6.instanceof(Timestamp2),
1297
+ assignedAt: z6.instanceof(Timestamp3),
1291
1298
  assignedBy: z6.string().optional(),
1292
1299
  isActive: z6.boolean(),
1293
1300
  notes: z6.string().optional()
1294
1301
  });
1295
1302
  var patientClinicSchema = z6.object({
1296
1303
  clinicId: z6.string(),
1297
- assignedAt: z6.instanceof(Timestamp2),
1304
+ assignedAt: z6.instanceof(Timestamp3),
1298
1305
  assignedBy: z6.string().optional(),
1299
1306
  isActive: z6.boolean(),
1300
1307
  notes: z6.string().optional()
@@ -1312,8 +1319,8 @@ var patientProfileSchema = z6.object({
1312
1319
  clinics: z6.array(patientClinicSchema),
1313
1320
  doctorIds: z6.array(z6.string()),
1314
1321
  clinicIds: z6.array(z6.string()),
1315
- createdAt: z6.instanceof(Timestamp2),
1316
- updatedAt: z6.instanceof(Timestamp2)
1322
+ createdAt: z6.instanceof(Timestamp3),
1323
+ updatedAt: z6.instanceof(Timestamp3)
1317
1324
  });
1318
1325
  var createPatientProfileSchema = z6.object({
1319
1326
  userRef: z6.string(),
@@ -1334,7 +1341,7 @@ var createPatientSensitiveInfoSchema = z6.object({
1334
1341
  photoUrl: z6.string().optional(),
1335
1342
  firstName: z6.string().min(2),
1336
1343
  lastName: z6.string().min(2),
1337
- dateOfBirth: z6.instanceof(Timestamp2).nullable(),
1344
+ dateOfBirth: z6.instanceof(Timestamp3).nullable(),
1338
1345
  gender: z6.nativeEnum(Gender),
1339
1346
  email: z6.string().email().optional(),
1340
1347
  phoneNumber: z6.string().optional(),
@@ -1385,7 +1392,7 @@ import {
1385
1392
  getDoc,
1386
1393
  updateDoc,
1387
1394
  setDoc,
1388
- serverTimestamp
1395
+ serverTimestamp as serverTimestamp2
1389
1396
  } from "firebase/firestore";
1390
1397
  import { z as z7 } from "zod";
1391
1398
  var createSensitiveInfoUtil = async (db, data, requesterUserId) => {
@@ -1402,8 +1409,8 @@ var createSensitiveInfoUtil = async (db, data, requesterUserId) => {
1402
1409
  }
1403
1410
  const sensitiveInfoData = {
1404
1411
  ...validatedData,
1405
- createdAt: serverTimestamp(),
1406
- updatedAt: serverTimestamp()
1412
+ createdAt: serverTimestamp2(),
1413
+ updatedAt: serverTimestamp2()
1407
1414
  };
1408
1415
  await setDoc(getSensitiveInfoDocRef(db, data.patientId), sensitiveInfoData);
1409
1416
  const createdDoc = await getDoc(getSensitiveInfoDocRef(db, data.patientId));
@@ -1427,7 +1434,7 @@ var updateSensitiveInfoUtil = async (db, patientId, data, requesterUserId) => {
1427
1434
  await initSensitiveInfoDocIfNotExists(db, patientId, requesterUserId);
1428
1435
  const updateData = {
1429
1436
  ...data,
1430
- updatedAt: serverTimestamp()
1437
+ updatedAt: serverTimestamp2()
1431
1438
  };
1432
1439
  await updateDoc(getSensitiveInfoDocRef(db, patientId), updateData);
1433
1440
  const updatedDoc = await getDoc(getSensitiveInfoDocRef(db, patientId));
@@ -1537,9 +1544,9 @@ import {
1537
1544
  getDoc as getDoc4,
1538
1545
  updateDoc as updateDoc2,
1539
1546
  setDoc as setDoc3,
1540
- serverTimestamp as serverTimestamp3,
1547
+ serverTimestamp as serverTimestamp4,
1541
1548
  arrayUnion,
1542
- Timestamp as Timestamp3
1549
+ Timestamp as Timestamp4
1543
1550
  } from "firebase/firestore";
1544
1551
 
1545
1552
  // src/services/patient/utils/practitioner.utils.ts
@@ -1710,7 +1717,7 @@ var ensureMedicalInfoExists = async (db, patientId, userRef) => {
1710
1717
  const defaultData = {
1711
1718
  ...DEFAULT_MEDICAL_INFO,
1712
1719
  patientId,
1713
- lastUpdated: serverTimestamp3(),
1720
+ lastUpdated: serverTimestamp4(),
1714
1721
  updatedBy: userRef
1715
1722
  };
1716
1723
  console.log(
@@ -1774,7 +1781,7 @@ var createMedicalInfoUtil = async (db, patientId, data, userRef, userRoles) => {
1774
1781
  await setDoc3(getMedicalInfoDocRef(db, patientId), {
1775
1782
  ...validatedData,
1776
1783
  patientId,
1777
- lastUpdated: Timestamp3.now(),
1784
+ lastUpdated: Timestamp4.now(),
1778
1785
  updatedBy: userRef
1779
1786
  });
1780
1787
  };
@@ -1792,7 +1799,7 @@ var updateVitalStatsUtil = async (db, patientId, data, userRef) => {
1792
1799
  const validatedData = updateVitalStatsSchema.parse(data);
1793
1800
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1794
1801
  vitalStats: validatedData,
1795
- lastUpdated: serverTimestamp3(),
1802
+ lastUpdated: serverTimestamp4(),
1796
1803
  updatedBy: userRef
1797
1804
  });
1798
1805
  };
@@ -1801,7 +1808,7 @@ var addAllergyUtil = async (db, patientId, data, userRef) => {
1801
1808
  const validatedData = addAllergySchema.parse(data);
1802
1809
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1803
1810
  allergies: arrayUnion(validatedData),
1804
- lastUpdated: serverTimestamp3(),
1811
+ lastUpdated: serverTimestamp4(),
1805
1812
  updatedBy: userRef
1806
1813
  });
1807
1814
  };
@@ -1821,7 +1828,7 @@ var updateAllergyUtil = async (db, patientId, data, userRef) => {
1821
1828
  };
1822
1829
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1823
1830
  allergies: updatedAllergies,
1824
- lastUpdated: serverTimestamp3(),
1831
+ lastUpdated: serverTimestamp4(),
1825
1832
  updatedBy: userRef
1826
1833
  });
1827
1834
  };
@@ -1837,7 +1844,7 @@ var removeAllergyUtil = async (db, patientId, allergyIndex, userRef) => {
1837
1844
  );
1838
1845
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1839
1846
  allergies: updatedAllergies,
1840
- lastUpdated: serverTimestamp3(),
1847
+ lastUpdated: serverTimestamp4(),
1841
1848
  updatedBy: userRef
1842
1849
  });
1843
1850
  };
@@ -1846,7 +1853,7 @@ var addBlockingConditionUtil = async (db, patientId, data, userRef) => {
1846
1853
  const validatedData = addBlockingConditionSchema.parse(data);
1847
1854
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1848
1855
  blockingConditions: arrayUnion(validatedData),
1849
- lastUpdated: serverTimestamp3(),
1856
+ lastUpdated: serverTimestamp4(),
1850
1857
  updatedBy: userRef
1851
1858
  });
1852
1859
  };
@@ -1866,7 +1873,7 @@ var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
1866
1873
  };
1867
1874
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1868
1875
  blockingConditions: updatedConditions,
1869
- lastUpdated: serverTimestamp3(),
1876
+ lastUpdated: serverTimestamp4(),
1870
1877
  updatedBy: userRef
1871
1878
  });
1872
1879
  };
@@ -1882,7 +1889,7 @@ var removeBlockingConditionUtil = async (db, patientId, conditionIndex, userRef)
1882
1889
  );
1883
1890
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1884
1891
  blockingConditions: updatedConditions,
1885
- lastUpdated: serverTimestamp3(),
1892
+ lastUpdated: serverTimestamp4(),
1886
1893
  updatedBy: userRef
1887
1894
  });
1888
1895
  };
@@ -1891,7 +1898,7 @@ var addContraindicationUtil = async (db, patientId, data, userRef) => {
1891
1898
  const validatedData = addContraindicationSchema.parse(data);
1892
1899
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1893
1900
  contraindications: arrayUnion(validatedData),
1894
- lastUpdated: serverTimestamp3(),
1901
+ lastUpdated: serverTimestamp4(),
1895
1902
  updatedBy: userRef
1896
1903
  });
1897
1904
  };
@@ -1911,7 +1918,7 @@ var updateContraindicationUtil = async (db, patientId, data, userRef) => {
1911
1918
  };
1912
1919
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1913
1920
  contraindications: updatedContraindications,
1914
- lastUpdated: serverTimestamp3(),
1921
+ lastUpdated: serverTimestamp4(),
1915
1922
  updatedBy: userRef
1916
1923
  });
1917
1924
  };
@@ -1927,7 +1934,7 @@ var removeContraindicationUtil = async (db, patientId, contraindicationIndex, us
1927
1934
  );
1928
1935
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1929
1936
  contraindications: updatedContraindications,
1930
- lastUpdated: serverTimestamp3(),
1937
+ lastUpdated: serverTimestamp4(),
1931
1938
  updatedBy: userRef
1932
1939
  });
1933
1940
  };
@@ -1936,7 +1943,7 @@ var addMedicationUtil = async (db, patientId, data, userRef) => {
1936
1943
  const validatedData = addMedicationSchema.parse(data);
1937
1944
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1938
1945
  currentMedications: arrayUnion(validatedData),
1939
- lastUpdated: serverTimestamp3(),
1946
+ lastUpdated: serverTimestamp4(),
1940
1947
  updatedBy: userRef
1941
1948
  });
1942
1949
  };
@@ -1956,7 +1963,7 @@ var updateMedicationUtil = async (db, patientId, data, userRef) => {
1956
1963
  };
1957
1964
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1958
1965
  currentMedications: updatedMedications,
1959
- lastUpdated: serverTimestamp3(),
1966
+ lastUpdated: serverTimestamp4(),
1960
1967
  updatedBy: userRef
1961
1968
  });
1962
1969
  };
@@ -1972,7 +1979,7 @@ var removeMedicationUtil = async (db, patientId, medicationIndex, userRef) => {
1972
1979
  );
1973
1980
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1974
1981
  currentMedications: updatedMedications,
1975
- lastUpdated: serverTimestamp3(),
1982
+ lastUpdated: serverTimestamp4(),
1976
1983
  updatedBy: userRef
1977
1984
  });
1978
1985
  };
@@ -2001,13 +2008,13 @@ var createPatientProfileUtil = async (db, data, generateId2) => {
2001
2008
  clinics: validatedData.clinics || [],
2002
2009
  doctorIds: ((_a = validatedData.doctors) == null ? void 0 : _a.map((d) => d.userRef)) || [],
2003
2010
  clinicIds: ((_b = validatedData.clinics) == null ? void 0 : _b.map((c) => c.clinicId)) || [],
2004
- createdAt: serverTimestamp4(),
2005
- updatedAt: serverTimestamp4()
2011
+ createdAt: serverTimestamp5(),
2012
+ updatedAt: serverTimestamp5()
2006
2013
  };
2007
2014
  patientProfileSchema.parse({
2008
2015
  ...patientData,
2009
- createdAt: Timestamp4.now(),
2010
- updatedAt: Timestamp4.now()
2016
+ createdAt: Timestamp5.now(),
2017
+ updatedAt: Timestamp5.now()
2011
2018
  });
2012
2019
  await setDoc4(getPatientDocRef(db, patientId), patientData);
2013
2020
  console.log(`[createPatientProfileUtil] Creating sensitive info document`);
@@ -2075,26 +2082,26 @@ var getPatientProfileByUserRefUtil = async (db, userRef) => {
2075
2082
  var addExpoTokenUtil = async (db, patientId, token) => {
2076
2083
  await updateDoc3(getPatientDocRef(db, patientId), {
2077
2084
  expoTokens: arrayUnion2(token),
2078
- updatedAt: serverTimestamp4()
2085
+ updatedAt: serverTimestamp5()
2079
2086
  });
2080
2087
  };
2081
2088
  var removeExpoTokenUtil = async (db, patientId, token) => {
2082
2089
  await updateDoc3(getPatientDocRef(db, patientId), {
2083
2090
  expoTokens: arrayRemove2(token),
2084
- updatedAt: serverTimestamp4()
2091
+ updatedAt: serverTimestamp5()
2085
2092
  });
2086
2093
  };
2087
2094
  var addPointsUtil = async (db, patientId, points) => {
2088
2095
  await updateDoc3(getPatientDocRef(db, patientId), {
2089
2096
  "gamification.points": increment(points),
2090
- updatedAt: serverTimestamp4()
2097
+ updatedAt: serverTimestamp5()
2091
2098
  });
2092
2099
  };
2093
2100
  var updatePatientProfileUtil = async (db, patientId, data) => {
2094
2101
  try {
2095
2102
  const updateData = {
2096
2103
  ...data,
2097
- updatedAt: serverTimestamp4()
2104
+ updatedAt: serverTimestamp5()
2098
2105
  };
2099
2106
  await updateDoc3(getPatientDocRef(db, patientId), updateData);
2100
2107
  const updatedDoc = await getDoc5(getPatientDocRef(db, patientId));
@@ -2141,7 +2148,7 @@ var updateProfilePhotoUtil = async (storage, db, patientId, file) => {
2141
2148
  const newPhotoUrl = await uploadProfilePhotoUtil(storage, patientId, file);
2142
2149
  await updateDoc3(getPatientDocRef(db, patientId), {
2143
2150
  profilePhoto: newPhotoUrl,
2144
- updatedAt: serverTimestamp4()
2151
+ updatedAt: serverTimestamp5()
2145
2152
  });
2146
2153
  return newPhotoUrl;
2147
2154
  };
@@ -2159,7 +2166,7 @@ var deleteProfilePhotoUtil = async (storage, db, patientId) => {
2159
2166
  }
2160
2167
  await updateDoc3(getPatientDocRef(db, patientId), {
2161
2168
  profilePhoto: null,
2162
- updatedAt: serverTimestamp4()
2169
+ updatedAt: serverTimestamp5()
2163
2170
  });
2164
2171
  };
2165
2172
  var testCreateSubDocuments = async (db, patientId, userRef) => {
@@ -2176,12 +2183,12 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
2176
2183
  photoUrl: "",
2177
2184
  firstName: "Name",
2178
2185
  lastName: "Surname",
2179
- dateOfBirth: Timestamp4.now(),
2186
+ dateOfBirth: Timestamp5.now(),
2180
2187
  gender: "prefer_not_to_say" /* PREFER_NOT_TO_SAY */,
2181
2188
  email: "test@example.com",
2182
2189
  phoneNumber: "",
2183
- createdAt: Timestamp4.now(),
2184
- updatedAt: Timestamp4.now()
2190
+ createdAt: Timestamp5.now(),
2191
+ updatedAt: Timestamp5.now()
2185
2192
  };
2186
2193
  await setDoc4(sensitiveInfoRef, defaultSensitiveInfo);
2187
2194
  console.log(`[testCreateSubDocuments] Sensitive info document created directly`);
@@ -2191,7 +2198,7 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
2191
2198
  const defaultMedicalInfo = {
2192
2199
  ...DEFAULT_MEDICAL_INFO,
2193
2200
  patientId,
2194
- lastUpdated: Timestamp4.now(),
2201
+ lastUpdated: Timestamp5.now(),
2195
2202
  updatedBy: userRef
2196
2203
  };
2197
2204
  await setDoc4(medicalInfoRef, defaultMedicalInfo);
@@ -2283,7 +2290,7 @@ import {
2283
2290
  getDoc as getDoc6,
2284
2291
  updateDoc as updateDoc4,
2285
2292
  setDoc as setDoc5,
2286
- serverTimestamp as serverTimestamp5
2293
+ serverTimestamp as serverTimestamp6
2287
2294
  } from "firebase/firestore";
2288
2295
  import { z as z9 } from "zod";
2289
2296
  import { geohashForLocation } from "geofire-common";
@@ -2295,7 +2302,7 @@ var updatePatientLocationUtil = async (db, patientId, latitude, longitude) => {
2295
2302
  };
2296
2303
  const updateData = {
2297
2304
  locationData,
2298
- updatedAt: serverTimestamp5()
2305
+ updatedAt: serverTimestamp6()
2299
2306
  };
2300
2307
  await updateDoc4(getLocationInfoDocRef(db, patientId), updateData);
2301
2308
  };
@@ -2314,8 +2321,8 @@ var createLocationInfoUtil = async (db, data, requesterId) => {
2314
2321
  validatedData.locationData.longitude
2315
2322
  ])
2316
2323
  },
2317
- createdAt: serverTimestamp5(),
2318
- updatedAt: serverTimestamp5()
2324
+ createdAt: serverTimestamp6(),
2325
+ updatedAt: serverTimestamp6()
2319
2326
  };
2320
2327
  await setDoc5(getLocationInfoDocRef(db, data.patientId), locationData);
2321
2328
  const locationDoc = await getDoc6(getLocationInfoDocRef(db, data.patientId));
@@ -2351,7 +2358,7 @@ var updateLocationInfoUtil = async (db, patientId, data, requesterId) => {
2351
2358
  ])
2352
2359
  };
2353
2360
  }
2354
- updateData.updatedAt = serverTimestamp5();
2361
+ updateData.updatedAt = serverTimestamp6();
2355
2362
  await updateDoc4(getLocationInfoDocRef(db, patientId), updateData);
2356
2363
  const updatedInfo = await getLocationInfoUtil(db, patientId, requesterId);
2357
2364
  if (!updatedInfo) {
@@ -2366,14 +2373,14 @@ import {
2366
2373
  updateDoc as updateDoc5,
2367
2374
  arrayUnion as arrayUnion3,
2368
2375
  arrayRemove as arrayRemove3,
2369
- serverTimestamp as serverTimestamp6,
2370
- Timestamp as Timestamp5
2376
+ serverTimestamp as serverTimestamp7,
2377
+ Timestamp as Timestamp6
2371
2378
  } from "firebase/firestore";
2372
2379
  var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
2373
2380
  var _a;
2374
2381
  const newDoctor = {
2375
2382
  userRef: doctorRef,
2376
- assignedAt: Timestamp5.now(),
2383
+ assignedAt: Timestamp6.now(),
2377
2384
  assignedBy,
2378
2385
  isActive: true
2379
2386
  };
@@ -2384,7 +2391,7 @@ var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
2384
2391
  (d) => d.userRef === doctorRef
2385
2392
  );
2386
2393
  const updates = {
2387
- updatedAt: serverTimestamp6(),
2394
+ updatedAt: serverTimestamp7(),
2388
2395
  doctorIds: arrayUnion3(doctorRef)
2389
2396
  };
2390
2397
  if (existingDoctorIndex !== void 0 && existingDoctorIndex > -1) {
@@ -2392,7 +2399,7 @@ var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
2392
2399
  updatedDoctors[existingDoctorIndex] = {
2393
2400
  ...updatedDoctors[existingDoctorIndex],
2394
2401
  isActive: true,
2395
- assignedAt: Timestamp5.now(),
2402
+ assignedAt: Timestamp6.now(),
2396
2403
  assignedBy
2397
2404
  };
2398
2405
  updates.doctors = updatedDoctors;
@@ -2413,14 +2420,14 @@ var removeDoctorUtil = async (db, patientId, doctorRef) => {
2413
2420
  // Set the filtered array
2414
2421
  doctorIds: arrayRemove3(doctorRef),
2415
2422
  // Remove ID from the denormalized list
2416
- updatedAt: serverTimestamp6()
2423
+ updatedAt: serverTimestamp7()
2417
2424
  });
2418
2425
  };
2419
2426
  var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
2420
2427
  var _a;
2421
2428
  const newClinic = {
2422
2429
  clinicId,
2423
- assignedAt: Timestamp5.now(),
2430
+ assignedAt: Timestamp6.now(),
2424
2431
  assignedBy,
2425
2432
  isActive: true
2426
2433
  };
@@ -2431,7 +2438,7 @@ var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
2431
2438
  (c) => c.clinicId === clinicId
2432
2439
  );
2433
2440
  const updates = {
2434
- updatedAt: serverTimestamp6(),
2441
+ updatedAt: serverTimestamp7(),
2435
2442
  clinicIds: arrayUnion3(clinicId)
2436
2443
  };
2437
2444
  if (existingClinicIndex !== void 0 && existingClinicIndex > -1) {
@@ -2439,7 +2446,7 @@ var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
2439
2446
  updatedClinics[existingClinicIndex] = {
2440
2447
  ...updatedClinics[existingClinicIndex],
2441
2448
  isActive: true,
2442
- assignedAt: Timestamp5.now(),
2449
+ assignedAt: Timestamp6.now(),
2443
2450
  assignedBy
2444
2451
  };
2445
2452
  updates.clinics = updatedClinics;
@@ -2460,7 +2467,7 @@ var removeClinicUtil = async (db, patientId, clinicId) => {
2460
2467
  // Set the filtered array
2461
2468
  clinicIds: arrayRemove3(clinicId),
2462
2469
  // Remove ID from the denormalized list
2463
- updatedAt: serverTimestamp6()
2470
+ updatedAt: serverTimestamp7()
2464
2471
  });
2465
2472
  };
2466
2473
 
@@ -2847,8 +2854,8 @@ import {
2847
2854
  updateDoc as updateDoc7,
2848
2855
  setDoc as setDoc6,
2849
2856
  deleteDoc,
2850
- Timestamp as Timestamp7,
2851
- serverTimestamp as serverTimestamp8
2857
+ Timestamp as Timestamp8,
2858
+ serverTimestamp as serverTimestamp9
2852
2859
  } from "firebase/firestore";
2853
2860
 
2854
2861
  // src/types/clinic/preferences.types.ts
@@ -2976,7 +2983,7 @@ var SubscriptionModel = /* @__PURE__ */ ((SubscriptionModel2) => {
2976
2983
 
2977
2984
  // src/validations/clinic.schema.ts
2978
2985
  import { z as z12 } from "zod";
2979
- import { Timestamp as Timestamp6 } from "firebase/firestore";
2986
+ import { Timestamp as Timestamp7 } from "firebase/firestore";
2980
2987
 
2981
2988
  // src/validations/reviews.schema.ts
2982
2989
  import { z as z10 } from "zod";
@@ -3251,8 +3258,8 @@ var clinicAdminSchema = z12.object({
3251
3258
  clinicsManagedInfo: z12.array(clinicInfoSchema),
3252
3259
  contactInfo: contactPersonSchema,
3253
3260
  roleTitle: z12.string(),
3254
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3255
- updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3261
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3262
+ updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3256
3263
  isActive: z12.boolean()
3257
3264
  });
3258
3265
  var adminTokenSchema = z12.object({
@@ -3261,9 +3268,9 @@ var adminTokenSchema = z12.object({
3261
3268
  email: z12.string().email().optional().nullable(),
3262
3269
  status: z12.nativeEnum(AdminTokenStatus),
3263
3270
  usedByUserRef: z12.string().optional(),
3264
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3271
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3265
3272
  // Timestamp
3266
- expiresAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6))
3273
+ expiresAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7))
3267
3274
  // Timestamp
3268
3275
  });
3269
3276
  var createAdminTokenSchema = z12.object({
@@ -3283,9 +3290,9 @@ var clinicGroupSchema = z12.object({
3283
3290
  adminsInfo: z12.array(adminInfoSchema),
3284
3291
  adminTokens: z12.array(adminTokenSchema),
3285
3292
  ownerId: z12.string().nullable(),
3286
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3293
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3287
3294
  // Timestamp
3288
- updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3295
+ updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3289
3296
  // Timestamp
3290
3297
  isActive: z12.boolean(),
3291
3298
  logo: z12.string().optional().nullable(),
@@ -3325,9 +3332,9 @@ var clinicSchema = z12.object({
3325
3332
  // servicesInfo: z.array(serviceInfoSchema), // Deprecated, use proceduresInfo
3326
3333
  reviewInfo: clinicReviewInfoSchema,
3327
3334
  admins: z12.array(z12.string()),
3328
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3335
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3329
3336
  // Timestamp
3330
- updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3337
+ updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3331
3338
  // Timestamp
3332
3339
  isActive: z12.boolean(),
3333
3340
  isVerified: z12.boolean(),
@@ -3530,15 +3537,15 @@ async function createClinicAdmin(db, data, clinicGroupService) {
3530
3537
  contactInfo: validatedData.contactInfo,
3531
3538
  roleTitle: validatedData.roleTitle,
3532
3539
  isActive: validatedData.isActive,
3533
- createdAt: serverTimestamp8(),
3534
- updatedAt: serverTimestamp8()
3540
+ createdAt: serverTimestamp9(),
3541
+ updatedAt: serverTimestamp9()
3535
3542
  };
3536
3543
  console.log("[CLINIC_ADMIN] Validating complete admin object");
3537
3544
  try {
3538
3545
  clinicAdminSchema.parse({
3539
3546
  ...adminData,
3540
- createdAt: Timestamp7.now(),
3541
- updatedAt: Timestamp7.now()
3547
+ createdAt: Timestamp8.now(),
3548
+ updatedAt: Timestamp8.now()
3542
3549
  });
3543
3550
  console.log("[CLINIC_ADMIN] Admin object validation passed");
3544
3551
  } catch (schemaError) {
@@ -3634,7 +3641,7 @@ async function updateClinicAdmin(db, adminId, data) {
3634
3641
  }
3635
3642
  const updatedData = {
3636
3643
  ...data,
3637
- updatedAt: serverTimestamp8()
3644
+ updatedAt: serverTimestamp9()
3638
3645
  };
3639
3646
  await updateDoc7(doc7(db, CLINIC_ADMINS_COLLECTION, adminId), updatedData);
3640
3647
  const updatedAdmin = await getClinicAdmin(db, adminId);
@@ -3901,8 +3908,8 @@ import {
3901
3908
  updateDoc as updateDoc8,
3902
3909
  setDoc as setDoc7,
3903
3910
  deleteDoc as deleteDoc2,
3904
- Timestamp as Timestamp9,
3905
- serverTimestamp as serverTimestamp9,
3911
+ Timestamp as Timestamp10,
3912
+ serverTimestamp as serverTimestamp10,
3906
3913
  limit as limit4,
3907
3914
  startAfter as startAfter4,
3908
3915
  orderBy,
@@ -3912,7 +3919,7 @@ import {
3912
3919
 
3913
3920
  // src/validations/practitioner.schema.ts
3914
3921
  import { z as z13 } from "zod";
3915
- import { Timestamp as Timestamp8 } from "firebase/firestore";
3922
+ import { Timestamp as Timestamp9 } from "firebase/firestore";
3916
3923
 
3917
3924
  // src/backoffice/types/static/certification.types.ts
3918
3925
  var CertificationLevel = /* @__PURE__ */ ((CertificationLevel2) => {
@@ -3945,7 +3952,7 @@ var practitionerBasicInfoSchema = z13.object({
3945
3952
  title: z13.string().min(2).max(100),
3946
3953
  email: z13.string().email(),
3947
3954
  phoneNumber: z13.string().regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number"),
3948
- dateOfBirth: z13.instanceof(Timestamp8).or(z13.date()),
3955
+ dateOfBirth: z13.instanceof(Timestamp9).or(z13.date()),
3949
3956
  gender: z13.enum(["male", "female", "other"]),
3950
3957
  profileImageUrl: z13.string().url().optional(),
3951
3958
  bio: z13.string().max(1e3).optional(),
@@ -3956,8 +3963,8 @@ var practitionerCertificationSchema = z13.object({
3956
3963
  specialties: z13.array(z13.nativeEnum(CertificationSpecialty)),
3957
3964
  licenseNumber: z13.string().min(3).max(50),
3958
3965
  issuingAuthority: z13.string().min(2).max(100),
3959
- issueDate: z13.instanceof(Timestamp8).or(z13.date()),
3960
- expiryDate: z13.instanceof(Timestamp8).or(z13.date()).optional(),
3966
+ issueDate: z13.instanceof(Timestamp9).or(z13.date()),
3967
+ expiryDate: z13.instanceof(Timestamp9).or(z13.date()).optional(),
3961
3968
  verificationStatus: z13.enum(["pending", "verified", "rejected"])
3962
3969
  });
3963
3970
  var timeSlotSchema = z13.object({
@@ -3974,8 +3981,8 @@ var practitionerWorkingHoursSchema = z13.object({
3974
3981
  friday: timeSlotSchema,
3975
3982
  saturday: timeSlotSchema,
3976
3983
  sunday: timeSlotSchema,
3977
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
3978
- updatedAt: z13.instanceof(Timestamp8).or(z13.date())
3984
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
3985
+ updatedAt: z13.instanceof(Timestamp9).or(z13.date())
3979
3986
  });
3980
3987
  var practitionerClinicWorkingHoursSchema = z13.object({
3981
3988
  clinicId: z13.string().min(1),
@@ -3989,8 +3996,8 @@ var practitionerClinicWorkingHoursSchema = z13.object({
3989
3996
  sunday: timeSlotSchema
3990
3997
  }),
3991
3998
  isActive: z13.boolean(),
3992
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
3993
- updatedAt: z13.instanceof(Timestamp8).or(z13.date())
3999
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
4000
+ updatedAt: z13.instanceof(Timestamp9).or(z13.date())
3994
4001
  });
3995
4002
  var practitionerSchema = z13.object({
3996
4003
  id: z13.string().min(1),
@@ -4006,8 +4013,8 @@ var practitionerSchema = z13.object({
4006
4013
  isActive: z13.boolean(),
4007
4014
  isVerified: z13.boolean(),
4008
4015
  status: z13.nativeEnum(PractitionerStatus),
4009
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
4010
- updatedAt: z13.instanceof(Timestamp8).or(z13.date())
4016
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
4017
+ updatedAt: z13.instanceof(Timestamp9).or(z13.date())
4011
4018
  });
4012
4019
  var createPractitionerSchema = z13.object({
4013
4020
  userRef: z13.string().min(1),
@@ -4039,10 +4046,10 @@ var practitionerTokenSchema = z13.object({
4039
4046
  clinicId: z13.string().min(1),
4040
4047
  status: z13.nativeEnum(PractitionerTokenStatus),
4041
4048
  createdBy: z13.string().min(1),
4042
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
4043
- expiresAt: z13.instanceof(Timestamp8).or(z13.date()),
4049
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
4050
+ expiresAt: z13.instanceof(Timestamp9).or(z13.date()),
4044
4051
  usedBy: z13.string().optional(),
4045
- usedAt: z13.instanceof(Timestamp8).or(z13.date()).optional()
4052
+ usedAt: z13.instanceof(Timestamp9).or(z13.date()).optional()
4046
4053
  });
4047
4054
  var createPractitionerTokenSchema = z13.object({
4048
4055
  practitionerId: z13.string().min(1),
@@ -4115,13 +4122,13 @@ var PractitionerService = class extends BaseService {
4115
4122
  isActive: validData.isActive !== void 0 ? validData.isActive : true,
4116
4123
  isVerified: validData.isVerified !== void 0 ? validData.isVerified : false,
4117
4124
  status: validData.status || "active" /* ACTIVE */,
4118
- createdAt: serverTimestamp9(),
4119
- updatedAt: serverTimestamp9()
4125
+ createdAt: serverTimestamp10(),
4126
+ updatedAt: serverTimestamp10()
4120
4127
  };
4121
4128
  practitionerSchema.parse({
4122
4129
  ...practitioner,
4123
- createdAt: Timestamp9.now(),
4124
- updatedAt: Timestamp9.now()
4130
+ createdAt: Timestamp10.now(),
4131
+ updatedAt: Timestamp10.now()
4125
4132
  });
4126
4133
  const practitionerRef = doc8(
4127
4134
  this.db,
@@ -4215,14 +4222,14 @@ var PractitionerService = class extends BaseService {
4215
4222
  isActive: validatedData.isActive !== void 0 ? validatedData.isActive : false,
4216
4223
  isVerified: validatedData.isVerified !== void 0 ? validatedData.isVerified : false,
4217
4224
  status: "draft" /* DRAFT */,
4218
- createdAt: serverTimestamp9(),
4219
- updatedAt: serverTimestamp9()
4225
+ createdAt: serverTimestamp10(),
4226
+ updatedAt: serverTimestamp10()
4220
4227
  };
4221
4228
  practitionerSchema.parse({
4222
4229
  ...practitionerData,
4223
4230
  userRef: "temp-for-validation",
4224
- createdAt: Timestamp9.now(),
4225
- updatedAt: Timestamp9.now()
4231
+ createdAt: Timestamp10.now(),
4232
+ updatedAt: Timestamp10.now()
4226
4233
  });
4227
4234
  await setDoc7(
4228
4235
  doc8(this.db, PRACTITIONERS_COLLECTION, practitionerData.id),
@@ -4242,8 +4249,8 @@ var PractitionerService = class extends BaseService {
4242
4249
  clinicId,
4243
4250
  status: "active" /* ACTIVE */,
4244
4251
  createdBy,
4245
- createdAt: Timestamp9.now(),
4246
- expiresAt: Timestamp9.fromDate(expiration)
4252
+ createdAt: Timestamp10.now(),
4253
+ expiresAt: Timestamp10.fromDate(expiration)
4247
4254
  };
4248
4255
  practitionerTokenSchema.parse(token);
4249
4256
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
@@ -4295,8 +4302,8 @@ var PractitionerService = class extends BaseService {
4295
4302
  clinicId: validatedData.clinicId,
4296
4303
  status: "active" /* ACTIVE */,
4297
4304
  createdBy,
4298
- createdAt: Timestamp9.now(),
4299
- expiresAt: Timestamp9.fromDate(expiration)
4305
+ createdAt: Timestamp10.now(),
4306
+ expiresAt: Timestamp10.fromDate(expiration)
4300
4307
  };
4301
4308
  practitionerTokenSchema.parse(token);
4302
4309
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${validatedData.practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
@@ -4322,7 +4329,7 @@ var PractitionerService = class extends BaseService {
4322
4329
  const q = query6(
4323
4330
  tokensRef,
4324
4331
  where6("status", "==", "active" /* ACTIVE */),
4325
- where6("expiresAt", ">", Timestamp9.now())
4332
+ where6("expiresAt", ">", Timestamp10.now())
4326
4333
  );
4327
4334
  const querySnapshot = await getDocs6(q);
4328
4335
  return querySnapshot.docs.map((doc33) => doc33.data());
@@ -4345,7 +4352,7 @@ var PractitionerService = class extends BaseService {
4345
4352
  tokensRef,
4346
4353
  where6("token", "==", tokenString),
4347
4354
  where6("status", "==", "active" /* ACTIVE */),
4348
- where6("expiresAt", ">", Timestamp9.now())
4355
+ where6("expiresAt", ">", Timestamp10.now())
4349
4356
  );
4350
4357
  const tokenSnapshot = await getDocs6(q);
4351
4358
  if (!tokenSnapshot.empty) {
@@ -4368,7 +4375,7 @@ var PractitionerService = class extends BaseService {
4368
4375
  await updateDoc8(tokenRef, {
4369
4376
  status: "used" /* USED */,
4370
4377
  usedBy: userId,
4371
- usedAt: Timestamp9.now()
4378
+ usedAt: Timestamp10.now()
4372
4379
  });
4373
4380
  }
4374
4381
  /**
@@ -4452,7 +4459,7 @@ var PractitionerService = class extends BaseService {
4452
4459
  const currentPractitioner = practitionerDoc.data();
4453
4460
  const updateData = {
4454
4461
  ...validData,
4455
- updatedAt: serverTimestamp9()
4462
+ updatedAt: serverTimestamp10()
4456
4463
  };
4457
4464
  await updateDoc8(practitionerRef, updateData);
4458
4465
  const updatedPractitioner = await this.getPractitioner(practitionerId);
@@ -4494,7 +4501,7 @@ var PractitionerService = class extends BaseService {
4494
4501
  }
4495
4502
  await updateDoc8(practitionerRef, {
4496
4503
  clinics: arrayUnion5(clinicId),
4497
- updatedAt: serverTimestamp9()
4504
+ updatedAt: serverTimestamp10()
4498
4505
  });
4499
4506
  } catch (error) {
4500
4507
  console.error(
@@ -4520,7 +4527,7 @@ var PractitionerService = class extends BaseService {
4520
4527
  }
4521
4528
  await updateDoc8(practitionerRef, {
4522
4529
  clinics: arrayRemove4(clinicId),
4523
- updatedAt: serverTimestamp9()
4530
+ updatedAt: serverTimestamp10()
4524
4531
  });
4525
4532
  } catch (error) {
4526
4533
  console.error(
@@ -4803,9 +4810,9 @@ var UserService = class extends BaseService {
4803
4810
  email: firebaseUser.email,
4804
4811
  roles: roles.length > 0 ? roles : ["patient" /* PATIENT */],
4805
4812
  isAnonymous: firebaseUser.isAnonymous,
4806
- createdAt: serverTimestamp10(),
4807
- updatedAt: serverTimestamp10(),
4808
- lastLoginAt: serverTimestamp10()
4813
+ createdAt: serverTimestamp11(),
4814
+ updatedAt: serverTimestamp11(),
4815
+ lastLoginAt: serverTimestamp11()
4809
4816
  };
4810
4817
  await setDoc8(doc9(this.db, USERS_COLLECTION, userData.uid), userData);
4811
4818
  const profiles = await this.createProfilesForRoles(
@@ -4891,7 +4898,7 @@ var UserService = class extends BaseService {
4891
4898
  email: "",
4892
4899
  phoneNumber: "",
4893
4900
  title: "",
4894
- dateOfBirth: Timestamp10.now(),
4901
+ dateOfBirth: Timestamp11.now(),
4895
4902
  gender: "other",
4896
4903
  languages: ["Serbian"]
4897
4904
  },
@@ -4900,7 +4907,7 @@ var UserService = class extends BaseService {
4900
4907
  specialties: [],
4901
4908
  licenseNumber: "",
4902
4909
  issuingAuthority: "",
4903
- issueDate: Timestamp10.now(),
4910
+ issueDate: Timestamp11.now(),
4904
4911
  verificationStatus: "pending"
4905
4912
  },
4906
4913
  isActive: true,
@@ -4953,8 +4960,8 @@ var UserService = class extends BaseService {
4953
4960
  throw AUTH_ERRORS.USER_NOT_FOUND;
4954
4961
  }
4955
4962
  await updateDoc9(userRef, {
4956
- lastLoginAt: serverTimestamp10(),
4957
- updatedAt: serverTimestamp10()
4963
+ lastLoginAt: serverTimestamp11(),
4964
+ updatedAt: serverTimestamp11()
4958
4965
  });
4959
4966
  return this.getUserById(uid);
4960
4967
  }
@@ -4967,7 +4974,7 @@ var UserService = class extends BaseService {
4967
4974
  await updateDoc9(userRef, {
4968
4975
  email,
4969
4976
  isAnonymous: false,
4970
- updatedAt: serverTimestamp10()
4977
+ updatedAt: serverTimestamp11()
4971
4978
  });
4972
4979
  return this.getUserById(uid);
4973
4980
  }
@@ -4982,12 +4989,12 @@ var UserService = class extends BaseService {
4982
4989
  const updatedUser = {
4983
4990
  ...currentUser,
4984
4991
  ...updates,
4985
- updatedAt: serverTimestamp10()
4992
+ updatedAt: serverTimestamp11()
4986
4993
  };
4987
4994
  userSchema.parse(updatedUser);
4988
4995
  await updateDoc9(userRef, {
4989
4996
  ...updates,
4990
- updatedAt: serverTimestamp10()
4997
+ updatedAt: serverTimestamp11()
4991
4998
  });
4992
4999
  return this.getUserById(uid);
4993
5000
  } catch (error) {
@@ -5007,7 +5014,7 @@ var UserService = class extends BaseService {
5007
5014
  await updateDoc9(doc9(this.db, USERS_COLLECTION, uid), {
5008
5015
  roles: [...user.roles, role],
5009
5016
  ...profiles,
5010
- updatedAt: serverTimestamp10()
5017
+ updatedAt: serverTimestamp11()
5011
5018
  });
5012
5019
  }
5013
5020
  /**
@@ -5041,7 +5048,7 @@ var UserService = class extends BaseService {
5041
5048
  }
5042
5049
  await updateDoc9(doc9(this.db, USERS_COLLECTION, uid), {
5043
5050
  roles: user.roles.filter((r) => r !== role),
5044
- updatedAt: serverTimestamp10()
5051
+ updatedAt: serverTimestamp11()
5045
5052
  });
5046
5053
  }
5047
5054
  // Delete operations
@@ -5085,7 +5092,7 @@ import {
5085
5092
  where as where8,
5086
5093
  updateDoc as updateDoc10,
5087
5094
  setDoc as setDoc9,
5088
- Timestamp as Timestamp11
5095
+ Timestamp as Timestamp12
5089
5096
  } from "firebase/firestore";
5090
5097
  import { geohashForLocation as geohashForLocation2 } from "geofire-common";
5091
5098
  import { z as z16 } from "zod";
@@ -5209,7 +5216,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
5209
5216
  throw geohashError;
5210
5217
  }
5211
5218
  }
5212
- const now = Timestamp11.now();
5219
+ const now = Timestamp12.now();
5213
5220
  console.log("[CLINIC_GROUP] Preparing clinic group data object");
5214
5221
  const groupId = doc10(collection8(db, CLINIC_GROUPS_COLLECTION)).id;
5215
5222
  console.log("[CLINIC_GROUP] Logo value:", {
@@ -5348,7 +5355,7 @@ async function updateClinicGroup(db, groupId, data, app) {
5348
5355
  }
5349
5356
  updatedData = {
5350
5357
  ...updatedData,
5351
- updatedAt: Timestamp11.now()
5358
+ updatedAt: Timestamp12.now()
5352
5359
  };
5353
5360
  console.log("[CLINIC_GROUP] Updating clinic group in Firestore");
5354
5361
  await updateDoc10(doc10(db, CLINIC_GROUPS_COLLECTION, groupId), updatedData);
@@ -5432,10 +5439,10 @@ async function createAdminToken(db, groupId, creatorAdminId, app, data) {
5432
5439
  if (!group.admins.includes(creatorAdminId)) {
5433
5440
  throw new Error("Admin does not belong to this clinic group");
5434
5441
  }
5435
- const now = Timestamp11.now();
5442
+ const now = Timestamp12.now();
5436
5443
  const expiresInDays = (data == null ? void 0 : data.expiresInDays) || 7;
5437
5444
  const email = (data == null ? void 0 : data.email) || null;
5438
- const expiresAt = new Timestamp11(
5445
+ const expiresAt = new Timestamp12(
5439
5446
  now.seconds + expiresInDays * 24 * 60 * 60,
5440
5447
  now.nanoseconds
5441
5448
  );
@@ -5469,7 +5476,7 @@ async function verifyAndUseAdminToken(db, groupId, token, userRef, app) {
5469
5476
  if (adminToken.status !== "active" /* ACTIVE */) {
5470
5477
  throw new Error("Admin token is not active");
5471
5478
  }
5472
- const now = Timestamp11.now();
5479
+ const now = Timestamp12.now();
5473
5480
  if (adminToken.expiresAt.seconds < now.seconds) {
5474
5481
  const updatedTokens2 = group.adminTokens.map(
5475
5482
  (t) => t.id === adminToken.id ? { ...t, status: "expired" /* EXPIRED */ } : t
@@ -5704,8 +5711,8 @@ import {
5704
5711
  doc as doc12,
5705
5712
  getDoc as getDoc15,
5706
5713
  updateDoc as updateDoc12,
5707
- Timestamp as Timestamp13,
5708
- serverTimestamp as serverTimestamp12,
5714
+ Timestamp as Timestamp14,
5715
+ serverTimestamp as serverTimestamp13,
5709
5716
  writeBatch as writeBatch4,
5710
5717
  arrayUnion as arrayUnion6
5711
5718
  } from "firebase/firestore";
@@ -5724,7 +5731,7 @@ import {
5724
5731
  where as where9,
5725
5732
  updateDoc as updateDoc11,
5726
5733
  setDoc as setDoc10,
5727
- Timestamp as Timestamp12,
5734
+ Timestamp as Timestamp13,
5728
5735
  limit as limit5,
5729
5736
  startAfter as startAfter5
5730
5737
  } from "firebase/firestore";
@@ -5904,7 +5911,7 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
5904
5911
  }
5905
5912
  updatedData = {
5906
5913
  ...updatedData,
5907
- updatedAt: Timestamp12.now()
5914
+ updatedAt: Timestamp13.now()
5908
5915
  };
5909
5916
  console.log("[CLINIC] Updating clinic in Firestore");
5910
5917
  try {
@@ -6397,13 +6404,13 @@ var ClinicService = class extends BaseService {
6397
6404
  isActive: validatedData.isActive,
6398
6405
  isVerified: validatedData.isVerified,
6399
6406
  logo: validatedData.logo,
6400
- createdAt: serverTimestamp12(),
6401
- updatedAt: serverTimestamp12()
6407
+ createdAt: serverTimestamp13(),
6408
+ updatedAt: serverTimestamp13()
6402
6409
  };
6403
6410
  clinicSchema.parse({
6404
6411
  ...clinicData,
6405
- createdAt: Timestamp13.now(),
6406
- updatedAt: Timestamp13.now()
6412
+ createdAt: Timestamp14.now(),
6413
+ updatedAt: Timestamp14.now()
6407
6414
  });
6408
6415
  const batch = writeBatch4(this.db);
6409
6416
  const clinicRef = doc12(this.db, CLINICS_COLLECTION, clinicId);
@@ -6411,7 +6418,7 @@ var ClinicService = class extends BaseService {
6411
6418
  const adminRef = doc12(this.db, CLINIC_ADMINS_COLLECTION, creatorAdminId);
6412
6419
  batch.update(adminRef, {
6413
6420
  clinicsManaged: arrayUnion6(clinicId),
6414
- updatedAt: serverTimestamp12()
6421
+ updatedAt: serverTimestamp13()
6415
6422
  });
6416
6423
  await batch.commit();
6417
6424
  const savedClinic = await this.getClinic(clinicId);
@@ -6454,12 +6461,12 @@ var ClinicService = class extends BaseService {
6454
6461
  };
6455
6462
  clinicSchema.parse({
6456
6463
  ...finalStateForValidation,
6457
- updatedAt: Timestamp13.now()
6464
+ updatedAt: Timestamp14.now()
6458
6465
  // Use current time for validation
6459
6466
  });
6460
6467
  const updateDataForFirestore = {
6461
6468
  ...updatePayload,
6462
- updatedAt: serverTimestamp12()
6469
+ updatedAt: serverTimestamp13()
6463
6470
  };
6464
6471
  await updateDoc12(clinicRef, updateDataForFirestore);
6465
6472
  const updatedClinic = await this.getClinic(clinicId);
@@ -6482,7 +6489,7 @@ var ClinicService = class extends BaseService {
6482
6489
  const clinicRef = doc12(this.db, CLINICS_COLLECTION, clinicId);
6483
6490
  await updateDoc12(clinicRef, {
6484
6491
  isActive: false,
6485
- updatedAt: serverTimestamp12()
6492
+ updatedAt: serverTimestamp13()
6486
6493
  });
6487
6494
  }
6488
6495
  /**
@@ -7515,7 +7522,7 @@ import {
7515
7522
  updateDoc as updateDoc14,
7516
7523
  deleteDoc as deleteDoc7,
7517
7524
  orderBy as orderBy3,
7518
- Timestamp as Timestamp15,
7525
+ Timestamp as Timestamp16,
7519
7526
  addDoc as addDoc2,
7520
7527
  writeBatch as writeBatch5
7521
7528
  } from "firebase/firestore";
@@ -7558,7 +7565,7 @@ var NotificationService = class extends BaseService {
7558
7565
  */
7559
7566
  async createNotification(notification) {
7560
7567
  const notificationsRef = collection14(this.db, NOTIFICATIONS_COLLECTION);
7561
- const now = Timestamp15.now();
7568
+ const now = Timestamp16.now();
7562
7569
  const notificationData = {
7563
7570
  ...notification,
7564
7571
  createdAt: now,
@@ -7633,7 +7640,7 @@ var NotificationService = class extends BaseService {
7633
7640
  );
7634
7641
  await updateDoc14(notificationRef, {
7635
7642
  isRead: true,
7636
- updatedAt: Timestamp15.now()
7643
+ updatedAt: Timestamp16.now()
7637
7644
  });
7638
7645
  }
7639
7646
  /**
@@ -7650,7 +7657,7 @@ var NotificationService = class extends BaseService {
7650
7657
  );
7651
7658
  batch.update(notificationRef, {
7652
7659
  isRead: true,
7653
- updatedAt: Timestamp15.now()
7660
+ updatedAt: Timestamp16.now()
7654
7661
  });
7655
7662
  });
7656
7663
  await batch.commit();
@@ -7666,7 +7673,7 @@ var NotificationService = class extends BaseService {
7666
7673
  );
7667
7674
  await updateDoc14(notificationRef, {
7668
7675
  status,
7669
- updatedAt: Timestamp15.now()
7676
+ updatedAt: Timestamp16.now()
7670
7677
  });
7671
7678
  }
7672
7679
  /**
@@ -7724,7 +7731,7 @@ import {
7724
7731
  updateDoc as updateDoc15,
7725
7732
  setDoc as setDoc13,
7726
7733
  deleteDoc as deleteDoc8,
7727
- serverTimestamp as serverTimestamp14,
7734
+ serverTimestamp as serverTimestamp15,
7728
7735
  orderBy as orderBy4,
7729
7736
  limit as limit7,
7730
7737
  startAfter as startAfter7
@@ -7913,8 +7920,8 @@ var ProcedureService = class extends BaseService {
7913
7920
  const procedureRef = doc15(this.db, PROCEDURES_COLLECTION, procedureId);
7914
7921
  await setDoc13(procedureRef, {
7915
7922
  ...newProcedure,
7916
- createdAt: serverTimestamp14(),
7917
- updatedAt: serverTimestamp14()
7923
+ createdAt: serverTimestamp15(),
7924
+ updatedAt: serverTimestamp15()
7918
7925
  });
7919
7926
  const savedDoc = await getDoc18(procedureRef);
7920
7927
  return savedDoc.data();
@@ -8080,7 +8087,7 @@ var ProcedureService = class extends BaseService {
8080
8087
  }
8081
8088
  await updateDoc15(procedureRef, {
8082
8089
  ...updatedProcedureData,
8083
- updatedAt: serverTimestamp14()
8090
+ updatedAt: serverTimestamp15()
8084
8091
  });
8085
8092
  const updatedSnapshot = await getDoc18(procedureRef);
8086
8093
  return updatedSnapshot.data();
@@ -8098,7 +8105,7 @@ var ProcedureService = class extends BaseService {
8098
8105
  }
8099
8106
  await updateDoc15(procedureRef, {
8100
8107
  isActive: false,
8101
- updatedAt: serverTimestamp14()
8108
+ updatedAt: serverTimestamp15()
8102
8109
  });
8103
8110
  }
8104
8111
  /**
@@ -8984,7 +8991,7 @@ var FilledDocumentService = class extends BaseService {
8984
8991
  };
8985
8992
 
8986
8993
  // src/services/calendar/calendar-refactored.service.ts
8987
- import { Timestamp as Timestamp26, serverTimestamp as serverTimestamp21 } from "firebase/firestore";
8994
+ import { Timestamp as Timestamp27, serverTimestamp as serverTimestamp22 } from "firebase/firestore";
8988
8995
 
8989
8996
  // src/types/calendar/synced-calendar.types.ts
8990
8997
  var SyncedCalendarProvider = /* @__PURE__ */ ((SyncedCalendarProvider3) => {
@@ -9009,11 +9016,11 @@ import {
9009
9016
 
9010
9017
  // src/validations/calendar.schema.ts
9011
9018
  import { z as z22 } from "zod";
9012
- import { Timestamp as Timestamp19 } from "firebase/firestore";
9019
+ import { Timestamp as Timestamp20 } from "firebase/firestore";
9013
9020
 
9014
9021
  // src/validations/profile-info.schema.ts
9015
9022
  import { z as z21 } from "zod";
9016
- import { Timestamp as Timestamp18 } from "firebase/firestore";
9023
+ import { Timestamp as Timestamp19 } from "firebase/firestore";
9017
9024
  var clinicInfoSchema2 = z21.object({
9018
9025
  id: z21.string(),
9019
9026
  featuredPhoto: z21.string(),
@@ -9035,19 +9042,19 @@ var patientProfileInfoSchema = z21.object({
9035
9042
  fullName: z21.string(),
9036
9043
  email: z21.string().email(),
9037
9044
  phone: z21.string().nullable(),
9038
- dateOfBirth: z21.instanceof(Timestamp18),
9045
+ dateOfBirth: z21.instanceof(Timestamp19),
9039
9046
  gender: z21.nativeEnum(Gender)
9040
9047
  });
9041
9048
 
9042
9049
  // src/validations/calendar.schema.ts
9043
9050
  var MIN_APPOINTMENT_DURATION = 15;
9044
9051
  var calendarEventTimeSchema = z22.object({
9045
- start: z22.instanceof(Date).or(z22.instanceof(Timestamp19)),
9046
- end: z22.instanceof(Date).or(z22.instanceof(Timestamp19))
9052
+ start: z22.instanceof(Date).or(z22.instanceof(Timestamp20)),
9053
+ end: z22.instanceof(Date).or(z22.instanceof(Timestamp20))
9047
9054
  }).refine(
9048
9055
  (data) => {
9049
- const startDate = data.start instanceof Timestamp19 ? data.start.toDate() : data.start;
9050
- const endDate = data.end instanceof Timestamp19 ? data.end.toDate() : data.end;
9056
+ const startDate = data.start instanceof Timestamp20 ? data.start.toDate() : data.start;
9057
+ const endDate = data.end instanceof Timestamp20 ? data.end.toDate() : data.end;
9051
9058
  return startDate < endDate;
9052
9059
  },
9053
9060
  {
@@ -9056,7 +9063,7 @@ var calendarEventTimeSchema = z22.object({
9056
9063
  }
9057
9064
  ).refine(
9058
9065
  (data) => {
9059
- const startDate = data.start instanceof Timestamp19 ? data.start.toDate() : data.start;
9066
+ const startDate = data.start instanceof Timestamp20 ? data.start.toDate() : data.start;
9060
9067
  return startDate > /* @__PURE__ */ new Date();
9061
9068
  },
9062
9069
  {
@@ -9075,7 +9082,7 @@ var timeSlotSchema2 = z22.object({
9075
9082
  var syncedCalendarEventSchema = z22.object({
9076
9083
  eventId: z22.string(),
9077
9084
  syncedCalendarProvider: z22.nativeEnum(SyncedCalendarProvider),
9078
- syncedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp19))
9085
+ syncedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp20))
9079
9086
  });
9080
9087
  var procedureInfoSchema = z22.object({
9081
9088
  name: z22.string(),
@@ -9177,8 +9184,8 @@ var calendarEventSchema = z22.object({
9177
9184
  status: z22.nativeEnum(CalendarEventStatus),
9178
9185
  syncStatus: z22.nativeEnum(CalendarSyncStatus),
9179
9186
  eventType: z22.nativeEnum(CalendarEventType),
9180
- createdAt: z22.instanceof(Date).or(z22.instanceof(Timestamp19)),
9181
- updatedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp19))
9187
+ createdAt: z22.instanceof(Date).or(z22.instanceof(Timestamp20)),
9188
+ updatedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp20))
9182
9189
  });
9183
9190
 
9184
9191
  // src/services/calendar/utils/clinic.utils.ts
@@ -9193,8 +9200,8 @@ import {
9193
9200
  query as query18,
9194
9201
  where as where18,
9195
9202
  orderBy as orderBy7,
9196
- Timestamp as Timestamp20,
9197
- serverTimestamp as serverTimestamp16
9203
+ Timestamp as Timestamp21,
9204
+ serverTimestamp as serverTimestamp17
9198
9205
  } from "firebase/firestore";
9199
9206
 
9200
9207
  // src/services/calendar/utils/docs.utils.ts
@@ -9243,21 +9250,21 @@ async function createClinicCalendarEventUtil(db, clinicId, eventData, generateId
9243
9250
  const newEvent = {
9244
9251
  id: eventId,
9245
9252
  ...eventData,
9246
- createdAt: serverTimestamp16(),
9247
- updatedAt: serverTimestamp16()
9253
+ createdAt: serverTimestamp17(),
9254
+ updatedAt: serverTimestamp17()
9248
9255
  };
9249
9256
  await setDoc16(eventRef, newEvent);
9250
9257
  return {
9251
9258
  ...newEvent,
9252
- createdAt: Timestamp20.now(),
9253
- updatedAt: Timestamp20.now()
9259
+ createdAt: Timestamp21.now(),
9260
+ updatedAt: Timestamp21.now()
9254
9261
  };
9255
9262
  }
9256
9263
  async function updateClinicCalendarEventUtil(db, clinicId, eventId, updateData) {
9257
9264
  const eventRef = getClinicCalendarEventDocRef(db, clinicId, eventId);
9258
9265
  const updates = {
9259
9266
  ...updateData,
9260
- updatedAt: serverTimestamp16()
9267
+ updatedAt: serverTimestamp17()
9261
9268
  };
9262
9269
  await updateDoc18(eventRef, updates);
9263
9270
  const updatedDoc = await getDoc21(eventRef);
@@ -9297,8 +9304,8 @@ import {
9297
9304
  query as query19,
9298
9305
  where as where19,
9299
9306
  orderBy as orderBy8,
9300
- Timestamp as Timestamp21,
9301
- serverTimestamp as serverTimestamp17
9307
+ Timestamp as Timestamp22,
9308
+ serverTimestamp as serverTimestamp18
9302
9309
  } from "firebase/firestore";
9303
9310
  async function createPatientCalendarEventUtil(db, patientId, eventData, generateId2) {
9304
9311
  const eventId = generateId2();
@@ -9306,21 +9313,21 @@ async function createPatientCalendarEventUtil(db, patientId, eventData, generate
9306
9313
  const newEvent = {
9307
9314
  id: eventId,
9308
9315
  ...eventData,
9309
- createdAt: serverTimestamp17(),
9310
- updatedAt: serverTimestamp17()
9316
+ createdAt: serverTimestamp18(),
9317
+ updatedAt: serverTimestamp18()
9311
9318
  };
9312
9319
  await setDoc17(eventRef, newEvent);
9313
9320
  return {
9314
9321
  ...newEvent,
9315
- createdAt: Timestamp21.now(),
9316
- updatedAt: Timestamp21.now()
9322
+ createdAt: Timestamp22.now(),
9323
+ updatedAt: Timestamp22.now()
9317
9324
  };
9318
9325
  }
9319
9326
  async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData) {
9320
9327
  const eventRef = getPatientCalendarEventDocRef(db, patientId, eventId);
9321
9328
  const updates = {
9322
9329
  ...updateData,
9323
- updatedAt: serverTimestamp17()
9330
+ updatedAt: serverTimestamp18()
9324
9331
  };
9325
9332
  await updateDoc19(eventRef, updates);
9326
9333
  const updatedDoc = await getDoc22(eventRef);
@@ -9341,8 +9348,8 @@ import {
9341
9348
  query as query20,
9342
9349
  where as where20,
9343
9350
  orderBy as orderBy9,
9344
- Timestamp as Timestamp22,
9345
- serverTimestamp as serverTimestamp18
9351
+ Timestamp as Timestamp23,
9352
+ serverTimestamp as serverTimestamp19
9346
9353
  } from "firebase/firestore";
9347
9354
  async function createPractitionerCalendarEventUtil(db, practitionerId, eventData, generateId2) {
9348
9355
  const eventId = generateId2();
@@ -9354,14 +9361,14 @@ async function createPractitionerCalendarEventUtil(db, practitionerId, eventData
9354
9361
  const newEvent = {
9355
9362
  id: eventId,
9356
9363
  ...eventData,
9357
- createdAt: serverTimestamp18(),
9358
- updatedAt: serverTimestamp18()
9364
+ createdAt: serverTimestamp19(),
9365
+ updatedAt: serverTimestamp19()
9359
9366
  };
9360
9367
  await setDoc18(eventRef, newEvent);
9361
9368
  return {
9362
9369
  ...newEvent,
9363
- createdAt: Timestamp22.now(),
9364
- updatedAt: Timestamp22.now()
9370
+ createdAt: Timestamp23.now(),
9371
+ updatedAt: Timestamp23.now()
9365
9372
  };
9366
9373
  }
9367
9374
  async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId, updateData) {
@@ -9372,7 +9379,7 @@ async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId,
9372
9379
  );
9373
9380
  const updates = {
9374
9381
  ...updateData,
9375
- updatedAt: serverTimestamp18()
9382
+ updatedAt: serverTimestamp19()
9376
9383
  };
9377
9384
  await updateDoc20(eventRef, updates);
9378
9385
  const updatedDoc = await getDoc23(eventRef);
@@ -9444,8 +9451,8 @@ import {
9444
9451
  query as query21,
9445
9452
  where as where21,
9446
9453
  orderBy as orderBy10,
9447
- Timestamp as Timestamp23,
9448
- serverTimestamp as serverTimestamp19
9454
+ Timestamp as Timestamp24,
9455
+ serverTimestamp as serverTimestamp20
9449
9456
  } from "firebase/firestore";
9450
9457
  async function searchCalendarEventsUtil(db, params) {
9451
9458
  const { searchLocation, entityId, ...filters } = params;
@@ -9549,8 +9556,8 @@ import {
9549
9556
  deleteDoc as deleteDoc14,
9550
9557
  query as query22,
9551
9558
  orderBy as orderBy11,
9552
- Timestamp as Timestamp24,
9553
- serverTimestamp as serverTimestamp20
9559
+ Timestamp as Timestamp25,
9560
+ serverTimestamp as serverTimestamp21
9554
9561
  } from "firebase/firestore";
9555
9562
  async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendarData, generateId2) {
9556
9563
  const calendarId = generateId2();
@@ -9562,14 +9569,14 @@ async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendar
9562
9569
  const newCalendar = {
9563
9570
  id: calendarId,
9564
9571
  ...calendarData,
9565
- createdAt: serverTimestamp20(),
9566
- updatedAt: serverTimestamp20()
9572
+ createdAt: serverTimestamp21(),
9573
+ updatedAt: serverTimestamp21()
9567
9574
  };
9568
9575
  await setDoc20(calendarRef, newCalendar);
9569
9576
  return {
9570
9577
  ...newCalendar,
9571
- createdAt: Timestamp24.now(),
9572
- updatedAt: Timestamp24.now()
9578
+ createdAt: Timestamp25.now(),
9579
+ updatedAt: Timestamp25.now()
9573
9580
  };
9574
9581
  }
9575
9582
  async function createPatientSyncedCalendarUtil(db, patientId, calendarData, generateId2) {
@@ -9578,14 +9585,14 @@ async function createPatientSyncedCalendarUtil(db, patientId, calendarData, gene
9578
9585
  const newCalendar = {
9579
9586
  id: calendarId,
9580
9587
  ...calendarData,
9581
- createdAt: serverTimestamp20(),
9582
- updatedAt: serverTimestamp20()
9588
+ createdAt: serverTimestamp21(),
9589
+ updatedAt: serverTimestamp21()
9583
9590
  };
9584
9591
  await setDoc20(calendarRef, newCalendar);
9585
9592
  return {
9586
9593
  ...newCalendar,
9587
- createdAt: Timestamp24.now(),
9588
- updatedAt: Timestamp24.now()
9594
+ createdAt: Timestamp25.now(),
9595
+ updatedAt: Timestamp25.now()
9589
9596
  };
9590
9597
  }
9591
9598
  async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, generateId2) {
@@ -9594,14 +9601,14 @@ async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, genera
9594
9601
  const newCalendar = {
9595
9602
  id: calendarId,
9596
9603
  ...calendarData,
9597
- createdAt: serverTimestamp20(),
9598
- updatedAt: serverTimestamp20()
9604
+ createdAt: serverTimestamp21(),
9605
+ updatedAt: serverTimestamp21()
9599
9606
  };
9600
9607
  await setDoc20(calendarRef, newCalendar);
9601
9608
  return {
9602
9609
  ...newCalendar,
9603
- createdAt: Timestamp24.now(),
9604
- updatedAt: Timestamp24.now()
9610
+ createdAt: Timestamp25.now(),
9611
+ updatedAt: Timestamp25.now()
9605
9612
  };
9606
9613
  }
9607
9614
  async function getPractitionerSyncedCalendarUtil(db, practitionerId, calendarId) {
@@ -9667,7 +9674,7 @@ async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendar
9667
9674
  );
9668
9675
  const updates = {
9669
9676
  ...updateData,
9670
- updatedAt: serverTimestamp20()
9677
+ updatedAt: serverTimestamp21()
9671
9678
  };
9672
9679
  await updateDoc22(calendarRef, updates);
9673
9680
  const updatedDoc = await getDoc25(calendarRef);
@@ -9680,7 +9687,7 @@ async function updatePatientSyncedCalendarUtil(db, patientId, calendarId, update
9680
9687
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
9681
9688
  const updates = {
9682
9689
  ...updateData,
9683
- updatedAt: serverTimestamp20()
9690
+ updatedAt: serverTimestamp21()
9684
9691
  };
9685
9692
  await updateDoc22(calendarRef, updates);
9686
9693
  const updatedDoc = await getDoc25(calendarRef);
@@ -9693,7 +9700,7 @@ async function updateClinicSyncedCalendarUtil(db, clinicId, calendarId, updateDa
9693
9700
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
9694
9701
  const updates = {
9695
9702
  ...updateData,
9696
- updatedAt: serverTimestamp20()
9703
+ updatedAt: serverTimestamp21()
9697
9704
  };
9698
9705
  await updateDoc22(calendarRef, updates);
9699
9706
  const updatedDoc = await getDoc25(calendarRef);
@@ -9720,7 +9727,7 @@ async function deleteClinicSyncedCalendarUtil(db, clinicId, calendarId) {
9720
9727
  }
9721
9728
  async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarId) {
9722
9729
  const updateData = {
9723
- lastSyncedAt: Timestamp24.now()
9730
+ lastSyncedAt: Timestamp25.now()
9724
9731
  };
9725
9732
  switch (entityType) {
9726
9733
  case "practitioner":
@@ -9750,7 +9757,7 @@ async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarI
9750
9757
  }
9751
9758
 
9752
9759
  // src/services/calendar/utils/google-calendar.utils.ts
9753
- import { Timestamp as Timestamp25 } from "firebase/firestore";
9760
+ import { Timestamp as Timestamp26 } from "firebase/firestore";
9754
9761
  var GOOGLE_CALENDAR_API_URL = "https://www.googleapis.com/calendar/v3";
9755
9762
  var GOOGLE_OAUTH_URL = "https://oauth2.googleapis.com/token";
9756
9763
  var CLIENT_ID = "your-client-id";
@@ -9870,7 +9877,7 @@ async function ensureValidToken(db, entityType, entityId, syncedCalendar) {
9870
9877
  tokenExpiry.setSeconds(tokenExpiry.getSeconds() + expiresIn);
9871
9878
  const updateData = {
9872
9879
  accessToken,
9873
- tokenExpiry: Timestamp25.fromDate(tokenExpiry)
9880
+ tokenExpiry: Timestamp26.fromDate(tokenExpiry)
9874
9881
  };
9875
9882
  switch (entityType) {
9876
9883
  case "practitioner":
@@ -10045,8 +10052,8 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
10045
10052
  eventName: googleEvent.summary || "External Event",
10046
10053
  eventLocation: googleEvent.location,
10047
10054
  eventTime: {
10048
- start: Timestamp25.fromDate(start),
10049
- end: Timestamp25.fromDate(end)
10055
+ start: Timestamp26.fromDate(start),
10056
+ end: Timestamp26.fromDate(end)
10050
10057
  },
10051
10058
  description: googleEvent.description || "",
10052
10059
  // External events are always set as CONFIRMED - status updates will happen externally
@@ -10060,7 +10067,7 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
10060
10067
  {
10061
10068
  eventId: googleEvent.id,
10062
10069
  syncedCalendarProvider: "google" /* GOOGLE */,
10063
- syncedAt: Timestamp25.now()
10070
+ syncedAt: Timestamp26.now()
10064
10071
  }
10065
10072
  ]
10066
10073
  };
@@ -10838,7 +10845,7 @@ var CalendarServiceV2 = class extends BaseService {
10838
10845
  return 0;
10839
10846
  }
10840
10847
  let importedEventsCount = 0;
10841
- const currentTime = Timestamp26.now();
10848
+ const currentTime = Timestamp27.now();
10842
10849
  for (const calendar of activeCalendars) {
10843
10850
  try {
10844
10851
  let externalEvents = [];
@@ -10915,14 +10922,14 @@ var CalendarServiceV2 = class extends BaseService {
10915
10922
  const newEvent = {
10916
10923
  id: eventId,
10917
10924
  ...eventData,
10918
- createdAt: serverTimestamp21(),
10919
- updatedAt: serverTimestamp21()
10925
+ createdAt: serverTimestamp22(),
10926
+ updatedAt: serverTimestamp22()
10920
10927
  };
10921
10928
  await setDoc21(eventRef, newEvent);
10922
10929
  return {
10923
10930
  ...newEvent,
10924
- createdAt: Timestamp26.now(),
10925
- updatedAt: Timestamp26.now()
10931
+ createdAt: Timestamp27.now(),
10932
+ updatedAt: Timestamp27.now()
10926
10933
  };
10927
10934
  } catch (error) {
10928
10935
  console.error(
@@ -11008,8 +11015,8 @@ var CalendarServiceV2 = class extends BaseService {
11008
11015
  const q = query23(
11009
11016
  eventsRef,
11010
11017
  where23("syncStatus", "==", "external" /* EXTERNAL */),
11011
- where23("eventTime.start", ">=", Timestamp26.fromDate(startDate)),
11012
- where23("eventTime.start", "<=", Timestamp26.fromDate(endDate))
11018
+ where23("eventTime.start", ">=", Timestamp27.fromDate(startDate)),
11019
+ where23("eventTime.start", "<=", Timestamp27.fromDate(endDate))
11013
11020
  );
11014
11021
  const eventsSnapshot = await getDocs23(q);
11015
11022
  const events = eventsSnapshot.docs.map((doc33) => ({
@@ -11128,11 +11135,11 @@ var CalendarServiceV2 = class extends BaseService {
11128
11135
  await updateDoc23(eventRef, {
11129
11136
  eventName: externalEvent.summary || "External Event",
11130
11137
  eventTime: {
11131
- start: Timestamp26.fromDate(startTime),
11132
- end: Timestamp26.fromDate(endTime)
11138
+ start: Timestamp27.fromDate(startTime),
11139
+ end: Timestamp27.fromDate(endTime)
11133
11140
  },
11134
11141
  description: externalEvent.description || "",
11135
- updatedAt: serverTimestamp21()
11142
+ updatedAt: serverTimestamp22()
11136
11143
  });
11137
11144
  console.log(`Updated local event ${eventId} from external event`);
11138
11145
  } catch (error) {
@@ -11159,7 +11166,7 @@ var CalendarServiceV2 = class extends BaseService {
11159
11166
  );
11160
11167
  await updateDoc23(eventRef, {
11161
11168
  status,
11162
- updatedAt: serverTimestamp21()
11169
+ updatedAt: serverTimestamp22()
11163
11170
  });
11164
11171
  console.log(`Updated event ${eventId} status to ${status}`);
11165
11172
  } catch (error) {
@@ -11207,8 +11214,8 @@ var CalendarServiceV2 = class extends BaseService {
11207
11214
  */
11208
11215
  async getPractitionerUpcomingAppointments(doctorId, startDate, endDate, status = "confirmed" /* CONFIRMED */) {
11209
11216
  const dateRange = {
11210
- start: Timestamp26.fromDate(startDate),
11211
- end: Timestamp26.fromDate(endDate)
11217
+ start: Timestamp27.fromDate(startDate),
11218
+ end: Timestamp27.fromDate(endDate)
11212
11219
  };
11213
11220
  const searchParams = {
11214
11221
  searchLocation: "practitioner" /* PRACTITIONER */,
@@ -11230,8 +11237,8 @@ var CalendarServiceV2 = class extends BaseService {
11230
11237
  */
11231
11238
  async getPatientAppointments(patientId, startDate, endDate, status) {
11232
11239
  const dateRange = {
11233
- start: Timestamp26.fromDate(startDate),
11234
- end: Timestamp26.fromDate(endDate)
11240
+ start: Timestamp27.fromDate(startDate),
11241
+ end: Timestamp27.fromDate(endDate)
11235
11242
  };
11236
11243
  const searchParams = {
11237
11244
  searchLocation: "patient" /* PATIENT */,
@@ -11256,8 +11263,8 @@ var CalendarServiceV2 = class extends BaseService {
11256
11263
  */
11257
11264
  async getClinicAppointments(clinicId, startDate, endDate, doctorId, status) {
11258
11265
  const dateRange = {
11259
- start: Timestamp26.fromDate(startDate),
11260
- end: Timestamp26.fromDate(endDate)
11266
+ start: Timestamp27.fromDate(startDate),
11267
+ end: Timestamp27.fromDate(endDate)
11261
11268
  };
11262
11269
  const searchParams = {
11263
11270
  searchLocation: "clinic" /* CLINIC */,
@@ -11511,7 +11518,7 @@ var CalendarServiceV2 = class extends BaseService {
11511
11518
  const newSyncEvent = {
11512
11519
  eventId: result.eventIds[0],
11513
11520
  syncedCalendarProvider: calendar.provider,
11514
- syncedAt: Timestamp26.now()
11521
+ syncedAt: Timestamp27.now()
11515
11522
  };
11516
11523
  await this.updateEventWithSyncId(
11517
11524
  entityType === "doctor" ? appointment.practitionerProfileId : appointment.patientProfileId,
@@ -11550,7 +11557,7 @@ var CalendarServiceV2 = class extends BaseService {
11550
11557
  }
11551
11558
  await updateDoc23(eventRef, {
11552
11559
  syncedCalendarEventId: syncIds,
11553
- updatedAt: serverTimestamp21()
11560
+ updatedAt: serverTimestamp22()
11554
11561
  });
11555
11562
  console.log(
11556
11563
  `Updated event ${eventId} with sync ID ${syncEvent.eventId}`
@@ -11640,8 +11647,8 @@ var CalendarServiceV2 = class extends BaseService {
11640
11647
  const q = query23(
11641
11648
  appointmentsRef,
11642
11649
  where23("practitionerProfileId", "==", doctorId),
11643
- where23("eventTime.start", ">=", Timestamp26.fromDate(startOfDay)),
11644
- where23("eventTime.start", "<=", Timestamp26.fromDate(endOfDay)),
11650
+ where23("eventTime.start", ">=", Timestamp27.fromDate(startOfDay)),
11651
+ where23("eventTime.start", "<=", Timestamp27.fromDate(endOfDay)),
11645
11652
  where23("status", "in", [
11646
11653
  "confirmed" /* CONFIRMED */,
11647
11654
  "pending" /* PENDING */
@@ -11742,7 +11749,7 @@ var CalendarServiceV2 = class extends BaseService {
11742
11749
  fullName: `${sensitiveData.firstName} ${sensitiveData.lastName}`,
11743
11750
  email: sensitiveData.email || "",
11744
11751
  phone: sensitiveData.phoneNumber || null,
11745
- dateOfBirth: sensitiveData.dateOfBirth || Timestamp26.now(),
11752
+ dateOfBirth: sensitiveData.dateOfBirth || Timestamp27.now(),
11746
11753
  gender: sensitiveData.gender || "other" /* OTHER */
11747
11754
  };
11748
11755
  } else if (patientDoc.exists()) {
@@ -11751,7 +11758,7 @@ var CalendarServiceV2 = class extends BaseService {
11751
11758
  fullName: patientDoc.data().displayName,
11752
11759
  email: ((_a = patientDoc.data().contactInfo) == null ? void 0 : _a.email) || "",
11753
11760
  phone: patientDoc.data().phoneNumber || null,
11754
- dateOfBirth: patientDoc.data().dateOfBirth || Timestamp26.now(),
11761
+ dateOfBirth: patientDoc.data().dateOfBirth || Timestamp27.now(),
11755
11762
  gender: patientDoc.data().gender || "other" /* OTHER */
11756
11763
  };
11757
11764
  }
@@ -11783,7 +11790,7 @@ import {
11783
11790
  updateDoc as updateDoc24,
11784
11791
  setDoc as setDoc22,
11785
11792
  deleteDoc as deleteDoc15,
11786
- serverTimestamp as serverTimestamp22,
11793
+ serverTimestamp as serverTimestamp23,
11787
11794
  writeBatch as writeBatch7
11788
11795
  } from "firebase/firestore";
11789
11796
 
@@ -11873,8 +11880,8 @@ var ReviewService = class extends BaseService {
11873
11880
  const docRef = doc25(this.db, REVIEWS_COLLECTION, reviewId);
11874
11881
  await setDoc22(docRef, {
11875
11882
  ...review,
11876
- createdAt: serverTimestamp22(),
11877
- updatedAt: serverTimestamp22()
11883
+ createdAt: serverTimestamp23(),
11884
+ updatedAt: serverTimestamp23()
11878
11885
  });
11879
11886
  const updatePromises = [];
11880
11887
  if (data.clinicReview) {
@@ -12050,7 +12057,7 @@ var ReviewService = class extends BaseService {
12050
12057
  if (currentReviewInfo.totalReviews === 0 && !newReview) {
12051
12058
  await updateDoc24(doc25(this.db, CLINICS_COLLECTION, clinicId), {
12052
12059
  reviewInfo: currentReviewInfo,
12053
- updatedAt: serverTimestamp22()
12060
+ updatedAt: serverTimestamp23()
12054
12061
  });
12055
12062
  return currentReviewInfo;
12056
12063
  }
@@ -12113,7 +12120,7 @@ var ReviewService = class extends BaseService {
12113
12120
  }
12114
12121
  await updateDoc24(doc25(this.db, CLINICS_COLLECTION, clinicId), {
12115
12122
  reviewInfo: updatedReviewInfo,
12116
- updatedAt: serverTimestamp22()
12123
+ updatedAt: serverTimestamp23()
12117
12124
  });
12118
12125
  return updatedReviewInfo;
12119
12126
  }
@@ -12145,7 +12152,7 @@ var ReviewService = class extends BaseService {
12145
12152
  if (currentReviewInfo.totalReviews === 0 && !newReview) {
12146
12153
  await updateDoc24(doc25(this.db, PRACTITIONERS_COLLECTION, practitionerId), {
12147
12154
  reviewInfo: currentReviewInfo,
12148
- updatedAt: serverTimestamp22()
12155
+ updatedAt: serverTimestamp23()
12149
12156
  });
12150
12157
  return currentReviewInfo;
12151
12158
  }
@@ -12208,7 +12215,7 @@ var ReviewService = class extends BaseService {
12208
12215
  }
12209
12216
  await updateDoc24(doc25(this.db, PRACTITIONERS_COLLECTION, practitionerId), {
12210
12217
  reviewInfo: updatedReviewInfo,
12211
- updatedAt: serverTimestamp22()
12218
+ updatedAt: serverTimestamp23()
12212
12219
  });
12213
12220
  await this.updateDoctorInfoInProcedures(
12214
12221
  practitionerId,
@@ -12244,7 +12251,7 @@ var ReviewService = class extends BaseService {
12244
12251
  if (currentReviewInfo.totalReviews === 0 && !newReview) {
12245
12252
  await updateDoc24(doc25(this.db, PROCEDURES_COLLECTION, procedureId), {
12246
12253
  reviewInfo: currentReviewInfo,
12247
- updatedAt: serverTimestamp22()
12254
+ updatedAt: serverTimestamp23()
12248
12255
  });
12249
12256
  return currentReviewInfo;
12250
12257
  }
@@ -12307,7 +12314,7 @@ var ReviewService = class extends BaseService {
12307
12314
  }
12308
12315
  await updateDoc24(doc25(this.db, PROCEDURES_COLLECTION, procedureId), {
12309
12316
  reviewInfo: updatedReviewInfo,
12310
- updatedAt: serverTimestamp22()
12317
+ updatedAt: serverTimestamp23()
12311
12318
  });
12312
12319
  return updatedReviewInfo;
12313
12320
  }
@@ -12330,7 +12337,7 @@ var ReviewService = class extends BaseService {
12330
12337
  const procedureRef = doc25(this.db, PROCEDURES_COLLECTION, docSnapshot.id);
12331
12338
  batch.update(procedureRef, {
12332
12339
  "doctorInfo.rating": rating,
12333
- updatedAt: serverTimestamp22()
12340
+ updatedAt: serverTimestamp23()
12334
12341
  });
12335
12342
  });
12336
12343
  await batch.commit();
@@ -12346,7 +12353,7 @@ var ReviewService = class extends BaseService {
12346
12353
  }
12347
12354
  const batch = writeBatch7(this.db);
12348
12355
  batch.update(doc25(this.db, REVIEWS_COLLECTION, reviewId), {
12349
- updatedAt: serverTimestamp22()
12356
+ updatedAt: serverTimestamp23()
12350
12357
  });
12351
12358
  if (review.clinicReview) {
12352
12359
  review.clinicReview.isVerified = true;
@@ -12395,8 +12402,8 @@ var ReviewService = class extends BaseService {
12395
12402
 
12396
12403
  // src/services/appointment/appointment.service.ts
12397
12404
  import {
12398
- Timestamp as Timestamp29,
12399
- serverTimestamp as serverTimestamp24,
12405
+ Timestamp as Timestamp30,
12406
+ serverTimestamp as serverTimestamp25,
12400
12407
  arrayUnion as arrayUnion8,
12401
12408
  arrayRemove as arrayRemove7,
12402
12409
  where as where26,
@@ -12419,8 +12426,8 @@ import {
12419
12426
  where as where25,
12420
12427
  setDoc as setDoc23,
12421
12428
  updateDoc as updateDoc25,
12422
- serverTimestamp as serverTimestamp23,
12423
- Timestamp as Timestamp28,
12429
+ serverTimestamp as serverTimestamp24,
12430
+ Timestamp as Timestamp29,
12424
12431
  orderBy as orderBy12,
12425
12432
  limit as limit10,
12426
12433
  startAfter as startAfter10
@@ -12482,7 +12489,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
12482
12489
  ...data,
12483
12490
  completedPreRequirements,
12484
12491
  completedPostRequirements,
12485
- updatedAt: serverTimestamp23()
12492
+ updatedAt: serverTimestamp24()
12486
12493
  };
12487
12494
  Object.keys(updateData).forEach((key) => {
12488
12495
  if (updateData[key] === void 0) {
@@ -12491,7 +12498,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
12491
12498
  });
12492
12499
  if (data.status && data.status !== currentAppointment.status) {
12493
12500
  if (data.status === "confirmed" /* CONFIRMED */ && !updateData.confirmationTime) {
12494
- updateData.confirmationTime = Timestamp28.now();
12501
+ updateData.confirmationTime = Timestamp29.now();
12495
12502
  }
12496
12503
  if (currentAppointment.calendarEventId) {
12497
12504
  await updateCalendarEventStatus(
@@ -12542,7 +12549,7 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
12542
12549
  }
12543
12550
  await updateDoc25(calendarEventRef, {
12544
12551
  status: calendarStatus,
12545
- updatedAt: serverTimestamp23()
12552
+ updatedAt: serverTimestamp24()
12546
12553
  });
12547
12554
  } catch (error) {
12548
12555
  console.error(`Error updating calendar event ${calendarEventId}:`, error);
@@ -12579,13 +12586,13 @@ async function searchAppointmentsUtil(db, params) {
12579
12586
  where25(
12580
12587
  "appointmentStartTime",
12581
12588
  ">=",
12582
- Timestamp28.fromDate(params.startDate)
12589
+ Timestamp29.fromDate(params.startDate)
12583
12590
  )
12584
12591
  );
12585
12592
  }
12586
12593
  if (params.endDate) {
12587
12594
  constraints.push(
12588
- where25("appointmentStartTime", "<=", Timestamp28.fromDate(params.endDate))
12595
+ where25("appointmentStartTime", "<=", Timestamp29.fromDate(params.endDate))
12589
12596
  );
12590
12597
  }
12591
12598
  if (params.status) {
@@ -12974,7 +12981,7 @@ var AppointmentService = class extends BaseService {
12974
12981
  );
12975
12982
  const updateData = {
12976
12983
  status: newStatus,
12977
- updatedAt: serverTimestamp24()
12984
+ updatedAt: serverTimestamp25()
12978
12985
  };
12979
12986
  if (newStatus === "canceled_clinic" /* CANCELED_CLINIC */ || newStatus === "canceled_patient" /* CANCELED_PATIENT */ || newStatus === "canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */) {
12980
12987
  if (!(details == null ? void 0 : details.cancellationReason)) {
@@ -12985,13 +12992,13 @@ var AppointmentService = class extends BaseService {
12985
12992
  }
12986
12993
  updateData.cancellationReason = details.cancellationReason;
12987
12994
  updateData.canceledBy = details.canceledBy;
12988
- updateData.cancellationTime = Timestamp29.now();
12995
+ updateData.cancellationTime = Timestamp30.now();
12989
12996
  }
12990
12997
  if (newStatus === "confirmed" /* CONFIRMED */) {
12991
- updateData.confirmationTime = Timestamp29.now();
12998
+ updateData.confirmationTime = Timestamp30.now();
12992
12999
  }
12993
13000
  if (newStatus === "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */) {
12994
- updateData.rescheduleTime = Timestamp29.now();
13001
+ updateData.rescheduleTime = Timestamp30.now();
12995
13002
  }
12996
13003
  return this.updateAppointment(appointmentId, updateData);
12997
13004
  }
@@ -13062,9 +13069,9 @@ var AppointmentService = class extends BaseService {
13062
13069
  status: "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */,
13063
13070
  appointmentStartTime: newStartTime,
13064
13071
  appointmentEndTime: newEndTime,
13065
- rescheduleTime: Timestamp29.now(),
13072
+ rescheduleTime: Timestamp30.now(),
13066
13073
  confirmationTime: null,
13067
- updatedAt: serverTimestamp24()
13074
+ updatedAt: serverTimestamp25()
13068
13075
  };
13069
13076
  return this.updateAppointment(appointmentId, updateData);
13070
13077
  }
@@ -13159,9 +13166,9 @@ var AppointmentService = class extends BaseService {
13159
13166
  }
13160
13167
  const updateData = {
13161
13168
  status: "in_progress" /* IN_PROGRESS */,
13162
- procedureActualStartTime: Timestamp29.now(),
13169
+ procedureActualStartTime: Timestamp30.now(),
13163
13170
  // Set actual start time
13164
- updatedAt: serverTimestamp24()
13171
+ updatedAt: serverTimestamp25()
13165
13172
  };
13166
13173
  return this.updateAppointment(appointmentId, updateData);
13167
13174
  }
@@ -13179,7 +13186,7 @@ var AppointmentService = class extends BaseService {
13179
13186
  if (!appointment)
13180
13187
  throw new Error(`Appointment ${appointmentId} not found.`);
13181
13188
  let calculatedDurationMinutes = actualDurationMinutesInput;
13182
- const procedureCompletionTime = Timestamp29.now();
13189
+ const procedureCompletionTime = Timestamp30.now();
13183
13190
  if (calculatedDurationMinutes === void 0 && appointment.procedureActualStartTime) {
13184
13191
  const startTimeMillis = appointment.procedureActualStartTime.toMillis();
13185
13192
  const endTimeMillis = procedureCompletionTime.toMillis();
@@ -13202,7 +13209,7 @@ var AppointmentService = class extends BaseService {
13202
13209
  },
13203
13210
  // Optionally update appointmentEndTime to the actual completion time
13204
13211
  // appointmentEndTime: procedureCompletionTime,
13205
- updatedAt: serverTimestamp24()
13212
+ updatedAt: serverTimestamp25()
13206
13213
  };
13207
13214
  return this.updateAppointment(appointmentId, updateData);
13208
13215
  }
@@ -13216,7 +13223,7 @@ var AppointmentService = class extends BaseService {
13216
13223
  const appointment = await this.getAppointmentById(appointmentId);
13217
13224
  if (!appointment)
13218
13225
  throw new Error(`Appointment ${appointmentId} not found.`);
13219
- if (Timestamp29.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
13226
+ if (Timestamp30.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
13220
13227
  throw new Error("Cannot mark no-show before appointment start time.");
13221
13228
  }
13222
13229
  return this.updateAppointmentStatus(
@@ -13240,12 +13247,12 @@ var AppointmentService = class extends BaseService {
13240
13247
  const newMediaItem = {
13241
13248
  ...mediaItemData,
13242
13249
  id: this.generateId(),
13243
- uploadedAt: Timestamp29.now(),
13250
+ uploadedAt: Timestamp30.now(),
13244
13251
  uploadedBy: currentUser.uid
13245
13252
  };
13246
13253
  const updateData = {
13247
13254
  media: arrayUnion8(newMediaItem),
13248
- updatedAt: serverTimestamp24()
13255
+ updatedAt: serverTimestamp25()
13249
13256
  };
13250
13257
  return this.updateAppointment(appointmentId, updateData);
13251
13258
  }
@@ -13266,7 +13273,7 @@ var AppointmentService = class extends BaseService {
13266
13273
  }
13267
13274
  const updateData = {
13268
13275
  media: arrayRemove7(mediaToRemove),
13269
- updatedAt: serverTimestamp24()
13276
+ updatedAt: serverTimestamp25()
13270
13277
  };
13271
13278
  return this.updateAppointment(appointmentId, updateData);
13272
13279
  }
@@ -13280,11 +13287,11 @@ var AppointmentService = class extends BaseService {
13280
13287
  const newReviewInfo = {
13281
13288
  ...reviewData,
13282
13289
  reviewId: this.generateId(),
13283
- reviewedAt: Timestamp29.now()
13290
+ reviewedAt: Timestamp30.now()
13284
13291
  };
13285
13292
  const updateData = {
13286
13293
  reviewInfo: newReviewInfo,
13287
- updatedAt: serverTimestamp24()
13294
+ updatedAt: serverTimestamp25()
13288
13295
  };
13289
13296
  return this.updateAppointment(appointmentId, updateData);
13290
13297
  }
@@ -13298,7 +13305,7 @@ var AppointmentService = class extends BaseService {
13298
13305
  const updateData = {
13299
13306
  paymentStatus,
13300
13307
  paymentTransactionId: paymentTransactionId || null,
13301
- updatedAt: serverTimestamp24()
13308
+ updatedAt: serverTimestamp25()
13302
13309
  };
13303
13310
  return this.updateAppointment(appointmentId, updateData);
13304
13311
  }
@@ -13346,7 +13353,7 @@ var AppointmentService = class extends BaseService {
13346
13353
  where26(
13347
13354
  "appointmentStartTime",
13348
13355
  ">=",
13349
- Timestamp29.fromDate(effectiveStartDate)
13356
+ Timestamp30.fromDate(effectiveStartDate)
13350
13357
  )
13351
13358
  );
13352
13359
  if (options == null ? void 0 : options.endDate) {
@@ -13354,7 +13361,7 @@ var AppointmentService = class extends BaseService {
13354
13361
  where26(
13355
13362
  "appointmentStartTime",
13356
13363
  "<=",
13357
- Timestamp29.fromDate(options.endDate)
13364
+ Timestamp30.fromDate(options.endDate)
13358
13365
  )
13359
13366
  );
13360
13367
  }
@@ -13420,7 +13427,7 @@ var AppointmentService = class extends BaseService {
13420
13427
  where26(
13421
13428
  "appointmentStartTime",
13422
13429
  ">=",
13423
- Timestamp29.fromDate(options.startDate)
13430
+ Timestamp30.fromDate(options.startDate)
13424
13431
  )
13425
13432
  );
13426
13433
  }
@@ -13428,7 +13435,7 @@ var AppointmentService = class extends BaseService {
13428
13435
  where26(
13429
13436
  "appointmentStartTime",
13430
13437
  "<=",
13431
- Timestamp29.fromDate(effectiveEndDate)
13438
+ Timestamp30.fromDate(effectiveEndDate)
13432
13439
  )
13433
13440
  );
13434
13441
  constraints.push(orderBy13("appointmentStartTime", "desc"));
@@ -13469,7 +13476,7 @@ import {
13469
13476
  where as where27,
13470
13477
  doc as doc27,
13471
13478
  updateDoc as updateDoc26,
13472
- Timestamp as Timestamp30,
13479
+ Timestamp as Timestamp31,
13473
13480
  orderBy as orderBy14,
13474
13481
  limit as limit12,
13475
13482
  startAfter as startAfter12,
@@ -13628,7 +13635,7 @@ var PatientRequirementsService = class extends BaseService {
13628
13635
  `Instruction ${instructionId} is in status ${instructionToUpdate.status} and cannot be marked as completed.`
13629
13636
  );
13630
13637
  }
13631
- const now = Timestamp30.now();
13638
+ const now = Timestamp31.now();
13632
13639
  const updatedInstructions = [...instance.instructions];
13633
13640
  updatedInstructions[instructionIndex] = {
13634
13641
  ...instructionToUpdate,