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