@blackcode_sa/metaestetics-api 1.7.4 → 1.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -530,7 +530,8 @@ import {
530
530
  import {
531
531
  collection as collection13,
532
532
  query as query13,
533
- getDocs as getDocs13
533
+ getDocs as getDocs13,
534
+ Timestamp as Timestamp15
534
535
  } from "firebase/firestore";
535
536
 
536
537
  // src/types/calendar/index.ts
@@ -580,6 +581,7 @@ import { z as z19 } from "zod";
580
581
 
581
582
  // src/validations/schemas.ts
582
583
  import { z as z3 } from "zod";
584
+ import { serverTimestamp } from "firebase/firestore";
583
585
  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
586
  var passwordSchema = z3.string().min(8, "Password must be at least 8 characters").max(100, "Password must be less than 100 characters").regex(
585
587
  /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d\w\W]{8,}$/,
@@ -588,11 +590,23 @@ var passwordSchema = z3.string().min(8, "Password must be at least 8 characters"
588
590
  var userRoleSchema = z3.nativeEnum(UserRole);
589
591
  var userRolesSchema = z3.array(userRoleSchema).min(1, "User must have at least one role").max(3, "User cannot have more than 3 roles");
590
592
  var timestampSchema = z3.custom((data) => {
591
- if (data && typeof data === "object" && "isEqual" in data) {
593
+ if (data == null) {
594
+ return false;
595
+ }
596
+ if (typeof data === "object" && "isEqual" in data) {
597
+ return true;
598
+ }
599
+ if (typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data) {
600
+ return true;
601
+ }
602
+ if (data === serverTimestamp) {
603
+ return true;
604
+ }
605
+ if (typeof data === "function") {
592
606
  return true;
593
607
  }
594
- return data && typeof data === "object" && "toDate" in data && "seconds" in data && "nanoseconds" in data;
595
- }, "Must be a Timestamp object or serverTimestamp");
608
+ return false;
609
+ }, "Must be a Timestamp object, FieldValue or serverTimestamp function");
596
610
  var clinicAdminOptionsSchema = z3.object({
597
611
  isGroupOwner: z3.boolean(),
598
612
  groupToken: z3.string().optional(),
@@ -885,9 +899,9 @@ import {
885
899
  where as where7,
886
900
  updateDoc as updateDoc9,
887
901
  deleteDoc as deleteDoc3,
888
- Timestamp as Timestamp10,
902
+ Timestamp as Timestamp11,
889
903
  setDoc as setDoc8,
890
- serverTimestamp as serverTimestamp10
904
+ serverTimestamp as serverTimestamp11
891
905
  } from "firebase/firestore";
892
906
 
893
907
  // src/errors/user.errors.ts
@@ -999,9 +1013,9 @@ import {
999
1013
  updateDoc as updateDoc3,
1000
1014
  arrayUnion as arrayUnion2,
1001
1015
  arrayRemove as arrayRemove2,
1002
- serverTimestamp as serverTimestamp4,
1016
+ serverTimestamp as serverTimestamp5,
1003
1017
  increment,
1004
- Timestamp as Timestamp4,
1018
+ Timestamp as Timestamp5,
1005
1019
  collection as collection3,
1006
1020
  query as query3,
1007
1021
  where as where3,
@@ -1041,7 +1055,7 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
1041
1055
 
1042
1056
  // src/validations/patient.schema.ts
1043
1057
  import { z as z6 } from "zod";
1044
- import { Timestamp as Timestamp2 } from "firebase/firestore";
1058
+ import { Timestamp as Timestamp3 } from "firebase/firestore";
1045
1059
 
1046
1060
  // src/validations/patient/medical-info.schema.ts
1047
1061
  import { z as z5 } from "zod";
@@ -1134,18 +1148,18 @@ var Contraindication = /* @__PURE__ */ ((Contraindication2) => {
1134
1148
 
1135
1149
  // src/validations/common.schema.ts
1136
1150
  import { z as z4 } from "zod";
1137
- import { Timestamp } from "firebase/firestore";
1151
+ import { Timestamp as Timestamp2 } from "firebase/firestore";
1138
1152
  var timestampSchema2 = z4.union([
1139
1153
  z4.object({
1140
1154
  seconds: z4.number(),
1141
1155
  nanoseconds: z4.number()
1142
1156
  }),
1143
- z4.instanceof(Timestamp)
1157
+ z4.instanceof(Timestamp2)
1144
1158
  ]).transform((data) => {
1145
- if (data instanceof Timestamp) {
1159
+ if (data instanceof Timestamp2) {
1146
1160
  return data;
1147
1161
  }
1148
- return new Timestamp(data.seconds, data.nanoseconds);
1162
+ return new Timestamp2(data.seconds, data.nanoseconds);
1149
1163
  });
1150
1164
 
1151
1165
  // src/validations/patient/medical-info.schema.ts
@@ -1261,8 +1275,8 @@ var patientLocationInfoSchema = z6.object({
1261
1275
  patientId: z6.string(),
1262
1276
  userRef: z6.string(),
1263
1277
  locationData: locationDataSchema,
1264
- createdAt: z6.instanceof(Timestamp2),
1265
- updatedAt: z6.instanceof(Timestamp2)
1278
+ createdAt: z6.instanceof(Timestamp3),
1279
+ updatedAt: z6.instanceof(Timestamp3)
1266
1280
  });
1267
1281
  var createPatientLocationInfoSchema = z6.object({
1268
1282
  patientId: z6.string(),
@@ -1275,26 +1289,26 @@ var patientSensitiveInfoSchema = z6.object({
1275
1289
  photoUrl: z6.string().optional(),
1276
1290
  firstName: z6.string().min(2),
1277
1291
  lastName: z6.string().min(2),
1278
- dateOfBirth: z6.instanceof(Timestamp2).nullable(),
1292
+ dateOfBirth: z6.instanceof(Timestamp3).nullable(),
1279
1293
  gender: z6.nativeEnum(Gender),
1280
1294
  email: z6.string().email().optional(),
1281
1295
  phoneNumber: z6.string().optional(),
1282
1296
  alternativePhoneNumber: z6.string().optional(),
1283
1297
  addressData: addressDataSchema.optional(),
1284
1298
  emergencyContacts: z6.array(emergencyContactSchema).optional(),
1285
- createdAt: z6.instanceof(Timestamp2),
1286
- updatedAt: z6.instanceof(Timestamp2)
1299
+ createdAt: z6.instanceof(Timestamp3),
1300
+ updatedAt: z6.instanceof(Timestamp3)
1287
1301
  });
1288
1302
  var patientDoctorSchema = z6.object({
1289
1303
  userRef: z6.string(),
1290
- assignedAt: z6.instanceof(Timestamp2),
1304
+ assignedAt: z6.instanceof(Timestamp3),
1291
1305
  assignedBy: z6.string().optional(),
1292
1306
  isActive: z6.boolean(),
1293
1307
  notes: z6.string().optional()
1294
1308
  });
1295
1309
  var patientClinicSchema = z6.object({
1296
1310
  clinicId: z6.string(),
1297
- assignedAt: z6.instanceof(Timestamp2),
1311
+ assignedAt: z6.instanceof(Timestamp3),
1298
1312
  assignedBy: z6.string().optional(),
1299
1313
  isActive: z6.boolean(),
1300
1314
  notes: z6.string().optional()
@@ -1312,8 +1326,8 @@ var patientProfileSchema = z6.object({
1312
1326
  clinics: z6.array(patientClinicSchema),
1313
1327
  doctorIds: z6.array(z6.string()),
1314
1328
  clinicIds: z6.array(z6.string()),
1315
- createdAt: z6.instanceof(Timestamp2),
1316
- updatedAt: z6.instanceof(Timestamp2)
1329
+ createdAt: z6.instanceof(Timestamp3),
1330
+ updatedAt: z6.instanceof(Timestamp3)
1317
1331
  });
1318
1332
  var createPatientProfileSchema = z6.object({
1319
1333
  userRef: z6.string(),
@@ -1334,7 +1348,7 @@ var createPatientSensitiveInfoSchema = z6.object({
1334
1348
  photoUrl: z6.string().optional(),
1335
1349
  firstName: z6.string().min(2),
1336
1350
  lastName: z6.string().min(2),
1337
- dateOfBirth: z6.instanceof(Timestamp2).nullable(),
1351
+ dateOfBirth: z6.instanceof(Timestamp3).nullable(),
1338
1352
  gender: z6.nativeEnum(Gender),
1339
1353
  email: z6.string().email().optional(),
1340
1354
  phoneNumber: z6.string().optional(),
@@ -1385,7 +1399,7 @@ import {
1385
1399
  getDoc,
1386
1400
  updateDoc,
1387
1401
  setDoc,
1388
- serverTimestamp
1402
+ serverTimestamp as serverTimestamp2
1389
1403
  } from "firebase/firestore";
1390
1404
  import { z as z7 } from "zod";
1391
1405
  var createSensitiveInfoUtil = async (db, data, requesterUserId) => {
@@ -1402,8 +1416,8 @@ var createSensitiveInfoUtil = async (db, data, requesterUserId) => {
1402
1416
  }
1403
1417
  const sensitiveInfoData = {
1404
1418
  ...validatedData,
1405
- createdAt: serverTimestamp(),
1406
- updatedAt: serverTimestamp()
1419
+ createdAt: serverTimestamp2(),
1420
+ updatedAt: serverTimestamp2()
1407
1421
  };
1408
1422
  await setDoc(getSensitiveInfoDocRef(db, data.patientId), sensitiveInfoData);
1409
1423
  const createdDoc = await getDoc(getSensitiveInfoDocRef(db, data.patientId));
@@ -1427,7 +1441,7 @@ var updateSensitiveInfoUtil = async (db, patientId, data, requesterUserId) => {
1427
1441
  await initSensitiveInfoDocIfNotExists(db, patientId, requesterUserId);
1428
1442
  const updateData = {
1429
1443
  ...data,
1430
- updatedAt: serverTimestamp()
1444
+ updatedAt: serverTimestamp2()
1431
1445
  };
1432
1446
  await updateDoc(getSensitiveInfoDocRef(db, patientId), updateData);
1433
1447
  const updatedDoc = await getDoc(getSensitiveInfoDocRef(db, patientId));
@@ -1537,9 +1551,9 @@ import {
1537
1551
  getDoc as getDoc4,
1538
1552
  updateDoc as updateDoc2,
1539
1553
  setDoc as setDoc3,
1540
- serverTimestamp as serverTimestamp3,
1554
+ serverTimestamp as serverTimestamp4,
1541
1555
  arrayUnion,
1542
- Timestamp as Timestamp3
1556
+ Timestamp as Timestamp4
1543
1557
  } from "firebase/firestore";
1544
1558
 
1545
1559
  // src/services/patient/utils/practitioner.utils.ts
@@ -1710,7 +1724,7 @@ var ensureMedicalInfoExists = async (db, patientId, userRef) => {
1710
1724
  const defaultData = {
1711
1725
  ...DEFAULT_MEDICAL_INFO,
1712
1726
  patientId,
1713
- lastUpdated: serverTimestamp3(),
1727
+ lastUpdated: serverTimestamp4(),
1714
1728
  updatedBy: userRef
1715
1729
  };
1716
1730
  console.log(
@@ -1774,7 +1788,7 @@ var createMedicalInfoUtil = async (db, patientId, data, userRef, userRoles) => {
1774
1788
  await setDoc3(getMedicalInfoDocRef(db, patientId), {
1775
1789
  ...validatedData,
1776
1790
  patientId,
1777
- lastUpdated: Timestamp3.now(),
1791
+ lastUpdated: Timestamp4.now(),
1778
1792
  updatedBy: userRef
1779
1793
  });
1780
1794
  };
@@ -1792,7 +1806,7 @@ var updateVitalStatsUtil = async (db, patientId, data, userRef) => {
1792
1806
  const validatedData = updateVitalStatsSchema.parse(data);
1793
1807
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1794
1808
  vitalStats: validatedData,
1795
- lastUpdated: serverTimestamp3(),
1809
+ lastUpdated: serverTimestamp4(),
1796
1810
  updatedBy: userRef
1797
1811
  });
1798
1812
  };
@@ -1801,7 +1815,7 @@ var addAllergyUtil = async (db, patientId, data, userRef) => {
1801
1815
  const validatedData = addAllergySchema.parse(data);
1802
1816
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1803
1817
  allergies: arrayUnion(validatedData),
1804
- lastUpdated: serverTimestamp3(),
1818
+ lastUpdated: serverTimestamp4(),
1805
1819
  updatedBy: userRef
1806
1820
  });
1807
1821
  };
@@ -1821,7 +1835,7 @@ var updateAllergyUtil = async (db, patientId, data, userRef) => {
1821
1835
  };
1822
1836
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1823
1837
  allergies: updatedAllergies,
1824
- lastUpdated: serverTimestamp3(),
1838
+ lastUpdated: serverTimestamp4(),
1825
1839
  updatedBy: userRef
1826
1840
  });
1827
1841
  };
@@ -1837,7 +1851,7 @@ var removeAllergyUtil = async (db, patientId, allergyIndex, userRef) => {
1837
1851
  );
1838
1852
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1839
1853
  allergies: updatedAllergies,
1840
- lastUpdated: serverTimestamp3(),
1854
+ lastUpdated: serverTimestamp4(),
1841
1855
  updatedBy: userRef
1842
1856
  });
1843
1857
  };
@@ -1846,7 +1860,7 @@ var addBlockingConditionUtil = async (db, patientId, data, userRef) => {
1846
1860
  const validatedData = addBlockingConditionSchema.parse(data);
1847
1861
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1848
1862
  blockingConditions: arrayUnion(validatedData),
1849
- lastUpdated: serverTimestamp3(),
1863
+ lastUpdated: serverTimestamp4(),
1850
1864
  updatedBy: userRef
1851
1865
  });
1852
1866
  };
@@ -1866,7 +1880,7 @@ var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
1866
1880
  };
1867
1881
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1868
1882
  blockingConditions: updatedConditions,
1869
- lastUpdated: serverTimestamp3(),
1883
+ lastUpdated: serverTimestamp4(),
1870
1884
  updatedBy: userRef
1871
1885
  });
1872
1886
  };
@@ -1882,7 +1896,7 @@ var removeBlockingConditionUtil = async (db, patientId, conditionIndex, userRef)
1882
1896
  );
1883
1897
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1884
1898
  blockingConditions: updatedConditions,
1885
- lastUpdated: serverTimestamp3(),
1899
+ lastUpdated: serverTimestamp4(),
1886
1900
  updatedBy: userRef
1887
1901
  });
1888
1902
  };
@@ -1891,7 +1905,7 @@ var addContraindicationUtil = async (db, patientId, data, userRef) => {
1891
1905
  const validatedData = addContraindicationSchema.parse(data);
1892
1906
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1893
1907
  contraindications: arrayUnion(validatedData),
1894
- lastUpdated: serverTimestamp3(),
1908
+ lastUpdated: serverTimestamp4(),
1895
1909
  updatedBy: userRef
1896
1910
  });
1897
1911
  };
@@ -1911,7 +1925,7 @@ var updateContraindicationUtil = async (db, patientId, data, userRef) => {
1911
1925
  };
1912
1926
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1913
1927
  contraindications: updatedContraindications,
1914
- lastUpdated: serverTimestamp3(),
1928
+ lastUpdated: serverTimestamp4(),
1915
1929
  updatedBy: userRef
1916
1930
  });
1917
1931
  };
@@ -1927,7 +1941,7 @@ var removeContraindicationUtil = async (db, patientId, contraindicationIndex, us
1927
1941
  );
1928
1942
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1929
1943
  contraindications: updatedContraindications,
1930
- lastUpdated: serverTimestamp3(),
1944
+ lastUpdated: serverTimestamp4(),
1931
1945
  updatedBy: userRef
1932
1946
  });
1933
1947
  };
@@ -1936,7 +1950,7 @@ var addMedicationUtil = async (db, patientId, data, userRef) => {
1936
1950
  const validatedData = addMedicationSchema.parse(data);
1937
1951
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1938
1952
  currentMedications: arrayUnion(validatedData),
1939
- lastUpdated: serverTimestamp3(),
1953
+ lastUpdated: serverTimestamp4(),
1940
1954
  updatedBy: userRef
1941
1955
  });
1942
1956
  };
@@ -1956,7 +1970,7 @@ var updateMedicationUtil = async (db, patientId, data, userRef) => {
1956
1970
  };
1957
1971
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1958
1972
  currentMedications: updatedMedications,
1959
- lastUpdated: serverTimestamp3(),
1973
+ lastUpdated: serverTimestamp4(),
1960
1974
  updatedBy: userRef
1961
1975
  });
1962
1976
  };
@@ -1972,7 +1986,7 @@ var removeMedicationUtil = async (db, patientId, medicationIndex, userRef) => {
1972
1986
  );
1973
1987
  await updateDoc2(getMedicalInfoDocRef(db, patientId), {
1974
1988
  currentMedications: updatedMedications,
1975
- lastUpdated: serverTimestamp3(),
1989
+ lastUpdated: serverTimestamp4(),
1976
1990
  updatedBy: userRef
1977
1991
  });
1978
1992
  };
@@ -2001,13 +2015,13 @@ var createPatientProfileUtil = async (db, data, generateId2) => {
2001
2015
  clinics: validatedData.clinics || [],
2002
2016
  doctorIds: ((_a = validatedData.doctors) == null ? void 0 : _a.map((d) => d.userRef)) || [],
2003
2017
  clinicIds: ((_b = validatedData.clinics) == null ? void 0 : _b.map((c) => c.clinicId)) || [],
2004
- createdAt: serverTimestamp4(),
2005
- updatedAt: serverTimestamp4()
2018
+ createdAt: serverTimestamp5(),
2019
+ updatedAt: serverTimestamp5()
2006
2020
  };
2007
2021
  patientProfileSchema.parse({
2008
2022
  ...patientData,
2009
- createdAt: Timestamp4.now(),
2010
- updatedAt: Timestamp4.now()
2023
+ createdAt: Timestamp5.now(),
2024
+ updatedAt: Timestamp5.now()
2011
2025
  });
2012
2026
  await setDoc4(getPatientDocRef(db, patientId), patientData);
2013
2027
  console.log(`[createPatientProfileUtil] Creating sensitive info document`);
@@ -2075,26 +2089,26 @@ var getPatientProfileByUserRefUtil = async (db, userRef) => {
2075
2089
  var addExpoTokenUtil = async (db, patientId, token) => {
2076
2090
  await updateDoc3(getPatientDocRef(db, patientId), {
2077
2091
  expoTokens: arrayUnion2(token),
2078
- updatedAt: serverTimestamp4()
2092
+ updatedAt: serverTimestamp5()
2079
2093
  });
2080
2094
  };
2081
2095
  var removeExpoTokenUtil = async (db, patientId, token) => {
2082
2096
  await updateDoc3(getPatientDocRef(db, patientId), {
2083
2097
  expoTokens: arrayRemove2(token),
2084
- updatedAt: serverTimestamp4()
2098
+ updatedAt: serverTimestamp5()
2085
2099
  });
2086
2100
  };
2087
2101
  var addPointsUtil = async (db, patientId, points) => {
2088
2102
  await updateDoc3(getPatientDocRef(db, patientId), {
2089
2103
  "gamification.points": increment(points),
2090
- updatedAt: serverTimestamp4()
2104
+ updatedAt: serverTimestamp5()
2091
2105
  });
2092
2106
  };
2093
2107
  var updatePatientProfileUtil = async (db, patientId, data) => {
2094
2108
  try {
2095
2109
  const updateData = {
2096
2110
  ...data,
2097
- updatedAt: serverTimestamp4()
2111
+ updatedAt: serverTimestamp5()
2098
2112
  };
2099
2113
  await updateDoc3(getPatientDocRef(db, patientId), updateData);
2100
2114
  const updatedDoc = await getDoc5(getPatientDocRef(db, patientId));
@@ -2141,7 +2155,7 @@ var updateProfilePhotoUtil = async (storage, db, patientId, file) => {
2141
2155
  const newPhotoUrl = await uploadProfilePhotoUtil(storage, patientId, file);
2142
2156
  await updateDoc3(getPatientDocRef(db, patientId), {
2143
2157
  profilePhoto: newPhotoUrl,
2144
- updatedAt: serverTimestamp4()
2158
+ updatedAt: serverTimestamp5()
2145
2159
  });
2146
2160
  return newPhotoUrl;
2147
2161
  };
@@ -2159,7 +2173,7 @@ var deleteProfilePhotoUtil = async (storage, db, patientId) => {
2159
2173
  }
2160
2174
  await updateDoc3(getPatientDocRef(db, patientId), {
2161
2175
  profilePhoto: null,
2162
- updatedAt: serverTimestamp4()
2176
+ updatedAt: serverTimestamp5()
2163
2177
  });
2164
2178
  };
2165
2179
  var testCreateSubDocuments = async (db, patientId, userRef) => {
@@ -2176,12 +2190,12 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
2176
2190
  photoUrl: "",
2177
2191
  firstName: "Name",
2178
2192
  lastName: "Surname",
2179
- dateOfBirth: Timestamp4.now(),
2193
+ dateOfBirth: Timestamp5.now(),
2180
2194
  gender: "prefer_not_to_say" /* PREFER_NOT_TO_SAY */,
2181
2195
  email: "test@example.com",
2182
2196
  phoneNumber: "",
2183
- createdAt: Timestamp4.now(),
2184
- updatedAt: Timestamp4.now()
2197
+ createdAt: Timestamp5.now(),
2198
+ updatedAt: Timestamp5.now()
2185
2199
  };
2186
2200
  await setDoc4(sensitiveInfoRef, defaultSensitiveInfo);
2187
2201
  console.log(`[testCreateSubDocuments] Sensitive info document created directly`);
@@ -2191,7 +2205,7 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
2191
2205
  const defaultMedicalInfo = {
2192
2206
  ...DEFAULT_MEDICAL_INFO,
2193
2207
  patientId,
2194
- lastUpdated: Timestamp4.now(),
2208
+ lastUpdated: Timestamp5.now(),
2195
2209
  updatedBy: userRef
2196
2210
  };
2197
2211
  await setDoc4(medicalInfoRef, defaultMedicalInfo);
@@ -2283,7 +2297,7 @@ import {
2283
2297
  getDoc as getDoc6,
2284
2298
  updateDoc as updateDoc4,
2285
2299
  setDoc as setDoc5,
2286
- serverTimestamp as serverTimestamp5
2300
+ serverTimestamp as serverTimestamp6
2287
2301
  } from "firebase/firestore";
2288
2302
  import { z as z9 } from "zod";
2289
2303
  import { geohashForLocation } from "geofire-common";
@@ -2295,7 +2309,7 @@ var updatePatientLocationUtil = async (db, patientId, latitude, longitude) => {
2295
2309
  };
2296
2310
  const updateData = {
2297
2311
  locationData,
2298
- updatedAt: serverTimestamp5()
2312
+ updatedAt: serverTimestamp6()
2299
2313
  };
2300
2314
  await updateDoc4(getLocationInfoDocRef(db, patientId), updateData);
2301
2315
  };
@@ -2314,8 +2328,8 @@ var createLocationInfoUtil = async (db, data, requesterId) => {
2314
2328
  validatedData.locationData.longitude
2315
2329
  ])
2316
2330
  },
2317
- createdAt: serverTimestamp5(),
2318
- updatedAt: serverTimestamp5()
2331
+ createdAt: serverTimestamp6(),
2332
+ updatedAt: serverTimestamp6()
2319
2333
  };
2320
2334
  await setDoc5(getLocationInfoDocRef(db, data.patientId), locationData);
2321
2335
  const locationDoc = await getDoc6(getLocationInfoDocRef(db, data.patientId));
@@ -2351,7 +2365,7 @@ var updateLocationInfoUtil = async (db, patientId, data, requesterId) => {
2351
2365
  ])
2352
2366
  };
2353
2367
  }
2354
- updateData.updatedAt = serverTimestamp5();
2368
+ updateData.updatedAt = serverTimestamp6();
2355
2369
  await updateDoc4(getLocationInfoDocRef(db, patientId), updateData);
2356
2370
  const updatedInfo = await getLocationInfoUtil(db, patientId, requesterId);
2357
2371
  if (!updatedInfo) {
@@ -2366,14 +2380,14 @@ import {
2366
2380
  updateDoc as updateDoc5,
2367
2381
  arrayUnion as arrayUnion3,
2368
2382
  arrayRemove as arrayRemove3,
2369
- serverTimestamp as serverTimestamp6,
2370
- Timestamp as Timestamp5
2383
+ serverTimestamp as serverTimestamp7,
2384
+ Timestamp as Timestamp6
2371
2385
  } from "firebase/firestore";
2372
2386
  var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
2373
2387
  var _a;
2374
2388
  const newDoctor = {
2375
2389
  userRef: doctorRef,
2376
- assignedAt: Timestamp5.now(),
2390
+ assignedAt: Timestamp6.now(),
2377
2391
  assignedBy,
2378
2392
  isActive: true
2379
2393
  };
@@ -2384,7 +2398,7 @@ var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
2384
2398
  (d) => d.userRef === doctorRef
2385
2399
  );
2386
2400
  const updates = {
2387
- updatedAt: serverTimestamp6(),
2401
+ updatedAt: serverTimestamp7(),
2388
2402
  doctorIds: arrayUnion3(doctorRef)
2389
2403
  };
2390
2404
  if (existingDoctorIndex !== void 0 && existingDoctorIndex > -1) {
@@ -2392,7 +2406,7 @@ var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
2392
2406
  updatedDoctors[existingDoctorIndex] = {
2393
2407
  ...updatedDoctors[existingDoctorIndex],
2394
2408
  isActive: true,
2395
- assignedAt: Timestamp5.now(),
2409
+ assignedAt: Timestamp6.now(),
2396
2410
  assignedBy
2397
2411
  };
2398
2412
  updates.doctors = updatedDoctors;
@@ -2413,14 +2427,14 @@ var removeDoctorUtil = async (db, patientId, doctorRef) => {
2413
2427
  // Set the filtered array
2414
2428
  doctorIds: arrayRemove3(doctorRef),
2415
2429
  // Remove ID from the denormalized list
2416
- updatedAt: serverTimestamp6()
2430
+ updatedAt: serverTimestamp7()
2417
2431
  });
2418
2432
  };
2419
2433
  var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
2420
2434
  var _a;
2421
2435
  const newClinic = {
2422
2436
  clinicId,
2423
- assignedAt: Timestamp5.now(),
2437
+ assignedAt: Timestamp6.now(),
2424
2438
  assignedBy,
2425
2439
  isActive: true
2426
2440
  };
@@ -2431,7 +2445,7 @@ var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
2431
2445
  (c) => c.clinicId === clinicId
2432
2446
  );
2433
2447
  const updates = {
2434
- updatedAt: serverTimestamp6(),
2448
+ updatedAt: serverTimestamp7(),
2435
2449
  clinicIds: arrayUnion3(clinicId)
2436
2450
  };
2437
2451
  if (existingClinicIndex !== void 0 && existingClinicIndex > -1) {
@@ -2439,7 +2453,7 @@ var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
2439
2453
  updatedClinics[existingClinicIndex] = {
2440
2454
  ...updatedClinics[existingClinicIndex],
2441
2455
  isActive: true,
2442
- assignedAt: Timestamp5.now(),
2456
+ assignedAt: Timestamp6.now(),
2443
2457
  assignedBy
2444
2458
  };
2445
2459
  updates.clinics = updatedClinics;
@@ -2460,7 +2474,7 @@ var removeClinicUtil = async (db, patientId, clinicId) => {
2460
2474
  // Set the filtered array
2461
2475
  clinicIds: arrayRemove3(clinicId),
2462
2476
  // Remove ID from the denormalized list
2463
- updatedAt: serverTimestamp6()
2477
+ updatedAt: serverTimestamp7()
2464
2478
  });
2465
2479
  };
2466
2480
 
@@ -2847,8 +2861,8 @@ import {
2847
2861
  updateDoc as updateDoc7,
2848
2862
  setDoc as setDoc6,
2849
2863
  deleteDoc,
2850
- Timestamp as Timestamp7,
2851
- serverTimestamp as serverTimestamp8
2864
+ Timestamp as Timestamp8,
2865
+ serverTimestamp as serverTimestamp9
2852
2866
  } from "firebase/firestore";
2853
2867
 
2854
2868
  // src/types/clinic/preferences.types.ts
@@ -2976,7 +2990,7 @@ var SubscriptionModel = /* @__PURE__ */ ((SubscriptionModel2) => {
2976
2990
 
2977
2991
  // src/validations/clinic.schema.ts
2978
2992
  import { z as z12 } from "zod";
2979
- import { Timestamp as Timestamp6 } from "firebase/firestore";
2993
+ import { Timestamp as Timestamp7 } from "firebase/firestore";
2980
2994
 
2981
2995
  // src/validations/reviews.schema.ts
2982
2996
  import { z as z10 } from "zod";
@@ -3251,8 +3265,8 @@ var clinicAdminSchema = z12.object({
3251
3265
  clinicsManagedInfo: z12.array(clinicInfoSchema),
3252
3266
  contactInfo: contactPersonSchema,
3253
3267
  roleTitle: z12.string(),
3254
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3255
- updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3268
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3269
+ updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3256
3270
  isActive: z12.boolean()
3257
3271
  });
3258
3272
  var adminTokenSchema = z12.object({
@@ -3261,9 +3275,9 @@ var adminTokenSchema = z12.object({
3261
3275
  email: z12.string().email().optional().nullable(),
3262
3276
  status: z12.nativeEnum(AdminTokenStatus),
3263
3277
  usedByUserRef: z12.string().optional(),
3264
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3278
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3265
3279
  // Timestamp
3266
- expiresAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6))
3280
+ expiresAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7))
3267
3281
  // Timestamp
3268
3282
  });
3269
3283
  var createAdminTokenSchema = z12.object({
@@ -3283,9 +3297,9 @@ var clinicGroupSchema = z12.object({
3283
3297
  adminsInfo: z12.array(adminInfoSchema),
3284
3298
  adminTokens: z12.array(adminTokenSchema),
3285
3299
  ownerId: z12.string().nullable(),
3286
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3300
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3287
3301
  // Timestamp
3288
- updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3302
+ updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3289
3303
  // Timestamp
3290
3304
  isActive: z12.boolean(),
3291
3305
  logo: z12.string().optional().nullable(),
@@ -3325,9 +3339,9 @@ var clinicSchema = z12.object({
3325
3339
  // servicesInfo: z.array(serviceInfoSchema), // Deprecated, use proceduresInfo
3326
3340
  reviewInfo: clinicReviewInfoSchema,
3327
3341
  admins: z12.array(z12.string()),
3328
- createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3342
+ createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3329
3343
  // Timestamp
3330
- updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp6)),
3344
+ updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp7)),
3331
3345
  // Timestamp
3332
3346
  isActive: z12.boolean(),
3333
3347
  isVerified: z12.boolean(),
@@ -3530,15 +3544,15 @@ async function createClinicAdmin(db, data, clinicGroupService) {
3530
3544
  contactInfo: validatedData.contactInfo,
3531
3545
  roleTitle: validatedData.roleTitle,
3532
3546
  isActive: validatedData.isActive,
3533
- createdAt: serverTimestamp8(),
3534
- updatedAt: serverTimestamp8()
3547
+ createdAt: serverTimestamp9(),
3548
+ updatedAt: serverTimestamp9()
3535
3549
  };
3536
3550
  console.log("[CLINIC_ADMIN] Validating complete admin object");
3537
3551
  try {
3538
3552
  clinicAdminSchema.parse({
3539
3553
  ...adminData,
3540
- createdAt: Timestamp7.now(),
3541
- updatedAt: Timestamp7.now()
3554
+ createdAt: Timestamp8.now(),
3555
+ updatedAt: Timestamp8.now()
3542
3556
  });
3543
3557
  console.log("[CLINIC_ADMIN] Admin object validation passed");
3544
3558
  } catch (schemaError) {
@@ -3634,7 +3648,7 @@ async function updateClinicAdmin(db, adminId, data) {
3634
3648
  }
3635
3649
  const updatedData = {
3636
3650
  ...data,
3637
- updatedAt: serverTimestamp8()
3651
+ updatedAt: serverTimestamp9()
3638
3652
  };
3639
3653
  await updateDoc7(doc7(db, CLINIC_ADMINS_COLLECTION, adminId), updatedData);
3640
3654
  const updatedAdmin = await getClinicAdmin(db, adminId);
@@ -3901,8 +3915,8 @@ import {
3901
3915
  updateDoc as updateDoc8,
3902
3916
  setDoc as setDoc7,
3903
3917
  deleteDoc as deleteDoc2,
3904
- Timestamp as Timestamp9,
3905
- serverTimestamp as serverTimestamp9,
3918
+ Timestamp as Timestamp10,
3919
+ serverTimestamp as serverTimestamp10,
3906
3920
  limit as limit4,
3907
3921
  startAfter as startAfter4,
3908
3922
  orderBy,
@@ -3912,7 +3926,7 @@ import {
3912
3926
 
3913
3927
  // src/validations/practitioner.schema.ts
3914
3928
  import { z as z13 } from "zod";
3915
- import { Timestamp as Timestamp8 } from "firebase/firestore";
3929
+ import { Timestamp as Timestamp9 } from "firebase/firestore";
3916
3930
 
3917
3931
  // src/backoffice/types/static/certification.types.ts
3918
3932
  var CertificationLevel = /* @__PURE__ */ ((CertificationLevel2) => {
@@ -3945,7 +3959,7 @@ var practitionerBasicInfoSchema = z13.object({
3945
3959
  title: z13.string().min(2).max(100),
3946
3960
  email: z13.string().email(),
3947
3961
  phoneNumber: z13.string().regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number"),
3948
- dateOfBirth: z13.instanceof(Timestamp8).or(z13.date()),
3962
+ dateOfBirth: z13.instanceof(Timestamp9).or(z13.date()),
3949
3963
  gender: z13.enum(["male", "female", "other"]),
3950
3964
  profileImageUrl: z13.string().url().optional(),
3951
3965
  bio: z13.string().max(1e3).optional(),
@@ -3956,8 +3970,8 @@ var practitionerCertificationSchema = z13.object({
3956
3970
  specialties: z13.array(z13.nativeEnum(CertificationSpecialty)),
3957
3971
  licenseNumber: z13.string().min(3).max(50),
3958
3972
  issuingAuthority: z13.string().min(2).max(100),
3959
- issueDate: z13.instanceof(Timestamp8).or(z13.date()),
3960
- expiryDate: z13.instanceof(Timestamp8).or(z13.date()).optional(),
3973
+ issueDate: z13.instanceof(Timestamp9).or(z13.date()),
3974
+ expiryDate: z13.instanceof(Timestamp9).or(z13.date()).optional(),
3961
3975
  verificationStatus: z13.enum(["pending", "verified", "rejected"])
3962
3976
  });
3963
3977
  var timeSlotSchema = z13.object({
@@ -3974,8 +3988,8 @@ var practitionerWorkingHoursSchema = z13.object({
3974
3988
  friday: timeSlotSchema,
3975
3989
  saturday: timeSlotSchema,
3976
3990
  sunday: timeSlotSchema,
3977
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
3978
- updatedAt: z13.instanceof(Timestamp8).or(z13.date())
3991
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
3992
+ updatedAt: z13.instanceof(Timestamp9).or(z13.date())
3979
3993
  });
3980
3994
  var practitionerClinicWorkingHoursSchema = z13.object({
3981
3995
  clinicId: z13.string().min(1),
@@ -3989,8 +4003,8 @@ var practitionerClinicWorkingHoursSchema = z13.object({
3989
4003
  sunday: timeSlotSchema
3990
4004
  }),
3991
4005
  isActive: z13.boolean(),
3992
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
3993
- updatedAt: z13.instanceof(Timestamp8).or(z13.date())
4006
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
4007
+ updatedAt: z13.instanceof(Timestamp9).or(z13.date())
3994
4008
  });
3995
4009
  var practitionerSchema = z13.object({
3996
4010
  id: z13.string().min(1),
@@ -4006,8 +4020,8 @@ var practitionerSchema = z13.object({
4006
4020
  isActive: z13.boolean(),
4007
4021
  isVerified: z13.boolean(),
4008
4022
  status: z13.nativeEnum(PractitionerStatus),
4009
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
4010
- updatedAt: z13.instanceof(Timestamp8).or(z13.date())
4023
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
4024
+ updatedAt: z13.instanceof(Timestamp9).or(z13.date())
4011
4025
  });
4012
4026
  var createPractitionerSchema = z13.object({
4013
4027
  userRef: z13.string().min(1),
@@ -4039,10 +4053,10 @@ var practitionerTokenSchema = z13.object({
4039
4053
  clinicId: z13.string().min(1),
4040
4054
  status: z13.nativeEnum(PractitionerTokenStatus),
4041
4055
  createdBy: z13.string().min(1),
4042
- createdAt: z13.instanceof(Timestamp8).or(z13.date()),
4043
- expiresAt: z13.instanceof(Timestamp8).or(z13.date()),
4056
+ createdAt: z13.instanceof(Timestamp9).or(z13.date()),
4057
+ expiresAt: z13.instanceof(Timestamp9).or(z13.date()),
4044
4058
  usedBy: z13.string().optional(),
4045
- usedAt: z13.instanceof(Timestamp8).or(z13.date()).optional()
4059
+ usedAt: z13.instanceof(Timestamp9).or(z13.date()).optional()
4046
4060
  });
4047
4061
  var createPractitionerTokenSchema = z13.object({
4048
4062
  practitionerId: z13.string().min(1),
@@ -4115,13 +4129,13 @@ var PractitionerService = class extends BaseService {
4115
4129
  isActive: validData.isActive !== void 0 ? validData.isActive : true,
4116
4130
  isVerified: validData.isVerified !== void 0 ? validData.isVerified : false,
4117
4131
  status: validData.status || "active" /* ACTIVE */,
4118
- createdAt: serverTimestamp9(),
4119
- updatedAt: serverTimestamp9()
4132
+ createdAt: serverTimestamp10(),
4133
+ updatedAt: serverTimestamp10()
4120
4134
  };
4121
4135
  practitionerSchema.parse({
4122
4136
  ...practitioner,
4123
- createdAt: Timestamp9.now(),
4124
- updatedAt: Timestamp9.now()
4137
+ createdAt: Timestamp10.now(),
4138
+ updatedAt: Timestamp10.now()
4125
4139
  });
4126
4140
  const practitionerRef = doc8(
4127
4141
  this.db,
@@ -4215,14 +4229,14 @@ var PractitionerService = class extends BaseService {
4215
4229
  isActive: validatedData.isActive !== void 0 ? validatedData.isActive : false,
4216
4230
  isVerified: validatedData.isVerified !== void 0 ? validatedData.isVerified : false,
4217
4231
  status: "draft" /* DRAFT */,
4218
- createdAt: serverTimestamp9(),
4219
- updatedAt: serverTimestamp9()
4232
+ createdAt: serverTimestamp10(),
4233
+ updatedAt: serverTimestamp10()
4220
4234
  };
4221
4235
  practitionerSchema.parse({
4222
4236
  ...practitionerData,
4223
4237
  userRef: "temp-for-validation",
4224
- createdAt: Timestamp9.now(),
4225
- updatedAt: Timestamp9.now()
4238
+ createdAt: Timestamp10.now(),
4239
+ updatedAt: Timestamp10.now()
4226
4240
  });
4227
4241
  await setDoc7(
4228
4242
  doc8(this.db, PRACTITIONERS_COLLECTION, practitionerData.id),
@@ -4242,8 +4256,8 @@ var PractitionerService = class extends BaseService {
4242
4256
  clinicId,
4243
4257
  status: "active" /* ACTIVE */,
4244
4258
  createdBy,
4245
- createdAt: Timestamp9.now(),
4246
- expiresAt: Timestamp9.fromDate(expiration)
4259
+ createdAt: Timestamp10.now(),
4260
+ expiresAt: Timestamp10.fromDate(expiration)
4247
4261
  };
4248
4262
  practitionerTokenSchema.parse(token);
4249
4263
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
@@ -4295,8 +4309,8 @@ var PractitionerService = class extends BaseService {
4295
4309
  clinicId: validatedData.clinicId,
4296
4310
  status: "active" /* ACTIVE */,
4297
4311
  createdBy,
4298
- createdAt: Timestamp9.now(),
4299
- expiresAt: Timestamp9.fromDate(expiration)
4312
+ createdAt: Timestamp10.now(),
4313
+ expiresAt: Timestamp10.fromDate(expiration)
4300
4314
  };
4301
4315
  practitionerTokenSchema.parse(token);
4302
4316
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${validatedData.practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
@@ -4322,7 +4336,7 @@ var PractitionerService = class extends BaseService {
4322
4336
  const q = query6(
4323
4337
  tokensRef,
4324
4338
  where6("status", "==", "active" /* ACTIVE */),
4325
- where6("expiresAt", ">", Timestamp9.now())
4339
+ where6("expiresAt", ">", Timestamp10.now())
4326
4340
  );
4327
4341
  const querySnapshot = await getDocs6(q);
4328
4342
  return querySnapshot.docs.map((doc33) => doc33.data());
@@ -4345,7 +4359,7 @@ var PractitionerService = class extends BaseService {
4345
4359
  tokensRef,
4346
4360
  where6("token", "==", tokenString),
4347
4361
  where6("status", "==", "active" /* ACTIVE */),
4348
- where6("expiresAt", ">", Timestamp9.now())
4362
+ where6("expiresAt", ">", Timestamp10.now())
4349
4363
  );
4350
4364
  const tokenSnapshot = await getDocs6(q);
4351
4365
  if (!tokenSnapshot.empty) {
@@ -4368,7 +4382,7 @@ var PractitionerService = class extends BaseService {
4368
4382
  await updateDoc8(tokenRef, {
4369
4383
  status: "used" /* USED */,
4370
4384
  usedBy: userId,
4371
- usedAt: Timestamp9.now()
4385
+ usedAt: Timestamp10.now()
4372
4386
  });
4373
4387
  }
4374
4388
  /**
@@ -4452,7 +4466,7 @@ var PractitionerService = class extends BaseService {
4452
4466
  const currentPractitioner = practitionerDoc.data();
4453
4467
  const updateData = {
4454
4468
  ...validData,
4455
- updatedAt: serverTimestamp9()
4469
+ updatedAt: serverTimestamp10()
4456
4470
  };
4457
4471
  await updateDoc8(practitionerRef, updateData);
4458
4472
  const updatedPractitioner = await this.getPractitioner(practitionerId);
@@ -4494,7 +4508,7 @@ var PractitionerService = class extends BaseService {
4494
4508
  }
4495
4509
  await updateDoc8(practitionerRef, {
4496
4510
  clinics: arrayUnion5(clinicId),
4497
- updatedAt: serverTimestamp9()
4511
+ updatedAt: serverTimestamp10()
4498
4512
  });
4499
4513
  } catch (error) {
4500
4514
  console.error(
@@ -4520,7 +4534,7 @@ var PractitionerService = class extends BaseService {
4520
4534
  }
4521
4535
  await updateDoc8(practitionerRef, {
4522
4536
  clinics: arrayRemove4(clinicId),
4523
- updatedAt: serverTimestamp9()
4537
+ updatedAt: serverTimestamp10()
4524
4538
  });
4525
4539
  } catch (error) {
4526
4540
  console.error(
@@ -4803,9 +4817,9 @@ var UserService = class extends BaseService {
4803
4817
  email: firebaseUser.email,
4804
4818
  roles: roles.length > 0 ? roles : ["patient" /* PATIENT */],
4805
4819
  isAnonymous: firebaseUser.isAnonymous,
4806
- createdAt: serverTimestamp10(),
4807
- updatedAt: serverTimestamp10(),
4808
- lastLoginAt: serverTimestamp10()
4820
+ createdAt: serverTimestamp11(),
4821
+ updatedAt: serverTimestamp11(),
4822
+ lastLoginAt: serverTimestamp11()
4809
4823
  };
4810
4824
  await setDoc8(doc9(this.db, USERS_COLLECTION, userData.uid), userData);
4811
4825
  const profiles = await this.createProfilesForRoles(
@@ -4891,7 +4905,7 @@ var UserService = class extends BaseService {
4891
4905
  email: "",
4892
4906
  phoneNumber: "",
4893
4907
  title: "",
4894
- dateOfBirth: Timestamp10.now(),
4908
+ dateOfBirth: Timestamp11.now(),
4895
4909
  gender: "other",
4896
4910
  languages: ["Serbian"]
4897
4911
  },
@@ -4900,7 +4914,7 @@ var UserService = class extends BaseService {
4900
4914
  specialties: [],
4901
4915
  licenseNumber: "",
4902
4916
  issuingAuthority: "",
4903
- issueDate: Timestamp10.now(),
4917
+ issueDate: Timestamp11.now(),
4904
4918
  verificationStatus: "pending"
4905
4919
  },
4906
4920
  isActive: true,
@@ -4953,8 +4967,8 @@ var UserService = class extends BaseService {
4953
4967
  throw AUTH_ERRORS.USER_NOT_FOUND;
4954
4968
  }
4955
4969
  await updateDoc9(userRef, {
4956
- lastLoginAt: serverTimestamp10(),
4957
- updatedAt: serverTimestamp10()
4970
+ lastLoginAt: serverTimestamp11(),
4971
+ updatedAt: serverTimestamp11()
4958
4972
  });
4959
4973
  return this.getUserById(uid);
4960
4974
  }
@@ -4967,7 +4981,7 @@ var UserService = class extends BaseService {
4967
4981
  await updateDoc9(userRef, {
4968
4982
  email,
4969
4983
  isAnonymous: false,
4970
- updatedAt: serverTimestamp10()
4984
+ updatedAt: serverTimestamp11()
4971
4985
  });
4972
4986
  return this.getUserById(uid);
4973
4987
  }
@@ -4982,12 +4996,12 @@ var UserService = class extends BaseService {
4982
4996
  const updatedUser = {
4983
4997
  ...currentUser,
4984
4998
  ...updates,
4985
- updatedAt: serverTimestamp10()
4999
+ updatedAt: serverTimestamp11()
4986
5000
  };
4987
5001
  userSchema.parse(updatedUser);
4988
5002
  await updateDoc9(userRef, {
4989
5003
  ...updates,
4990
- updatedAt: serverTimestamp10()
5004
+ updatedAt: serverTimestamp11()
4991
5005
  });
4992
5006
  return this.getUserById(uid);
4993
5007
  } catch (error) {
@@ -5007,7 +5021,7 @@ var UserService = class extends BaseService {
5007
5021
  await updateDoc9(doc9(this.db, USERS_COLLECTION, uid), {
5008
5022
  roles: [...user.roles, role],
5009
5023
  ...profiles,
5010
- updatedAt: serverTimestamp10()
5024
+ updatedAt: serverTimestamp11()
5011
5025
  });
5012
5026
  }
5013
5027
  /**
@@ -5041,7 +5055,7 @@ var UserService = class extends BaseService {
5041
5055
  }
5042
5056
  await updateDoc9(doc9(this.db, USERS_COLLECTION, uid), {
5043
5057
  roles: user.roles.filter((r) => r !== role),
5044
- updatedAt: serverTimestamp10()
5058
+ updatedAt: serverTimestamp11()
5045
5059
  });
5046
5060
  }
5047
5061
  // Delete operations
@@ -5085,7 +5099,7 @@ import {
5085
5099
  where as where8,
5086
5100
  updateDoc as updateDoc10,
5087
5101
  setDoc as setDoc9,
5088
- Timestamp as Timestamp11
5102
+ Timestamp as Timestamp12
5089
5103
  } from "firebase/firestore";
5090
5104
  import { geohashForLocation as geohashForLocation2 } from "geofire-common";
5091
5105
  import { z as z16 } from "zod";
@@ -5209,7 +5223,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
5209
5223
  throw geohashError;
5210
5224
  }
5211
5225
  }
5212
- const now = Timestamp11.now();
5226
+ const now = Timestamp12.now();
5213
5227
  console.log("[CLINIC_GROUP] Preparing clinic group data object");
5214
5228
  const groupId = doc10(collection8(db, CLINIC_GROUPS_COLLECTION)).id;
5215
5229
  console.log("[CLINIC_GROUP] Logo value:", {
@@ -5348,7 +5362,7 @@ async function updateClinicGroup(db, groupId, data, app) {
5348
5362
  }
5349
5363
  updatedData = {
5350
5364
  ...updatedData,
5351
- updatedAt: Timestamp11.now()
5365
+ updatedAt: Timestamp12.now()
5352
5366
  };
5353
5367
  console.log("[CLINIC_GROUP] Updating clinic group in Firestore");
5354
5368
  await updateDoc10(doc10(db, CLINIC_GROUPS_COLLECTION, groupId), updatedData);
@@ -5432,10 +5446,10 @@ async function createAdminToken(db, groupId, creatorAdminId, app, data) {
5432
5446
  if (!group.admins.includes(creatorAdminId)) {
5433
5447
  throw new Error("Admin does not belong to this clinic group");
5434
5448
  }
5435
- const now = Timestamp11.now();
5449
+ const now = Timestamp12.now();
5436
5450
  const expiresInDays = (data == null ? void 0 : data.expiresInDays) || 7;
5437
5451
  const email = (data == null ? void 0 : data.email) || null;
5438
- const expiresAt = new Timestamp11(
5452
+ const expiresAt = new Timestamp12(
5439
5453
  now.seconds + expiresInDays * 24 * 60 * 60,
5440
5454
  now.nanoseconds
5441
5455
  );
@@ -5469,7 +5483,7 @@ async function verifyAndUseAdminToken(db, groupId, token, userRef, app) {
5469
5483
  if (adminToken.status !== "active" /* ACTIVE */) {
5470
5484
  throw new Error("Admin token is not active");
5471
5485
  }
5472
- const now = Timestamp11.now();
5486
+ const now = Timestamp12.now();
5473
5487
  if (adminToken.expiresAt.seconds < now.seconds) {
5474
5488
  const updatedTokens2 = group.adminTokens.map(
5475
5489
  (t) => t.id === adminToken.id ? { ...t, status: "expired" /* EXPIRED */ } : t
@@ -5704,8 +5718,8 @@ import {
5704
5718
  doc as doc12,
5705
5719
  getDoc as getDoc15,
5706
5720
  updateDoc as updateDoc12,
5707
- Timestamp as Timestamp13,
5708
- serverTimestamp as serverTimestamp12,
5721
+ Timestamp as Timestamp14,
5722
+ serverTimestamp as serverTimestamp13,
5709
5723
  writeBatch as writeBatch4,
5710
5724
  arrayUnion as arrayUnion6
5711
5725
  } from "firebase/firestore";
@@ -5724,7 +5738,7 @@ import {
5724
5738
  where as where9,
5725
5739
  updateDoc as updateDoc11,
5726
5740
  setDoc as setDoc10,
5727
- Timestamp as Timestamp12,
5741
+ Timestamp as Timestamp13,
5728
5742
  limit as limit5,
5729
5743
  startAfter as startAfter5
5730
5744
  } from "firebase/firestore";
@@ -5904,7 +5918,7 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
5904
5918
  }
5905
5919
  updatedData = {
5906
5920
  ...updatedData,
5907
- updatedAt: Timestamp12.now()
5921
+ updatedAt: Timestamp13.now()
5908
5922
  };
5909
5923
  console.log("[CLINIC] Updating clinic in Firestore");
5910
5924
  try {
@@ -6397,13 +6411,13 @@ var ClinicService = class extends BaseService {
6397
6411
  isActive: validatedData.isActive,
6398
6412
  isVerified: validatedData.isVerified,
6399
6413
  logo: validatedData.logo,
6400
- createdAt: serverTimestamp12(),
6401
- updatedAt: serverTimestamp12()
6414
+ createdAt: serverTimestamp13(),
6415
+ updatedAt: serverTimestamp13()
6402
6416
  };
6403
6417
  clinicSchema.parse({
6404
6418
  ...clinicData,
6405
- createdAt: Timestamp13.now(),
6406
- updatedAt: Timestamp13.now()
6419
+ createdAt: Timestamp14.now(),
6420
+ updatedAt: Timestamp14.now()
6407
6421
  });
6408
6422
  const batch = writeBatch4(this.db);
6409
6423
  const clinicRef = doc12(this.db, CLINICS_COLLECTION, clinicId);
@@ -6411,7 +6425,7 @@ var ClinicService = class extends BaseService {
6411
6425
  const adminRef = doc12(this.db, CLINIC_ADMINS_COLLECTION, creatorAdminId);
6412
6426
  batch.update(adminRef, {
6413
6427
  clinicsManaged: arrayUnion6(clinicId),
6414
- updatedAt: serverTimestamp12()
6428
+ updatedAt: serverTimestamp13()
6415
6429
  });
6416
6430
  await batch.commit();
6417
6431
  const savedClinic = await this.getClinic(clinicId);
@@ -6454,12 +6468,12 @@ var ClinicService = class extends BaseService {
6454
6468
  };
6455
6469
  clinicSchema.parse({
6456
6470
  ...finalStateForValidation,
6457
- updatedAt: Timestamp13.now()
6471
+ updatedAt: Timestamp14.now()
6458
6472
  // Use current time for validation
6459
6473
  });
6460
6474
  const updateDataForFirestore = {
6461
6475
  ...updatePayload,
6462
- updatedAt: serverTimestamp12()
6476
+ updatedAt: serverTimestamp13()
6463
6477
  };
6464
6478
  await updateDoc12(clinicRef, updateDataForFirestore);
6465
6479
  const updatedClinic = await this.getClinic(clinicId);
@@ -6482,7 +6496,7 @@ var ClinicService = class extends BaseService {
6482
6496
  const clinicRef = doc12(this.db, CLINICS_COLLECTION, clinicId);
6483
6497
  await updateDoc12(clinicRef, {
6484
6498
  isActive: false,
6485
- updatedAt: serverTimestamp12()
6499
+ updatedAt: serverTimestamp13()
6486
6500
  });
6487
6501
  }
6488
6502
  /**
@@ -7368,27 +7382,31 @@ var AuthService = class extends BaseService {
7368
7382
  data.profileData = {};
7369
7383
  }
7370
7384
  const basicInfo = {
7371
- firstName: data.firstName,
7372
- lastName: data.lastName,
7385
+ firstName: data.firstName.length >= 2 ? data.firstName : data.firstName.padEnd(2, " "),
7386
+ lastName: data.lastName.length >= 2 ? data.lastName : data.lastName.padEnd(2, " "),
7373
7387
  email: data.email,
7374
- phoneNumber: ((_a = data.profileData.basicInfo) == null ? void 0 : _a.phoneNumber) || "",
7375
- profileImageUrl: ((_b = data.profileData.basicInfo) == null ? void 0 : _b.profileImageUrl) || "",
7376
- gender: ((_c = data.profileData.basicInfo) == null ? void 0 : _c.gender) || "other",
7388
+ phoneNumber: "+1234567890",
7389
+ // Default valid phone number
7390
+ profileImageUrl: ((_a = data.profileData.basicInfo) == null ? void 0 : _a.profileImageUrl) || "",
7391
+ gender: ((_b = data.profileData.basicInfo) == null ? void 0 : _b.gender) || "other",
7377
7392
  // Default to "other" if not provided
7378
- bio: ((_d = data.profileData.basicInfo) == null ? void 0 : _d.bio) || "",
7379
- title: "Practitioner",
7393
+ bio: ((_c = data.profileData.basicInfo) == null ? void 0 : _c.bio) || "",
7394
+ title: ((_d = data.profileData.basicInfo) == null ? void 0 : _d.title) || "Practitioner",
7380
7395
  // Default title
7381
- dateOfBirth: /* @__PURE__ */ new Date(),
7382
- // Default to today
7396
+ dateOfBirth: Timestamp15.fromDate(/* @__PURE__ */ new Date()),
7397
+ // Use Timestamp instead of Date
7383
7398
  languages: ["English"]
7384
7399
  // Default language
7385
7400
  };
7386
7401
  const certification = data.profileData.certification || {
7387
7402
  level: "aesthetician" /* AESTHETICIAN */,
7388
7403
  specialties: [],
7389
- licenseNumber: "Pending",
7390
- issuingAuthority: "Pending",
7391
- issueDate: /* @__PURE__ */ new Date(),
7404
+ licenseNumber: "Pending123",
7405
+ // At least 3 characters
7406
+ issuingAuthority: "Default Authority",
7407
+ // At least 2 characters
7408
+ issueDate: Timestamp15.fromDate(/* @__PURE__ */ new Date()),
7409
+ // Use Timestamp instead of Date
7392
7410
  verificationStatus: "pending"
7393
7411
  };
7394
7412
  const createPractitionerData = {
@@ -7515,7 +7533,7 @@ import {
7515
7533
  updateDoc as updateDoc14,
7516
7534
  deleteDoc as deleteDoc7,
7517
7535
  orderBy as orderBy3,
7518
- Timestamp as Timestamp15,
7536
+ Timestamp as Timestamp16,
7519
7537
  addDoc as addDoc2,
7520
7538
  writeBatch as writeBatch5
7521
7539
  } from "firebase/firestore";
@@ -7558,7 +7576,7 @@ var NotificationService = class extends BaseService {
7558
7576
  */
7559
7577
  async createNotification(notification) {
7560
7578
  const notificationsRef = collection14(this.db, NOTIFICATIONS_COLLECTION);
7561
- const now = Timestamp15.now();
7579
+ const now = Timestamp16.now();
7562
7580
  const notificationData = {
7563
7581
  ...notification,
7564
7582
  createdAt: now,
@@ -7633,7 +7651,7 @@ var NotificationService = class extends BaseService {
7633
7651
  );
7634
7652
  await updateDoc14(notificationRef, {
7635
7653
  isRead: true,
7636
- updatedAt: Timestamp15.now()
7654
+ updatedAt: Timestamp16.now()
7637
7655
  });
7638
7656
  }
7639
7657
  /**
@@ -7650,7 +7668,7 @@ var NotificationService = class extends BaseService {
7650
7668
  );
7651
7669
  batch.update(notificationRef, {
7652
7670
  isRead: true,
7653
- updatedAt: Timestamp15.now()
7671
+ updatedAt: Timestamp16.now()
7654
7672
  });
7655
7673
  });
7656
7674
  await batch.commit();
@@ -7666,7 +7684,7 @@ var NotificationService = class extends BaseService {
7666
7684
  );
7667
7685
  await updateDoc14(notificationRef, {
7668
7686
  status,
7669
- updatedAt: Timestamp15.now()
7687
+ updatedAt: Timestamp16.now()
7670
7688
  });
7671
7689
  }
7672
7690
  /**
@@ -7724,7 +7742,7 @@ import {
7724
7742
  updateDoc as updateDoc15,
7725
7743
  setDoc as setDoc13,
7726
7744
  deleteDoc as deleteDoc8,
7727
- serverTimestamp as serverTimestamp14,
7745
+ serverTimestamp as serverTimestamp15,
7728
7746
  orderBy as orderBy4,
7729
7747
  limit as limit7,
7730
7748
  startAfter as startAfter7
@@ -7913,8 +7931,8 @@ var ProcedureService = class extends BaseService {
7913
7931
  const procedureRef = doc15(this.db, PROCEDURES_COLLECTION, procedureId);
7914
7932
  await setDoc13(procedureRef, {
7915
7933
  ...newProcedure,
7916
- createdAt: serverTimestamp14(),
7917
- updatedAt: serverTimestamp14()
7934
+ createdAt: serverTimestamp15(),
7935
+ updatedAt: serverTimestamp15()
7918
7936
  });
7919
7937
  const savedDoc = await getDoc18(procedureRef);
7920
7938
  return savedDoc.data();
@@ -8080,7 +8098,7 @@ var ProcedureService = class extends BaseService {
8080
8098
  }
8081
8099
  await updateDoc15(procedureRef, {
8082
8100
  ...updatedProcedureData,
8083
- updatedAt: serverTimestamp14()
8101
+ updatedAt: serverTimestamp15()
8084
8102
  });
8085
8103
  const updatedSnapshot = await getDoc18(procedureRef);
8086
8104
  return updatedSnapshot.data();
@@ -8098,7 +8116,7 @@ var ProcedureService = class extends BaseService {
8098
8116
  }
8099
8117
  await updateDoc15(procedureRef, {
8100
8118
  isActive: false,
8101
- updatedAt: serverTimestamp14()
8119
+ updatedAt: serverTimestamp15()
8102
8120
  });
8103
8121
  }
8104
8122
  /**
@@ -8984,7 +9002,7 @@ var FilledDocumentService = class extends BaseService {
8984
9002
  };
8985
9003
 
8986
9004
  // src/services/calendar/calendar-refactored.service.ts
8987
- import { Timestamp as Timestamp26, serverTimestamp as serverTimestamp21 } from "firebase/firestore";
9005
+ import { Timestamp as Timestamp27, serverTimestamp as serverTimestamp22 } from "firebase/firestore";
8988
9006
 
8989
9007
  // src/types/calendar/synced-calendar.types.ts
8990
9008
  var SyncedCalendarProvider = /* @__PURE__ */ ((SyncedCalendarProvider3) => {
@@ -9009,11 +9027,11 @@ import {
9009
9027
 
9010
9028
  // src/validations/calendar.schema.ts
9011
9029
  import { z as z22 } from "zod";
9012
- import { Timestamp as Timestamp19 } from "firebase/firestore";
9030
+ import { Timestamp as Timestamp20 } from "firebase/firestore";
9013
9031
 
9014
9032
  // src/validations/profile-info.schema.ts
9015
9033
  import { z as z21 } from "zod";
9016
- import { Timestamp as Timestamp18 } from "firebase/firestore";
9034
+ import { Timestamp as Timestamp19 } from "firebase/firestore";
9017
9035
  var clinicInfoSchema2 = z21.object({
9018
9036
  id: z21.string(),
9019
9037
  featuredPhoto: z21.string(),
@@ -9035,19 +9053,19 @@ var patientProfileInfoSchema = z21.object({
9035
9053
  fullName: z21.string(),
9036
9054
  email: z21.string().email(),
9037
9055
  phone: z21.string().nullable(),
9038
- dateOfBirth: z21.instanceof(Timestamp18),
9056
+ dateOfBirth: z21.instanceof(Timestamp19),
9039
9057
  gender: z21.nativeEnum(Gender)
9040
9058
  });
9041
9059
 
9042
9060
  // src/validations/calendar.schema.ts
9043
9061
  var MIN_APPOINTMENT_DURATION = 15;
9044
9062
  var calendarEventTimeSchema = z22.object({
9045
- start: z22.instanceof(Date).or(z22.instanceof(Timestamp19)),
9046
- end: z22.instanceof(Date).or(z22.instanceof(Timestamp19))
9063
+ start: z22.instanceof(Date).or(z22.instanceof(Timestamp20)),
9064
+ end: z22.instanceof(Date).or(z22.instanceof(Timestamp20))
9047
9065
  }).refine(
9048
9066
  (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;
9067
+ const startDate = data.start instanceof Timestamp20 ? data.start.toDate() : data.start;
9068
+ const endDate = data.end instanceof Timestamp20 ? data.end.toDate() : data.end;
9051
9069
  return startDate < endDate;
9052
9070
  },
9053
9071
  {
@@ -9056,7 +9074,7 @@ var calendarEventTimeSchema = z22.object({
9056
9074
  }
9057
9075
  ).refine(
9058
9076
  (data) => {
9059
- const startDate = data.start instanceof Timestamp19 ? data.start.toDate() : data.start;
9077
+ const startDate = data.start instanceof Timestamp20 ? data.start.toDate() : data.start;
9060
9078
  return startDate > /* @__PURE__ */ new Date();
9061
9079
  },
9062
9080
  {
@@ -9075,7 +9093,7 @@ var timeSlotSchema2 = z22.object({
9075
9093
  var syncedCalendarEventSchema = z22.object({
9076
9094
  eventId: z22.string(),
9077
9095
  syncedCalendarProvider: z22.nativeEnum(SyncedCalendarProvider),
9078
- syncedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp19))
9096
+ syncedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp20))
9079
9097
  });
9080
9098
  var procedureInfoSchema = z22.object({
9081
9099
  name: z22.string(),
@@ -9177,8 +9195,8 @@ var calendarEventSchema = z22.object({
9177
9195
  status: z22.nativeEnum(CalendarEventStatus),
9178
9196
  syncStatus: z22.nativeEnum(CalendarSyncStatus),
9179
9197
  eventType: z22.nativeEnum(CalendarEventType),
9180
- createdAt: z22.instanceof(Date).or(z22.instanceof(Timestamp19)),
9181
- updatedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp19))
9198
+ createdAt: z22.instanceof(Date).or(z22.instanceof(Timestamp20)),
9199
+ updatedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp20))
9182
9200
  });
9183
9201
 
9184
9202
  // src/services/calendar/utils/clinic.utils.ts
@@ -9193,8 +9211,8 @@ import {
9193
9211
  query as query18,
9194
9212
  where as where18,
9195
9213
  orderBy as orderBy7,
9196
- Timestamp as Timestamp20,
9197
- serverTimestamp as serverTimestamp16
9214
+ Timestamp as Timestamp21,
9215
+ serverTimestamp as serverTimestamp17
9198
9216
  } from "firebase/firestore";
9199
9217
 
9200
9218
  // src/services/calendar/utils/docs.utils.ts
@@ -9243,21 +9261,21 @@ async function createClinicCalendarEventUtil(db, clinicId, eventData, generateId
9243
9261
  const newEvent = {
9244
9262
  id: eventId,
9245
9263
  ...eventData,
9246
- createdAt: serverTimestamp16(),
9247
- updatedAt: serverTimestamp16()
9264
+ createdAt: serverTimestamp17(),
9265
+ updatedAt: serverTimestamp17()
9248
9266
  };
9249
9267
  await setDoc16(eventRef, newEvent);
9250
9268
  return {
9251
9269
  ...newEvent,
9252
- createdAt: Timestamp20.now(),
9253
- updatedAt: Timestamp20.now()
9270
+ createdAt: Timestamp21.now(),
9271
+ updatedAt: Timestamp21.now()
9254
9272
  };
9255
9273
  }
9256
9274
  async function updateClinicCalendarEventUtil(db, clinicId, eventId, updateData) {
9257
9275
  const eventRef = getClinicCalendarEventDocRef(db, clinicId, eventId);
9258
9276
  const updates = {
9259
9277
  ...updateData,
9260
- updatedAt: serverTimestamp16()
9278
+ updatedAt: serverTimestamp17()
9261
9279
  };
9262
9280
  await updateDoc18(eventRef, updates);
9263
9281
  const updatedDoc = await getDoc21(eventRef);
@@ -9297,8 +9315,8 @@ import {
9297
9315
  query as query19,
9298
9316
  where as where19,
9299
9317
  orderBy as orderBy8,
9300
- Timestamp as Timestamp21,
9301
- serverTimestamp as serverTimestamp17
9318
+ Timestamp as Timestamp22,
9319
+ serverTimestamp as serverTimestamp18
9302
9320
  } from "firebase/firestore";
9303
9321
  async function createPatientCalendarEventUtil(db, patientId, eventData, generateId2) {
9304
9322
  const eventId = generateId2();
@@ -9306,21 +9324,21 @@ async function createPatientCalendarEventUtil(db, patientId, eventData, generate
9306
9324
  const newEvent = {
9307
9325
  id: eventId,
9308
9326
  ...eventData,
9309
- createdAt: serverTimestamp17(),
9310
- updatedAt: serverTimestamp17()
9327
+ createdAt: serverTimestamp18(),
9328
+ updatedAt: serverTimestamp18()
9311
9329
  };
9312
9330
  await setDoc17(eventRef, newEvent);
9313
9331
  return {
9314
9332
  ...newEvent,
9315
- createdAt: Timestamp21.now(),
9316
- updatedAt: Timestamp21.now()
9333
+ createdAt: Timestamp22.now(),
9334
+ updatedAt: Timestamp22.now()
9317
9335
  };
9318
9336
  }
9319
9337
  async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData) {
9320
9338
  const eventRef = getPatientCalendarEventDocRef(db, patientId, eventId);
9321
9339
  const updates = {
9322
9340
  ...updateData,
9323
- updatedAt: serverTimestamp17()
9341
+ updatedAt: serverTimestamp18()
9324
9342
  };
9325
9343
  await updateDoc19(eventRef, updates);
9326
9344
  const updatedDoc = await getDoc22(eventRef);
@@ -9341,8 +9359,8 @@ import {
9341
9359
  query as query20,
9342
9360
  where as where20,
9343
9361
  orderBy as orderBy9,
9344
- Timestamp as Timestamp22,
9345
- serverTimestamp as serverTimestamp18
9362
+ Timestamp as Timestamp23,
9363
+ serverTimestamp as serverTimestamp19
9346
9364
  } from "firebase/firestore";
9347
9365
  async function createPractitionerCalendarEventUtil(db, practitionerId, eventData, generateId2) {
9348
9366
  const eventId = generateId2();
@@ -9354,14 +9372,14 @@ async function createPractitionerCalendarEventUtil(db, practitionerId, eventData
9354
9372
  const newEvent = {
9355
9373
  id: eventId,
9356
9374
  ...eventData,
9357
- createdAt: serverTimestamp18(),
9358
- updatedAt: serverTimestamp18()
9375
+ createdAt: serverTimestamp19(),
9376
+ updatedAt: serverTimestamp19()
9359
9377
  };
9360
9378
  await setDoc18(eventRef, newEvent);
9361
9379
  return {
9362
9380
  ...newEvent,
9363
- createdAt: Timestamp22.now(),
9364
- updatedAt: Timestamp22.now()
9381
+ createdAt: Timestamp23.now(),
9382
+ updatedAt: Timestamp23.now()
9365
9383
  };
9366
9384
  }
9367
9385
  async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId, updateData) {
@@ -9372,7 +9390,7 @@ async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId,
9372
9390
  );
9373
9391
  const updates = {
9374
9392
  ...updateData,
9375
- updatedAt: serverTimestamp18()
9393
+ updatedAt: serverTimestamp19()
9376
9394
  };
9377
9395
  await updateDoc20(eventRef, updates);
9378
9396
  const updatedDoc = await getDoc23(eventRef);
@@ -9444,8 +9462,8 @@ import {
9444
9462
  query as query21,
9445
9463
  where as where21,
9446
9464
  orderBy as orderBy10,
9447
- Timestamp as Timestamp23,
9448
- serverTimestamp as serverTimestamp19
9465
+ Timestamp as Timestamp24,
9466
+ serverTimestamp as serverTimestamp20
9449
9467
  } from "firebase/firestore";
9450
9468
  async function searchCalendarEventsUtil(db, params) {
9451
9469
  const { searchLocation, entityId, ...filters } = params;
@@ -9549,8 +9567,8 @@ import {
9549
9567
  deleteDoc as deleteDoc14,
9550
9568
  query as query22,
9551
9569
  orderBy as orderBy11,
9552
- Timestamp as Timestamp24,
9553
- serverTimestamp as serverTimestamp20
9570
+ Timestamp as Timestamp25,
9571
+ serverTimestamp as serverTimestamp21
9554
9572
  } from "firebase/firestore";
9555
9573
  async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendarData, generateId2) {
9556
9574
  const calendarId = generateId2();
@@ -9562,14 +9580,14 @@ async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendar
9562
9580
  const newCalendar = {
9563
9581
  id: calendarId,
9564
9582
  ...calendarData,
9565
- createdAt: serverTimestamp20(),
9566
- updatedAt: serverTimestamp20()
9583
+ createdAt: serverTimestamp21(),
9584
+ updatedAt: serverTimestamp21()
9567
9585
  };
9568
9586
  await setDoc20(calendarRef, newCalendar);
9569
9587
  return {
9570
9588
  ...newCalendar,
9571
- createdAt: Timestamp24.now(),
9572
- updatedAt: Timestamp24.now()
9589
+ createdAt: Timestamp25.now(),
9590
+ updatedAt: Timestamp25.now()
9573
9591
  };
9574
9592
  }
9575
9593
  async function createPatientSyncedCalendarUtil(db, patientId, calendarData, generateId2) {
@@ -9578,14 +9596,14 @@ async function createPatientSyncedCalendarUtil(db, patientId, calendarData, gene
9578
9596
  const newCalendar = {
9579
9597
  id: calendarId,
9580
9598
  ...calendarData,
9581
- createdAt: serverTimestamp20(),
9582
- updatedAt: serverTimestamp20()
9599
+ createdAt: serverTimestamp21(),
9600
+ updatedAt: serverTimestamp21()
9583
9601
  };
9584
9602
  await setDoc20(calendarRef, newCalendar);
9585
9603
  return {
9586
9604
  ...newCalendar,
9587
- createdAt: Timestamp24.now(),
9588
- updatedAt: Timestamp24.now()
9605
+ createdAt: Timestamp25.now(),
9606
+ updatedAt: Timestamp25.now()
9589
9607
  };
9590
9608
  }
9591
9609
  async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, generateId2) {
@@ -9594,14 +9612,14 @@ async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, genera
9594
9612
  const newCalendar = {
9595
9613
  id: calendarId,
9596
9614
  ...calendarData,
9597
- createdAt: serverTimestamp20(),
9598
- updatedAt: serverTimestamp20()
9615
+ createdAt: serverTimestamp21(),
9616
+ updatedAt: serverTimestamp21()
9599
9617
  };
9600
9618
  await setDoc20(calendarRef, newCalendar);
9601
9619
  return {
9602
9620
  ...newCalendar,
9603
- createdAt: Timestamp24.now(),
9604
- updatedAt: Timestamp24.now()
9621
+ createdAt: Timestamp25.now(),
9622
+ updatedAt: Timestamp25.now()
9605
9623
  };
9606
9624
  }
9607
9625
  async function getPractitionerSyncedCalendarUtil(db, practitionerId, calendarId) {
@@ -9667,7 +9685,7 @@ async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendar
9667
9685
  );
9668
9686
  const updates = {
9669
9687
  ...updateData,
9670
- updatedAt: serverTimestamp20()
9688
+ updatedAt: serverTimestamp21()
9671
9689
  };
9672
9690
  await updateDoc22(calendarRef, updates);
9673
9691
  const updatedDoc = await getDoc25(calendarRef);
@@ -9680,7 +9698,7 @@ async function updatePatientSyncedCalendarUtil(db, patientId, calendarId, update
9680
9698
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
9681
9699
  const updates = {
9682
9700
  ...updateData,
9683
- updatedAt: serverTimestamp20()
9701
+ updatedAt: serverTimestamp21()
9684
9702
  };
9685
9703
  await updateDoc22(calendarRef, updates);
9686
9704
  const updatedDoc = await getDoc25(calendarRef);
@@ -9693,7 +9711,7 @@ async function updateClinicSyncedCalendarUtil(db, clinicId, calendarId, updateDa
9693
9711
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
9694
9712
  const updates = {
9695
9713
  ...updateData,
9696
- updatedAt: serverTimestamp20()
9714
+ updatedAt: serverTimestamp21()
9697
9715
  };
9698
9716
  await updateDoc22(calendarRef, updates);
9699
9717
  const updatedDoc = await getDoc25(calendarRef);
@@ -9720,7 +9738,7 @@ async function deleteClinicSyncedCalendarUtil(db, clinicId, calendarId) {
9720
9738
  }
9721
9739
  async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarId) {
9722
9740
  const updateData = {
9723
- lastSyncedAt: Timestamp24.now()
9741
+ lastSyncedAt: Timestamp25.now()
9724
9742
  };
9725
9743
  switch (entityType) {
9726
9744
  case "practitioner":
@@ -9750,7 +9768,7 @@ async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarI
9750
9768
  }
9751
9769
 
9752
9770
  // src/services/calendar/utils/google-calendar.utils.ts
9753
- import { Timestamp as Timestamp25 } from "firebase/firestore";
9771
+ import { Timestamp as Timestamp26 } from "firebase/firestore";
9754
9772
  var GOOGLE_CALENDAR_API_URL = "https://www.googleapis.com/calendar/v3";
9755
9773
  var GOOGLE_OAUTH_URL = "https://oauth2.googleapis.com/token";
9756
9774
  var CLIENT_ID = "your-client-id";
@@ -9870,7 +9888,7 @@ async function ensureValidToken(db, entityType, entityId, syncedCalendar) {
9870
9888
  tokenExpiry.setSeconds(tokenExpiry.getSeconds() + expiresIn);
9871
9889
  const updateData = {
9872
9890
  accessToken,
9873
- tokenExpiry: Timestamp25.fromDate(tokenExpiry)
9891
+ tokenExpiry: Timestamp26.fromDate(tokenExpiry)
9874
9892
  };
9875
9893
  switch (entityType) {
9876
9894
  case "practitioner":
@@ -10045,8 +10063,8 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
10045
10063
  eventName: googleEvent.summary || "External Event",
10046
10064
  eventLocation: googleEvent.location,
10047
10065
  eventTime: {
10048
- start: Timestamp25.fromDate(start),
10049
- end: Timestamp25.fromDate(end)
10066
+ start: Timestamp26.fromDate(start),
10067
+ end: Timestamp26.fromDate(end)
10050
10068
  },
10051
10069
  description: googleEvent.description || "",
10052
10070
  // External events are always set as CONFIRMED - status updates will happen externally
@@ -10060,7 +10078,7 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
10060
10078
  {
10061
10079
  eventId: googleEvent.id,
10062
10080
  syncedCalendarProvider: "google" /* GOOGLE */,
10063
- syncedAt: Timestamp25.now()
10081
+ syncedAt: Timestamp26.now()
10064
10082
  }
10065
10083
  ]
10066
10084
  };
@@ -10838,7 +10856,7 @@ var CalendarServiceV2 = class extends BaseService {
10838
10856
  return 0;
10839
10857
  }
10840
10858
  let importedEventsCount = 0;
10841
- const currentTime = Timestamp26.now();
10859
+ const currentTime = Timestamp27.now();
10842
10860
  for (const calendar of activeCalendars) {
10843
10861
  try {
10844
10862
  let externalEvents = [];
@@ -10915,14 +10933,14 @@ var CalendarServiceV2 = class extends BaseService {
10915
10933
  const newEvent = {
10916
10934
  id: eventId,
10917
10935
  ...eventData,
10918
- createdAt: serverTimestamp21(),
10919
- updatedAt: serverTimestamp21()
10936
+ createdAt: serverTimestamp22(),
10937
+ updatedAt: serverTimestamp22()
10920
10938
  };
10921
10939
  await setDoc21(eventRef, newEvent);
10922
10940
  return {
10923
10941
  ...newEvent,
10924
- createdAt: Timestamp26.now(),
10925
- updatedAt: Timestamp26.now()
10942
+ createdAt: Timestamp27.now(),
10943
+ updatedAt: Timestamp27.now()
10926
10944
  };
10927
10945
  } catch (error) {
10928
10946
  console.error(
@@ -11008,8 +11026,8 @@ var CalendarServiceV2 = class extends BaseService {
11008
11026
  const q = query23(
11009
11027
  eventsRef,
11010
11028
  where23("syncStatus", "==", "external" /* EXTERNAL */),
11011
- where23("eventTime.start", ">=", Timestamp26.fromDate(startDate)),
11012
- where23("eventTime.start", "<=", Timestamp26.fromDate(endDate))
11029
+ where23("eventTime.start", ">=", Timestamp27.fromDate(startDate)),
11030
+ where23("eventTime.start", "<=", Timestamp27.fromDate(endDate))
11013
11031
  );
11014
11032
  const eventsSnapshot = await getDocs23(q);
11015
11033
  const events = eventsSnapshot.docs.map((doc33) => ({
@@ -11128,11 +11146,11 @@ var CalendarServiceV2 = class extends BaseService {
11128
11146
  await updateDoc23(eventRef, {
11129
11147
  eventName: externalEvent.summary || "External Event",
11130
11148
  eventTime: {
11131
- start: Timestamp26.fromDate(startTime),
11132
- end: Timestamp26.fromDate(endTime)
11149
+ start: Timestamp27.fromDate(startTime),
11150
+ end: Timestamp27.fromDate(endTime)
11133
11151
  },
11134
11152
  description: externalEvent.description || "",
11135
- updatedAt: serverTimestamp21()
11153
+ updatedAt: serverTimestamp22()
11136
11154
  });
11137
11155
  console.log(`Updated local event ${eventId} from external event`);
11138
11156
  } catch (error) {
@@ -11159,7 +11177,7 @@ var CalendarServiceV2 = class extends BaseService {
11159
11177
  );
11160
11178
  await updateDoc23(eventRef, {
11161
11179
  status,
11162
- updatedAt: serverTimestamp21()
11180
+ updatedAt: serverTimestamp22()
11163
11181
  });
11164
11182
  console.log(`Updated event ${eventId} status to ${status}`);
11165
11183
  } catch (error) {
@@ -11207,8 +11225,8 @@ var CalendarServiceV2 = class extends BaseService {
11207
11225
  */
11208
11226
  async getPractitionerUpcomingAppointments(doctorId, startDate, endDate, status = "confirmed" /* CONFIRMED */) {
11209
11227
  const dateRange = {
11210
- start: Timestamp26.fromDate(startDate),
11211
- end: Timestamp26.fromDate(endDate)
11228
+ start: Timestamp27.fromDate(startDate),
11229
+ end: Timestamp27.fromDate(endDate)
11212
11230
  };
11213
11231
  const searchParams = {
11214
11232
  searchLocation: "practitioner" /* PRACTITIONER */,
@@ -11230,8 +11248,8 @@ var CalendarServiceV2 = class extends BaseService {
11230
11248
  */
11231
11249
  async getPatientAppointments(patientId, startDate, endDate, status) {
11232
11250
  const dateRange = {
11233
- start: Timestamp26.fromDate(startDate),
11234
- end: Timestamp26.fromDate(endDate)
11251
+ start: Timestamp27.fromDate(startDate),
11252
+ end: Timestamp27.fromDate(endDate)
11235
11253
  };
11236
11254
  const searchParams = {
11237
11255
  searchLocation: "patient" /* PATIENT */,
@@ -11256,8 +11274,8 @@ var CalendarServiceV2 = class extends BaseService {
11256
11274
  */
11257
11275
  async getClinicAppointments(clinicId, startDate, endDate, doctorId, status) {
11258
11276
  const dateRange = {
11259
- start: Timestamp26.fromDate(startDate),
11260
- end: Timestamp26.fromDate(endDate)
11277
+ start: Timestamp27.fromDate(startDate),
11278
+ end: Timestamp27.fromDate(endDate)
11261
11279
  };
11262
11280
  const searchParams = {
11263
11281
  searchLocation: "clinic" /* CLINIC */,
@@ -11511,7 +11529,7 @@ var CalendarServiceV2 = class extends BaseService {
11511
11529
  const newSyncEvent = {
11512
11530
  eventId: result.eventIds[0],
11513
11531
  syncedCalendarProvider: calendar.provider,
11514
- syncedAt: Timestamp26.now()
11532
+ syncedAt: Timestamp27.now()
11515
11533
  };
11516
11534
  await this.updateEventWithSyncId(
11517
11535
  entityType === "doctor" ? appointment.practitionerProfileId : appointment.patientProfileId,
@@ -11550,7 +11568,7 @@ var CalendarServiceV2 = class extends BaseService {
11550
11568
  }
11551
11569
  await updateDoc23(eventRef, {
11552
11570
  syncedCalendarEventId: syncIds,
11553
- updatedAt: serverTimestamp21()
11571
+ updatedAt: serverTimestamp22()
11554
11572
  });
11555
11573
  console.log(
11556
11574
  `Updated event ${eventId} with sync ID ${syncEvent.eventId}`
@@ -11640,8 +11658,8 @@ var CalendarServiceV2 = class extends BaseService {
11640
11658
  const q = query23(
11641
11659
  appointmentsRef,
11642
11660
  where23("practitionerProfileId", "==", doctorId),
11643
- where23("eventTime.start", ">=", Timestamp26.fromDate(startOfDay)),
11644
- where23("eventTime.start", "<=", Timestamp26.fromDate(endOfDay)),
11661
+ where23("eventTime.start", ">=", Timestamp27.fromDate(startOfDay)),
11662
+ where23("eventTime.start", "<=", Timestamp27.fromDate(endOfDay)),
11645
11663
  where23("status", "in", [
11646
11664
  "confirmed" /* CONFIRMED */,
11647
11665
  "pending" /* PENDING */
@@ -11742,7 +11760,7 @@ var CalendarServiceV2 = class extends BaseService {
11742
11760
  fullName: `${sensitiveData.firstName} ${sensitiveData.lastName}`,
11743
11761
  email: sensitiveData.email || "",
11744
11762
  phone: sensitiveData.phoneNumber || null,
11745
- dateOfBirth: sensitiveData.dateOfBirth || Timestamp26.now(),
11763
+ dateOfBirth: sensitiveData.dateOfBirth || Timestamp27.now(),
11746
11764
  gender: sensitiveData.gender || "other" /* OTHER */
11747
11765
  };
11748
11766
  } else if (patientDoc.exists()) {
@@ -11751,7 +11769,7 @@ var CalendarServiceV2 = class extends BaseService {
11751
11769
  fullName: patientDoc.data().displayName,
11752
11770
  email: ((_a = patientDoc.data().contactInfo) == null ? void 0 : _a.email) || "",
11753
11771
  phone: patientDoc.data().phoneNumber || null,
11754
- dateOfBirth: patientDoc.data().dateOfBirth || Timestamp26.now(),
11772
+ dateOfBirth: patientDoc.data().dateOfBirth || Timestamp27.now(),
11755
11773
  gender: patientDoc.data().gender || "other" /* OTHER */
11756
11774
  };
11757
11775
  }
@@ -11783,7 +11801,7 @@ import {
11783
11801
  updateDoc as updateDoc24,
11784
11802
  setDoc as setDoc22,
11785
11803
  deleteDoc as deleteDoc15,
11786
- serverTimestamp as serverTimestamp22,
11804
+ serverTimestamp as serverTimestamp23,
11787
11805
  writeBatch as writeBatch7
11788
11806
  } from "firebase/firestore";
11789
11807
 
@@ -11873,8 +11891,8 @@ var ReviewService = class extends BaseService {
11873
11891
  const docRef = doc25(this.db, REVIEWS_COLLECTION, reviewId);
11874
11892
  await setDoc22(docRef, {
11875
11893
  ...review,
11876
- createdAt: serverTimestamp22(),
11877
- updatedAt: serverTimestamp22()
11894
+ createdAt: serverTimestamp23(),
11895
+ updatedAt: serverTimestamp23()
11878
11896
  });
11879
11897
  const updatePromises = [];
11880
11898
  if (data.clinicReview) {
@@ -12050,7 +12068,7 @@ var ReviewService = class extends BaseService {
12050
12068
  if (currentReviewInfo.totalReviews === 0 && !newReview) {
12051
12069
  await updateDoc24(doc25(this.db, CLINICS_COLLECTION, clinicId), {
12052
12070
  reviewInfo: currentReviewInfo,
12053
- updatedAt: serverTimestamp22()
12071
+ updatedAt: serverTimestamp23()
12054
12072
  });
12055
12073
  return currentReviewInfo;
12056
12074
  }
@@ -12113,7 +12131,7 @@ var ReviewService = class extends BaseService {
12113
12131
  }
12114
12132
  await updateDoc24(doc25(this.db, CLINICS_COLLECTION, clinicId), {
12115
12133
  reviewInfo: updatedReviewInfo,
12116
- updatedAt: serverTimestamp22()
12134
+ updatedAt: serverTimestamp23()
12117
12135
  });
12118
12136
  return updatedReviewInfo;
12119
12137
  }
@@ -12145,7 +12163,7 @@ var ReviewService = class extends BaseService {
12145
12163
  if (currentReviewInfo.totalReviews === 0 && !newReview) {
12146
12164
  await updateDoc24(doc25(this.db, PRACTITIONERS_COLLECTION, practitionerId), {
12147
12165
  reviewInfo: currentReviewInfo,
12148
- updatedAt: serverTimestamp22()
12166
+ updatedAt: serverTimestamp23()
12149
12167
  });
12150
12168
  return currentReviewInfo;
12151
12169
  }
@@ -12208,7 +12226,7 @@ var ReviewService = class extends BaseService {
12208
12226
  }
12209
12227
  await updateDoc24(doc25(this.db, PRACTITIONERS_COLLECTION, practitionerId), {
12210
12228
  reviewInfo: updatedReviewInfo,
12211
- updatedAt: serverTimestamp22()
12229
+ updatedAt: serverTimestamp23()
12212
12230
  });
12213
12231
  await this.updateDoctorInfoInProcedures(
12214
12232
  practitionerId,
@@ -12244,7 +12262,7 @@ var ReviewService = class extends BaseService {
12244
12262
  if (currentReviewInfo.totalReviews === 0 && !newReview) {
12245
12263
  await updateDoc24(doc25(this.db, PROCEDURES_COLLECTION, procedureId), {
12246
12264
  reviewInfo: currentReviewInfo,
12247
- updatedAt: serverTimestamp22()
12265
+ updatedAt: serverTimestamp23()
12248
12266
  });
12249
12267
  return currentReviewInfo;
12250
12268
  }
@@ -12307,7 +12325,7 @@ var ReviewService = class extends BaseService {
12307
12325
  }
12308
12326
  await updateDoc24(doc25(this.db, PROCEDURES_COLLECTION, procedureId), {
12309
12327
  reviewInfo: updatedReviewInfo,
12310
- updatedAt: serverTimestamp22()
12328
+ updatedAt: serverTimestamp23()
12311
12329
  });
12312
12330
  return updatedReviewInfo;
12313
12331
  }
@@ -12330,7 +12348,7 @@ var ReviewService = class extends BaseService {
12330
12348
  const procedureRef = doc25(this.db, PROCEDURES_COLLECTION, docSnapshot.id);
12331
12349
  batch.update(procedureRef, {
12332
12350
  "doctorInfo.rating": rating,
12333
- updatedAt: serverTimestamp22()
12351
+ updatedAt: serverTimestamp23()
12334
12352
  });
12335
12353
  });
12336
12354
  await batch.commit();
@@ -12346,7 +12364,7 @@ var ReviewService = class extends BaseService {
12346
12364
  }
12347
12365
  const batch = writeBatch7(this.db);
12348
12366
  batch.update(doc25(this.db, REVIEWS_COLLECTION, reviewId), {
12349
- updatedAt: serverTimestamp22()
12367
+ updatedAt: serverTimestamp23()
12350
12368
  });
12351
12369
  if (review.clinicReview) {
12352
12370
  review.clinicReview.isVerified = true;
@@ -12395,8 +12413,8 @@ var ReviewService = class extends BaseService {
12395
12413
 
12396
12414
  // src/services/appointment/appointment.service.ts
12397
12415
  import {
12398
- Timestamp as Timestamp29,
12399
- serverTimestamp as serverTimestamp24,
12416
+ Timestamp as Timestamp30,
12417
+ serverTimestamp as serverTimestamp25,
12400
12418
  arrayUnion as arrayUnion8,
12401
12419
  arrayRemove as arrayRemove7,
12402
12420
  where as where26,
@@ -12419,8 +12437,8 @@ import {
12419
12437
  where as where25,
12420
12438
  setDoc as setDoc23,
12421
12439
  updateDoc as updateDoc25,
12422
- serverTimestamp as serverTimestamp23,
12423
- Timestamp as Timestamp28,
12440
+ serverTimestamp as serverTimestamp24,
12441
+ Timestamp as Timestamp29,
12424
12442
  orderBy as orderBy12,
12425
12443
  limit as limit10,
12426
12444
  startAfter as startAfter10
@@ -12482,7 +12500,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
12482
12500
  ...data,
12483
12501
  completedPreRequirements,
12484
12502
  completedPostRequirements,
12485
- updatedAt: serverTimestamp23()
12503
+ updatedAt: serverTimestamp24()
12486
12504
  };
12487
12505
  Object.keys(updateData).forEach((key) => {
12488
12506
  if (updateData[key] === void 0) {
@@ -12491,7 +12509,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
12491
12509
  });
12492
12510
  if (data.status && data.status !== currentAppointment.status) {
12493
12511
  if (data.status === "confirmed" /* CONFIRMED */ && !updateData.confirmationTime) {
12494
- updateData.confirmationTime = Timestamp28.now();
12512
+ updateData.confirmationTime = Timestamp29.now();
12495
12513
  }
12496
12514
  if (currentAppointment.calendarEventId) {
12497
12515
  await updateCalendarEventStatus(
@@ -12542,7 +12560,7 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
12542
12560
  }
12543
12561
  await updateDoc25(calendarEventRef, {
12544
12562
  status: calendarStatus,
12545
- updatedAt: serverTimestamp23()
12563
+ updatedAt: serverTimestamp24()
12546
12564
  });
12547
12565
  } catch (error) {
12548
12566
  console.error(`Error updating calendar event ${calendarEventId}:`, error);
@@ -12579,13 +12597,13 @@ async function searchAppointmentsUtil(db, params) {
12579
12597
  where25(
12580
12598
  "appointmentStartTime",
12581
12599
  ">=",
12582
- Timestamp28.fromDate(params.startDate)
12600
+ Timestamp29.fromDate(params.startDate)
12583
12601
  )
12584
12602
  );
12585
12603
  }
12586
12604
  if (params.endDate) {
12587
12605
  constraints.push(
12588
- where25("appointmentStartTime", "<=", Timestamp28.fromDate(params.endDate))
12606
+ where25("appointmentStartTime", "<=", Timestamp29.fromDate(params.endDate))
12589
12607
  );
12590
12608
  }
12591
12609
  if (params.status) {
@@ -12974,7 +12992,7 @@ var AppointmentService = class extends BaseService {
12974
12992
  );
12975
12993
  const updateData = {
12976
12994
  status: newStatus,
12977
- updatedAt: serverTimestamp24()
12995
+ updatedAt: serverTimestamp25()
12978
12996
  };
12979
12997
  if (newStatus === "canceled_clinic" /* CANCELED_CLINIC */ || newStatus === "canceled_patient" /* CANCELED_PATIENT */ || newStatus === "canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */) {
12980
12998
  if (!(details == null ? void 0 : details.cancellationReason)) {
@@ -12985,13 +13003,13 @@ var AppointmentService = class extends BaseService {
12985
13003
  }
12986
13004
  updateData.cancellationReason = details.cancellationReason;
12987
13005
  updateData.canceledBy = details.canceledBy;
12988
- updateData.cancellationTime = Timestamp29.now();
13006
+ updateData.cancellationTime = Timestamp30.now();
12989
13007
  }
12990
13008
  if (newStatus === "confirmed" /* CONFIRMED */) {
12991
- updateData.confirmationTime = Timestamp29.now();
13009
+ updateData.confirmationTime = Timestamp30.now();
12992
13010
  }
12993
13011
  if (newStatus === "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */) {
12994
- updateData.rescheduleTime = Timestamp29.now();
13012
+ updateData.rescheduleTime = Timestamp30.now();
12995
13013
  }
12996
13014
  return this.updateAppointment(appointmentId, updateData);
12997
13015
  }
@@ -13062,9 +13080,9 @@ var AppointmentService = class extends BaseService {
13062
13080
  status: "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */,
13063
13081
  appointmentStartTime: newStartTime,
13064
13082
  appointmentEndTime: newEndTime,
13065
- rescheduleTime: Timestamp29.now(),
13083
+ rescheduleTime: Timestamp30.now(),
13066
13084
  confirmationTime: null,
13067
- updatedAt: serverTimestamp24()
13085
+ updatedAt: serverTimestamp25()
13068
13086
  };
13069
13087
  return this.updateAppointment(appointmentId, updateData);
13070
13088
  }
@@ -13159,9 +13177,9 @@ var AppointmentService = class extends BaseService {
13159
13177
  }
13160
13178
  const updateData = {
13161
13179
  status: "in_progress" /* IN_PROGRESS */,
13162
- procedureActualStartTime: Timestamp29.now(),
13180
+ procedureActualStartTime: Timestamp30.now(),
13163
13181
  // Set actual start time
13164
- updatedAt: serverTimestamp24()
13182
+ updatedAt: serverTimestamp25()
13165
13183
  };
13166
13184
  return this.updateAppointment(appointmentId, updateData);
13167
13185
  }
@@ -13179,7 +13197,7 @@ var AppointmentService = class extends BaseService {
13179
13197
  if (!appointment)
13180
13198
  throw new Error(`Appointment ${appointmentId} not found.`);
13181
13199
  let calculatedDurationMinutes = actualDurationMinutesInput;
13182
- const procedureCompletionTime = Timestamp29.now();
13200
+ const procedureCompletionTime = Timestamp30.now();
13183
13201
  if (calculatedDurationMinutes === void 0 && appointment.procedureActualStartTime) {
13184
13202
  const startTimeMillis = appointment.procedureActualStartTime.toMillis();
13185
13203
  const endTimeMillis = procedureCompletionTime.toMillis();
@@ -13202,7 +13220,7 @@ var AppointmentService = class extends BaseService {
13202
13220
  },
13203
13221
  // Optionally update appointmentEndTime to the actual completion time
13204
13222
  // appointmentEndTime: procedureCompletionTime,
13205
- updatedAt: serverTimestamp24()
13223
+ updatedAt: serverTimestamp25()
13206
13224
  };
13207
13225
  return this.updateAppointment(appointmentId, updateData);
13208
13226
  }
@@ -13216,7 +13234,7 @@ var AppointmentService = class extends BaseService {
13216
13234
  const appointment = await this.getAppointmentById(appointmentId);
13217
13235
  if (!appointment)
13218
13236
  throw new Error(`Appointment ${appointmentId} not found.`);
13219
- if (Timestamp29.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
13237
+ if (Timestamp30.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
13220
13238
  throw new Error("Cannot mark no-show before appointment start time.");
13221
13239
  }
13222
13240
  return this.updateAppointmentStatus(
@@ -13240,12 +13258,12 @@ var AppointmentService = class extends BaseService {
13240
13258
  const newMediaItem = {
13241
13259
  ...mediaItemData,
13242
13260
  id: this.generateId(),
13243
- uploadedAt: Timestamp29.now(),
13261
+ uploadedAt: Timestamp30.now(),
13244
13262
  uploadedBy: currentUser.uid
13245
13263
  };
13246
13264
  const updateData = {
13247
13265
  media: arrayUnion8(newMediaItem),
13248
- updatedAt: serverTimestamp24()
13266
+ updatedAt: serverTimestamp25()
13249
13267
  };
13250
13268
  return this.updateAppointment(appointmentId, updateData);
13251
13269
  }
@@ -13266,7 +13284,7 @@ var AppointmentService = class extends BaseService {
13266
13284
  }
13267
13285
  const updateData = {
13268
13286
  media: arrayRemove7(mediaToRemove),
13269
- updatedAt: serverTimestamp24()
13287
+ updatedAt: serverTimestamp25()
13270
13288
  };
13271
13289
  return this.updateAppointment(appointmentId, updateData);
13272
13290
  }
@@ -13280,11 +13298,11 @@ var AppointmentService = class extends BaseService {
13280
13298
  const newReviewInfo = {
13281
13299
  ...reviewData,
13282
13300
  reviewId: this.generateId(),
13283
- reviewedAt: Timestamp29.now()
13301
+ reviewedAt: Timestamp30.now()
13284
13302
  };
13285
13303
  const updateData = {
13286
13304
  reviewInfo: newReviewInfo,
13287
- updatedAt: serverTimestamp24()
13305
+ updatedAt: serverTimestamp25()
13288
13306
  };
13289
13307
  return this.updateAppointment(appointmentId, updateData);
13290
13308
  }
@@ -13298,7 +13316,7 @@ var AppointmentService = class extends BaseService {
13298
13316
  const updateData = {
13299
13317
  paymentStatus,
13300
13318
  paymentTransactionId: paymentTransactionId || null,
13301
- updatedAt: serverTimestamp24()
13319
+ updatedAt: serverTimestamp25()
13302
13320
  };
13303
13321
  return this.updateAppointment(appointmentId, updateData);
13304
13322
  }
@@ -13346,7 +13364,7 @@ var AppointmentService = class extends BaseService {
13346
13364
  where26(
13347
13365
  "appointmentStartTime",
13348
13366
  ">=",
13349
- Timestamp29.fromDate(effectiveStartDate)
13367
+ Timestamp30.fromDate(effectiveStartDate)
13350
13368
  )
13351
13369
  );
13352
13370
  if (options == null ? void 0 : options.endDate) {
@@ -13354,7 +13372,7 @@ var AppointmentService = class extends BaseService {
13354
13372
  where26(
13355
13373
  "appointmentStartTime",
13356
13374
  "<=",
13357
- Timestamp29.fromDate(options.endDate)
13375
+ Timestamp30.fromDate(options.endDate)
13358
13376
  )
13359
13377
  );
13360
13378
  }
@@ -13420,7 +13438,7 @@ var AppointmentService = class extends BaseService {
13420
13438
  where26(
13421
13439
  "appointmentStartTime",
13422
13440
  ">=",
13423
- Timestamp29.fromDate(options.startDate)
13441
+ Timestamp30.fromDate(options.startDate)
13424
13442
  )
13425
13443
  );
13426
13444
  }
@@ -13428,7 +13446,7 @@ var AppointmentService = class extends BaseService {
13428
13446
  where26(
13429
13447
  "appointmentStartTime",
13430
13448
  "<=",
13431
- Timestamp29.fromDate(effectiveEndDate)
13449
+ Timestamp30.fromDate(effectiveEndDate)
13432
13450
  )
13433
13451
  );
13434
13452
  constraints.push(orderBy13("appointmentStartTime", "desc"));
@@ -13469,7 +13487,7 @@ import {
13469
13487
  where as where27,
13470
13488
  doc as doc27,
13471
13489
  updateDoc as updateDoc26,
13472
- Timestamp as Timestamp30,
13490
+ Timestamp as Timestamp31,
13473
13491
  orderBy as orderBy14,
13474
13492
  limit as limit12,
13475
13493
  startAfter as startAfter12,
@@ -13628,7 +13646,7 @@ var PatientRequirementsService = class extends BaseService {
13628
13646
  `Instruction ${instructionId} is in status ${instructionToUpdate.status} and cannot be marked as completed.`
13629
13647
  );
13630
13648
  }
13631
- const now = Timestamp30.now();
13649
+ const now = Timestamp31.now();
13632
13650
  const updatedInstructions = [...instance.instructions];
13633
13651
  updatedInstructions[instructionIndex] = {
13634
13652
  ...instructionToUpdate,