@bizmap/sdk 0.0.60 → 0.0.62
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/main.d.ts +100 -125
- package/dist/main.js +135 -134
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -206,7 +206,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
206
206
|
}, z.core.$strip>>;
|
|
207
207
|
offeredServices: z.ZodObject<{
|
|
208
208
|
deployed: z.ZodBoolean;
|
|
209
|
-
value: z.ZodRecord<z.
|
|
209
|
+
value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
210
210
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
211
211
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
212
212
|
currency: z.ZodEnum<{
|
|
@@ -361,7 +361,7 @@ declare const MutableCompanyDetails: z.ZodObject<{
|
|
|
361
361
|
}, z.core.$strip>>>;
|
|
362
362
|
offeredServices: z.ZodOptional<z.ZodObject<{
|
|
363
363
|
deployed: z.ZodBoolean;
|
|
364
|
-
value: z.ZodRecord<z.
|
|
364
|
+
value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
365
365
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
366
366
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
367
367
|
currency: z.ZodEnum<{
|
|
@@ -454,7 +454,7 @@ declare const CompanyBilling: z.ZodObject<{
|
|
|
454
454
|
}, z.core.$strip>>;
|
|
455
455
|
offeredServices: z.ZodObject<{
|
|
456
456
|
deployed: z.ZodBoolean;
|
|
457
|
-
value: z.ZodRecord<z.
|
|
457
|
+
value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
458
458
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
459
459
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
460
460
|
currency: z.ZodEnum<{
|
|
@@ -525,7 +525,7 @@ declare const MutableCompanyBilling: z.ZodObject<{
|
|
|
525
525
|
}, z.core.$strip>>;
|
|
526
526
|
offeredServices: z.ZodObject<{
|
|
527
527
|
deployed: z.ZodBoolean;
|
|
528
|
-
value: z.ZodRecord<z.
|
|
528
|
+
value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
529
529
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
530
530
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
531
531
|
currency: z.ZodEnum<{
|
|
@@ -633,8 +633,7 @@ declare const MutableCompanyPreferences: z.ZodObject<{
|
|
|
633
633
|
}, z.core.$strip>;
|
|
634
634
|
type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
|
|
635
635
|
|
|
636
|
-
declare const CompanyStaff: z.
|
|
637
|
-
uid: z.ZodUUID;
|
|
636
|
+
declare const CompanyStaff: z.ZodObject<{
|
|
638
637
|
members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
639
638
|
uid: z.ZodUUID;
|
|
640
639
|
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
@@ -663,6 +662,7 @@ declare const CompanyStaff: z.ZodPipe<z.ZodObject<{
|
|
|
663
662
|
email: z.ZodEmail;
|
|
664
663
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
665
664
|
}, z.core.$strip>>;
|
|
665
|
+
uid: z.ZodUUID;
|
|
666
666
|
partnerMap: z.ZodRecord<z.ZodUUID, z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
667
667
|
addedAt: z.ZodInt;
|
|
668
668
|
}, z.core.$strip>>>;
|
|
@@ -686,75 +686,7 @@ declare const CompanyStaff: z.ZodPipe<z.ZodObject<{
|
|
|
686
686
|
inviteAccepted: z.ZodNullable<z.ZodInt>;
|
|
687
687
|
}, z.core.$strip>>;
|
|
688
688
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
689
|
-
}, z.core.$strip
|
|
690
|
-
uid: string;
|
|
691
|
-
members: Record<string, {
|
|
692
|
-
uid: string;
|
|
693
|
-
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
694
|
-
isAvailable: boolean;
|
|
695
|
-
isBusy: boolean;
|
|
696
|
-
status: "inviteSent" | "active" | "inactive";
|
|
697
|
-
appointments: Record<"ongoing" | "completed", number>;
|
|
698
|
-
lastActive: number | null;
|
|
699
|
-
isAvailableLastModified: number | null;
|
|
700
|
-
isBusyLastModified: number | null;
|
|
701
|
-
name: Record<"first" | "last", string>;
|
|
702
|
-
email: string;
|
|
703
|
-
photoUrl?: string | null | undefined;
|
|
704
|
-
phoneNumber?: string | undefined;
|
|
705
|
-
}>;
|
|
706
|
-
partnerMap: Record<string, Record<string, {
|
|
707
|
-
addedAt: number;
|
|
708
|
-
}>>;
|
|
709
|
-
updateQueue: Record<string, {
|
|
710
|
-
$REMOVE?: {
|
|
711
|
-
addedAt: number;
|
|
712
|
-
} | undefined;
|
|
713
|
-
$CHANGE_ROLES?: {
|
|
714
|
-
newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
715
|
-
addedAt: number;
|
|
716
|
-
} | undefined;
|
|
717
|
-
}>;
|
|
718
|
-
timeline: Record<string, {
|
|
719
|
-
inviteSent: number | null;
|
|
720
|
-
inviteAccepted: number | null;
|
|
721
|
-
}>;
|
|
722
|
-
lastModified: number | null;
|
|
723
|
-
}, {
|
|
724
|
-
uid: string;
|
|
725
|
-
members: Record<string, {
|
|
726
|
-
uid: string;
|
|
727
|
-
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
728
|
-
isAvailable: boolean;
|
|
729
|
-
isBusy: boolean;
|
|
730
|
-
status: "inviteSent" | "active" | "inactive";
|
|
731
|
-
appointments: Record<"ongoing" | "completed", number>;
|
|
732
|
-
lastActive: number | null;
|
|
733
|
-
isAvailableLastModified: number | null;
|
|
734
|
-
isBusyLastModified: number | null;
|
|
735
|
-
name: Record<"first" | "last", string>;
|
|
736
|
-
email: string;
|
|
737
|
-
photoUrl?: string | null | undefined;
|
|
738
|
-
phoneNumber?: string | undefined;
|
|
739
|
-
}>;
|
|
740
|
-
partnerMap: Record<string, Record<string, {
|
|
741
|
-
addedAt: number;
|
|
742
|
-
}>>;
|
|
743
|
-
updateQueue: Record<string, {
|
|
744
|
-
$REMOVE?: {
|
|
745
|
-
addedAt: number;
|
|
746
|
-
} | undefined;
|
|
747
|
-
$CHANGE_ROLES?: {
|
|
748
|
-
newRoles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
749
|
-
addedAt: number;
|
|
750
|
-
} | undefined;
|
|
751
|
-
}>;
|
|
752
|
-
timeline: Record<string, {
|
|
753
|
-
inviteSent: number | null;
|
|
754
|
-
inviteAccepted: number | null;
|
|
755
|
-
}>;
|
|
756
|
-
lastModified: number | null;
|
|
757
|
-
}>>;
|
|
689
|
+
}, z.core.$strip>;
|
|
758
690
|
type CompanyStaff = z.infer<typeof CompanyStaff>;
|
|
759
691
|
|
|
760
692
|
/** Can only be modifiede by the server */
|
|
@@ -780,6 +712,28 @@ declare const CompanyState: z.ZodObject<{
|
|
|
780
712
|
}, z.core.$strip>;
|
|
781
713
|
type CompanyState = z.infer<typeof CompanyState>;
|
|
782
714
|
|
|
715
|
+
declare const MiniCompanyUser: z.ZodObject<{
|
|
716
|
+
uid: z.ZodUUID;
|
|
717
|
+
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
718
|
+
doc: "doc";
|
|
719
|
+
physAsst: "physAsst";
|
|
720
|
+
rcpst: "rcpst";
|
|
721
|
+
cshr: "cshr";
|
|
722
|
+
admin: "admin";
|
|
723
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
724
|
+
isAvailable: z.ZodBoolean;
|
|
725
|
+
isBusy: z.ZodBoolean;
|
|
726
|
+
status: z.ZodEnum<{
|
|
727
|
+
inviteSent: "inviteSent";
|
|
728
|
+
active: "active";
|
|
729
|
+
inactive: "inactive";
|
|
730
|
+
}>;
|
|
731
|
+
appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
|
|
732
|
+
lastActive: z.ZodNullable<z.ZodInt>;
|
|
733
|
+
isAvailableLastModified: z.ZodNullable<z.ZodInt>;
|
|
734
|
+
isBusyLastModified: z.ZodNullable<z.ZodInt>;
|
|
735
|
+
}, z.core.$strip>;
|
|
736
|
+
type MiniCompanyUser = z.infer<typeof MiniCompanyUser>;
|
|
783
737
|
declare const CompanyUser: z.ZodObject<{
|
|
784
738
|
uid: z.ZodUUID;
|
|
785
739
|
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
@@ -872,22 +826,21 @@ declare const ClientIdentity: z.ZodObject<{
|
|
|
872
826
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
873
827
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
874
828
|
uid: z.ZodUUID;
|
|
875
|
-
email: z.
|
|
876
|
-
address: z.ZodOptional<z.ZodObject<{
|
|
877
|
-
streetAddress: z.ZodString;
|
|
878
|
-
city: z.ZodOptional<z.ZodString>;
|
|
879
|
-
parish: z.ZodString;
|
|
880
|
-
country: z.ZodString;
|
|
881
|
-
}, z.core.$strip>>;
|
|
829
|
+
email: z.ZodEmail;
|
|
882
830
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
883
831
|
name: z.ZodRecord<z.ZodEnum<{
|
|
884
832
|
first: "first";
|
|
885
833
|
last: "last";
|
|
886
834
|
}>, z.ZodString>;
|
|
887
835
|
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
836
|
+
linked: z.ZodBoolean;
|
|
888
837
|
dob: z.ZodOptional<z.ZodInt>;
|
|
889
|
-
|
|
890
|
-
|
|
838
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
839
|
+
streetAddress: z.ZodString;
|
|
840
|
+
city: z.ZodOptional<z.ZodString>;
|
|
841
|
+
parish: z.ZodString;
|
|
842
|
+
country: z.ZodString;
|
|
843
|
+
}, z.core.$strip>>;
|
|
891
844
|
}, z.core.$strip>;
|
|
892
845
|
type ClientIdentity = z.infer<typeof ClientIdentity>;
|
|
893
846
|
|
|
@@ -989,14 +942,7 @@ declare const UserDetails: z.ZodObject<{
|
|
|
989
942
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
990
943
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
991
944
|
uid: z.ZodUUID;
|
|
992
|
-
email: z.
|
|
993
|
-
dob: z.ZodOptional<z.ZodInt>;
|
|
994
|
-
address: z.ZodOptional<z.ZodObject<{
|
|
995
|
-
streetAddress: z.ZodString;
|
|
996
|
-
city: z.ZodOptional<z.ZodString>;
|
|
997
|
-
parish: z.ZodString;
|
|
998
|
-
country: z.ZodString;
|
|
999
|
-
}, z.core.$strip>>;
|
|
945
|
+
email: z.ZodEmail;
|
|
1000
946
|
publicKey: z.ZodNullable<z.ZodString>;
|
|
1001
947
|
notifications: z.ZodArray<z.ZodObject<{
|
|
1002
948
|
code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE" | "ALERT">;
|
|
@@ -1009,7 +955,7 @@ declare const UserDetails: z.ZodObject<{
|
|
|
1009
955
|
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
1010
956
|
createdAt: z.ZodInt;
|
|
1011
957
|
}, z.core.$strip>>;
|
|
1012
|
-
|
|
958
|
+
linked: z.ZodBoolean;
|
|
1013
959
|
name: z.ZodRecord<z.ZodEnum<{
|
|
1014
960
|
first: "first";
|
|
1015
961
|
last: "last";
|
|
@@ -1339,22 +1285,21 @@ declare const AppointmentDetails: z.ZodObject<{
|
|
|
1339
1285
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
1340
1286
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
1341
1287
|
uid: z.ZodUUID;
|
|
1342
|
-
email: z.
|
|
1343
|
-
address: z.ZodOptional<z.ZodObject<{
|
|
1344
|
-
streetAddress: z.ZodString;
|
|
1345
|
-
city: z.ZodOptional<z.ZodString>;
|
|
1346
|
-
parish: z.ZodString;
|
|
1347
|
-
country: z.ZodString;
|
|
1348
|
-
}, z.core.$strip>>;
|
|
1288
|
+
email: z.ZodEmail;
|
|
1349
1289
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
1350
1290
|
name: z.ZodRecord<z.ZodEnum<{
|
|
1351
1291
|
first: "first";
|
|
1352
1292
|
last: "last";
|
|
1353
1293
|
}>, z.ZodString>;
|
|
1354
1294
|
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1295
|
+
linked: z.ZodBoolean;
|
|
1355
1296
|
dob: z.ZodOptional<z.ZodInt>;
|
|
1356
|
-
|
|
1357
|
-
|
|
1297
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
1298
|
+
streetAddress: z.ZodString;
|
|
1299
|
+
city: z.ZodOptional<z.ZodString>;
|
|
1300
|
+
parish: z.ZodString;
|
|
1301
|
+
country: z.ZodString;
|
|
1302
|
+
}, z.core.$strip>>;
|
|
1358
1303
|
}, z.core.$strip>;
|
|
1359
1304
|
}, z.core.$strip>;
|
|
1360
1305
|
type AppointmentDetails = z.infer<typeof AppointmentDetails>;
|
|
@@ -1509,22 +1454,21 @@ declare const MutableAppointmentDetails: z.ZodObject<{
|
|
|
1509
1454
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
1510
1455
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
1511
1456
|
uid: z.ZodUUID;
|
|
1512
|
-
email: z.
|
|
1513
|
-
address: z.ZodOptional<z.ZodObject<{
|
|
1514
|
-
streetAddress: z.ZodString;
|
|
1515
|
-
city: z.ZodOptional<z.ZodString>;
|
|
1516
|
-
parish: z.ZodString;
|
|
1517
|
-
country: z.ZodString;
|
|
1518
|
-
}, z.core.$strip>>;
|
|
1457
|
+
email: z.ZodEmail;
|
|
1519
1458
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
1520
1459
|
name: z.ZodRecord<z.ZodEnum<{
|
|
1521
1460
|
first: "first";
|
|
1522
1461
|
last: "last";
|
|
1523
1462
|
}>, z.ZodString>;
|
|
1524
1463
|
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1464
|
+
linked: z.ZodBoolean;
|
|
1525
1465
|
dob: z.ZodOptional<z.ZodInt>;
|
|
1526
|
-
|
|
1527
|
-
|
|
1466
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
1467
|
+
streetAddress: z.ZodString;
|
|
1468
|
+
city: z.ZodOptional<z.ZodString>;
|
|
1469
|
+
parish: z.ZodString;
|
|
1470
|
+
country: z.ZodString;
|
|
1471
|
+
}, z.core.$strip>>;
|
|
1528
1472
|
}, z.core.$strip>;
|
|
1529
1473
|
_hash: z.ZodString;
|
|
1530
1474
|
}, z.core.$strip>;
|
|
@@ -1577,7 +1521,7 @@ declare const ScheduleAppointmentForm: z.ZodObject<{
|
|
|
1577
1521
|
}, z.core.$strip>;
|
|
1578
1522
|
type ScheduleAppointmentForm = z.infer<typeof ScheduleAppointmentForm>;
|
|
1579
1523
|
|
|
1580
|
-
|
|
1524
|
+
type RequestParameter = {
|
|
1581
1525
|
form: ScheduleAppointmentForm;
|
|
1582
1526
|
sender: UserDetails;
|
|
1583
1527
|
billing: SafeOmit<CompanyBilling, "uid" | "prepayments" | "lastModified">;
|
|
@@ -1590,7 +1534,12 @@ declare function scheduleAppointment(request: {
|
|
|
1590
1534
|
options?: Partial<{
|
|
1591
1535
|
ignoreBalanceCheck: boolean;
|
|
1592
1536
|
}>;
|
|
1593
|
-
}
|
|
1537
|
+
};
|
|
1538
|
+
/**
|
|
1539
|
+
* @param {RequestParameter} request
|
|
1540
|
+
* @returns {Promise<{updates: {state:CompanyState, staffDetails: CompanyStaff}, appointment: AppointmentDetails}>}
|
|
1541
|
+
* */
|
|
1542
|
+
declare function scheduleAppointment(request: RequestParameter): Promise<{
|
|
1594
1543
|
updates: {
|
|
1595
1544
|
state: {
|
|
1596
1545
|
uid: string;
|
|
@@ -1613,7 +1562,6 @@ declare function scheduleAppointment(request: {
|
|
|
1613
1562
|
createdAt: number;
|
|
1614
1563
|
};
|
|
1615
1564
|
staffDetails: {
|
|
1616
|
-
uid: string;
|
|
1617
1565
|
members: Record<string, {
|
|
1618
1566
|
uid: string;
|
|
1619
1567
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
@@ -1629,6 +1577,7 @@ declare function scheduleAppointment(request: {
|
|
|
1629
1577
|
photoUrl?: string | null | undefined;
|
|
1630
1578
|
phoneNumber?: string | undefined;
|
|
1631
1579
|
}>;
|
|
1580
|
+
uid: string;
|
|
1632
1581
|
partnerMap: Record<string, Record<string, {
|
|
1633
1582
|
addedAt: number;
|
|
1634
1583
|
}>>;
|
|
@@ -1714,20 +1663,19 @@ declare function scheduleAppointment(request: {
|
|
|
1714
1663
|
client: {
|
|
1715
1664
|
createdAt: number;
|
|
1716
1665
|
uid: string;
|
|
1666
|
+
email: string;
|
|
1717
1667
|
name: Record<"first" | "last", string>;
|
|
1718
|
-
|
|
1719
|
-
activated: boolean;
|
|
1668
|
+
linked: boolean;
|
|
1720
1669
|
lastModified?: number | null | undefined;
|
|
1721
|
-
|
|
1670
|
+
phoneNumber?: string | undefined;
|
|
1671
|
+
photoUrl?: string | null | undefined;
|
|
1672
|
+
dob?: number | undefined;
|
|
1722
1673
|
address?: {
|
|
1723
1674
|
streetAddress: string;
|
|
1724
1675
|
parish: string;
|
|
1725
1676
|
country: string;
|
|
1726
1677
|
city?: string | undefined;
|
|
1727
1678
|
} | undefined;
|
|
1728
|
-
phoneNumber?: string | undefined;
|
|
1729
|
-
photoUrl?: string | null | undefined;
|
|
1730
|
-
dob?: number | undefined;
|
|
1731
1679
|
};
|
|
1732
1680
|
_hash: string;
|
|
1733
1681
|
lastModified?: number | null | undefined;
|
|
@@ -1780,12 +1728,26 @@ declare function scheduleAppointment(request: {
|
|
|
1780
1728
|
};
|
|
1781
1729
|
}>;
|
|
1782
1730
|
|
|
1731
|
+
/**
|
|
1732
|
+
* @param {CompanyUserRole} role The role used to filter the staff members
|
|
1733
|
+
* @param {CompanyStaff} staff The staff object to query
|
|
1734
|
+
* @returns {string[]} The uids of the available staff members
|
|
1735
|
+
*/
|
|
1783
1736
|
declare function findAvailableStaff(role: CompanyUserRole, staff: CompanyStaff): string[];
|
|
1784
1737
|
|
|
1738
|
+
/**
|
|
1739
|
+
* @param {string[]} userUids The uids of the members we should query
|
|
1740
|
+
* @param {CompanyPreferences["apptDistAlg"]} algorithm The algorithm we should use to find the staff
|
|
1741
|
+
* @param {CompanyStaff} staff
|
|
1742
|
+
* @returns {string|null}
|
|
1743
|
+
*/
|
|
1785
1744
|
declare function findNextAvailableStaff(userUids: string[], algorithm: CompanyPreferences["apptDistAlg"], staff: CompanyStaff): string | null;
|
|
1786
1745
|
|
|
1787
|
-
|
|
1788
|
-
|
|
1746
|
+
/**
|
|
1747
|
+
* @param {...CompanyUser|MiniCompanyUser} partners
|
|
1748
|
+
* @returns {(CompanyUser|MiniCompanyUser)[]|null} an array of the users that have conflicting roles or roles that are
|
|
1749
|
+
* incompatible with the other partners, or null if none was found. */
|
|
1750
|
+
declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyUser)[]) => ({
|
|
1789
1751
|
uid: string;
|
|
1790
1752
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
1791
1753
|
isAvailable: boolean;
|
|
@@ -1799,8 +1761,21 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
|
|
|
1799
1761
|
email: string;
|
|
1800
1762
|
photoUrl?: string | null | undefined;
|
|
1801
1763
|
phoneNumber?: string | undefined;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1764
|
+
} | {
|
|
1765
|
+
uid: string;
|
|
1766
|
+
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
1767
|
+
isAvailable: boolean;
|
|
1768
|
+
isBusy: boolean;
|
|
1769
|
+
status: "inviteSent" | "active" | "inactive";
|
|
1770
|
+
appointments: Record<"ongoing" | "completed", number>;
|
|
1771
|
+
lastActive: number | null;
|
|
1772
|
+
isAvailableLastModified: number | null;
|
|
1773
|
+
isBusyLastModified: number | null;
|
|
1774
|
+
})[] | null;
|
|
1775
|
+
/**
|
|
1776
|
+
* @param {CompanyUserRole} role
|
|
1777
|
+
* @returns {CompanyUserRole[]} The roles that are compatible with the selected role.
|
|
1778
|
+
* */
|
|
1804
1779
|
declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
|
|
1805
1780
|
|
|
1806
|
-
export { AppointmentDetails, type AppointmentDistAlg, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CreditCurrency, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, UserDetails, Vitals, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
|
|
1781
|
+
export { AppointmentDetails, type AppointmentDistAlg, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CreditCurrency, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, UserDetails, Vitals, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
|
package/dist/main.js
CHANGED
|
@@ -151,7 +151,9 @@ var CompanyBilling = z8.object({
|
|
|
151
151
|
offeredServices: z8.object({
|
|
152
152
|
/** Forces service selectors to use the list of service(s) that you've created. */
|
|
153
153
|
deployed: z8.boolean(),
|
|
154
|
-
|
|
154
|
+
// An object is used instead of an array so that updates to a particular service is accurate
|
|
155
|
+
// and consistent.
|
|
156
|
+
value: z8.record(z8.uuidv4(), PriceTag.omit({ uid: true }))
|
|
155
157
|
}).superRefine((data, ctx) => {
|
|
156
158
|
const services = Object.entries(data.value);
|
|
157
159
|
if (services.length > 150) {
|
|
@@ -164,13 +166,6 @@ var CompanyBilling = z8.object({
|
|
|
164
166
|
"You must create at least (1) service in order to deploy your service list."
|
|
165
167
|
);
|
|
166
168
|
}
|
|
167
|
-
for (const [key, value] of services) {
|
|
168
|
-
if (key !== value.createdAt.toString()) {
|
|
169
|
-
ctx.addIssue(
|
|
170
|
-
`The key for every service must be the same its correlating "createdAt" timestamp.`
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
169
|
}),
|
|
175
170
|
lastModified: Timestamp.nullable()
|
|
176
171
|
});
|
|
@@ -322,27 +317,17 @@ import { UserModel as UserModel2 } from "@wavy/util";
|
|
|
322
317
|
import * as z14 from "zod";
|
|
323
318
|
|
|
324
319
|
// src/schemas/User.ts
|
|
325
|
-
import {
|
|
320
|
+
import { UserModel } from "@wavy/util";
|
|
326
321
|
import * as z13 from "zod";
|
|
327
322
|
var UserDetails = z13.object({
|
|
328
323
|
...UserModel.shape,
|
|
329
324
|
uid: z13.uuidv4(),
|
|
330
|
-
email: UserModel.shape.email
|
|
331
|
-
dob: Timestamp.optional(),
|
|
332
|
-
address: Address2.optional(),
|
|
325
|
+
email: UserModel.shape.email,
|
|
333
326
|
publicKey: z13.string().nullable(),
|
|
334
327
|
notifications: z13.array(Notification),
|
|
335
|
-
|
|
328
|
+
/** Only true when linked to a client */
|
|
329
|
+
linked: z13.boolean(),
|
|
336
330
|
...TimeLog.shape
|
|
337
|
-
}).superRefine((data, ctx) => {
|
|
338
|
-
if (data.activated && data.publicKey === null) {
|
|
339
|
-
ctx.addIssue("An activated user must have a valid public key.");
|
|
340
|
-
} else if (!data.activated && data.publicKey !== null) {
|
|
341
|
-
ctx.addIssue("An inactive user can't have a public key.");
|
|
342
|
-
}
|
|
343
|
-
if (data.activated && !data.email) {
|
|
344
|
-
ctx.addIssue("An activated user must have a valid email.");
|
|
345
|
-
}
|
|
346
331
|
});
|
|
347
332
|
|
|
348
333
|
// src/functions/helper-functions.ts
|
|
@@ -377,8 +362,7 @@ var getCompatibleRoles = (role) => {
|
|
|
377
362
|
};
|
|
378
363
|
|
|
379
364
|
// src/schemas/company/components/User.ts
|
|
380
|
-
var
|
|
381
|
-
...UserModel2.shape,
|
|
365
|
+
var MiniCompanyUser2 = z14.object({
|
|
382
366
|
uid: UserDetails.shape.uid,
|
|
383
367
|
roles: z14.array(companyUserRoles).transform((roles) => {
|
|
384
368
|
const newRoles = [];
|
|
@@ -408,27 +392,24 @@ var CompanyUser = z14.object({
|
|
|
408
392
|
);
|
|
409
393
|
}
|
|
410
394
|
});
|
|
395
|
+
var CompanyUser = z14.object({
|
|
396
|
+
...UserModel2.shape,
|
|
397
|
+
...MiniCompanyUser2.shape
|
|
398
|
+
});
|
|
411
399
|
|
|
412
400
|
// src/schemas/company/components/Staff.ts
|
|
413
|
-
var
|
|
414
|
-
uid
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
ctx.addIssue(
|
|
420
|
-
`User found with a uid that doesn't match their respective key. (${uid} !== ${user.uid}).`
|
|
421
|
-
);
|
|
422
|
-
}
|
|
423
|
-
if (!!user.email && emails.includes(user.email.toLowerCase())) {
|
|
424
|
-
ctx.addIssue(
|
|
425
|
-
`Having multiple members with the same email is prohibited. (${user.email})`
|
|
426
|
-
);
|
|
427
|
-
} else if (!!user.email) {
|
|
428
|
-
emails.push(user.email.toLowerCase());
|
|
429
|
-
}
|
|
401
|
+
var refineMembers = (data, ctx) => {
|
|
402
|
+
for (const [uid, user] of Object.entries(data)) {
|
|
403
|
+
if (uid !== user.uid) {
|
|
404
|
+
ctx.addIssue(
|
|
405
|
+
`User found with a uid that doesn't match their respective key. (${uid} !== ${user.uid}).`
|
|
406
|
+
);
|
|
430
407
|
}
|
|
431
|
-
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
var MiniRawCompanyStaff = z15.object({
|
|
411
|
+
uid: CompanyState.shape.uid,
|
|
412
|
+
members: z15.record(MiniCompanyUser2.shape.uid, MiniCompanyUser2).superRefine(refineMembers),
|
|
432
413
|
/**
|
|
433
414
|
* @relationship one -> many
|
|
434
415
|
*@description A map of doctor `uids` to their assistants `uids` */
|
|
@@ -455,60 +436,68 @@ var RawCompanyStaff = z15.object({
|
|
|
455
436
|
),
|
|
456
437
|
lastModified: Timestamp.nullable()
|
|
457
438
|
});
|
|
458
|
-
var
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
439
|
+
var RawCompanyStaff = z15.object({
|
|
440
|
+
...MiniRawCompanyStaff.shape,
|
|
441
|
+
members: z15.record(CompanyUser.shape.uid, CompanyUser).superRefine(refineMembers)
|
|
442
|
+
});
|
|
443
|
+
var transformStaff = (object16) => {
|
|
444
|
+
return object16.transform((d) => {
|
|
445
|
+
const copy = structuredClone(d);
|
|
446
|
+
for (const uid of Object.keys(copy.updateQueue)) {
|
|
447
|
+
if (uid in copy.members) {
|
|
448
|
+
const userUpdates = copy.updateQueue[uid];
|
|
449
|
+
if ("$REMOVE" in userUpdates) {
|
|
450
|
+
copy.updateQueue[uid] = { $REMOVE: userUpdates.$REMOVE };
|
|
451
|
+
} else if (userUpdates.$CHANGE_ROLES && userUpdates.$CHANGE_ROLES.newRoles.length === copy.members[uid].roles.length && userUpdates.$CHANGE_ROLES.newRoles.every(
|
|
452
|
+
(role) => copy.members[uid].roles.includes(role)
|
|
453
|
+
)) {
|
|
454
|
+
delete copy.updateQueue[uid].$CHANGE_ROLES;
|
|
455
|
+
}
|
|
456
|
+
if (Object.keys(userUpdates).length < 1) delete copy.updateQueue[uid];
|
|
457
|
+
} else {
|
|
458
|
+
delete copy.updateQueue[uid];
|
|
469
459
|
}
|
|
470
|
-
if (Object.keys(userUpdates).length < 1) delete copy.updateQueue[uid];
|
|
471
|
-
} else {
|
|
472
|
-
delete copy.updateQueue[uid];
|
|
473
460
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
461
|
+
for (const [docUid, assts] of Object.entries(copy.partnerMap)) {
|
|
462
|
+
if (docUid in d.members) {
|
|
463
|
+
for (const asstUid of Object.keys(assts)) {
|
|
464
|
+
if (asstUid in d.members) continue;
|
|
465
|
+
delete copy.partnerMap[docUid][asstUid];
|
|
466
|
+
}
|
|
467
|
+
} else {
|
|
468
|
+
delete copy.partnerMap[docUid];
|
|
480
469
|
}
|
|
481
|
-
} else {
|
|
482
|
-
delete copy.partnerMap[docUid];
|
|
483
470
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
471
|
+
return copy;
|
|
472
|
+
}).superRefine((details, ctx) => {
|
|
473
|
+
for (const user of Object.values(details.members)) {
|
|
474
|
+
if (user.roles.includes("doc") && user.uid in details.partnerMap) {
|
|
475
|
+
for (const asstUid of Object.keys(details.partnerMap[user.uid])) {
|
|
476
|
+
if (!details.members[asstUid].roles.includes("physAsst")) {
|
|
477
|
+
ctx.addIssue(
|
|
478
|
+
`A partner group member must have the "physAsst" role (${user.uid}) -> (${asstUid}).`
|
|
479
|
+
);
|
|
480
|
+
}
|
|
494
481
|
}
|
|
482
|
+
} else if (user.uid in details.partnerMap) {
|
|
483
|
+
ctx.addIssue(
|
|
484
|
+
`A partner group leader must have the "doc" role. (${user.uid})`
|
|
485
|
+
);
|
|
486
|
+
} else if (user.roles.includes("doc")) {
|
|
487
|
+
ctx.addIssue(
|
|
488
|
+
`All users that have the "doc" role must be the leader of a partner group. (${user.uid})`
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
if (!user.isBusy && user.uid in details.updateQueue) {
|
|
492
|
+
ctx.addIssue(
|
|
493
|
+
`Having users that aren't busy in the update queue is prohibited.`
|
|
494
|
+
);
|
|
495
495
|
}
|
|
496
|
-
} else if (user.uid in details.partnerMap) {
|
|
497
|
-
ctx.addIssue(
|
|
498
|
-
`A partner group leader must have the "doc" role. (${user.uid})`
|
|
499
|
-
);
|
|
500
|
-
} else if (user.roles.includes("doc")) {
|
|
501
|
-
ctx.addIssue(
|
|
502
|
-
`All users that have the "doc" role must be the leader of a partner group. (${user.uid})`
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
if (!user.isBusy && user.uid in details.updateQueue) {
|
|
506
|
-
ctx.addIssue(
|
|
507
|
-
`Having users that aren't busy in the update queue is prohibited.`
|
|
508
|
-
);
|
|
509
496
|
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
497
|
+
});
|
|
498
|
+
};
|
|
499
|
+
var CompanyStaff = transformStaff(RawCompanyStaff);
|
|
500
|
+
var MiniCompanyStaff = transformStaff(MiniRawCompanyStaff);
|
|
512
501
|
var MutableCompanyStaff = RawCompanyStaff.pick({
|
|
513
502
|
updateQueue: true,
|
|
514
503
|
partnerMap: true
|
|
@@ -544,58 +533,68 @@ var CompanyInviteList = z17.record(
|
|
|
544
533
|
);
|
|
545
534
|
|
|
546
535
|
// src/schemas/appointment/components/Client.ts
|
|
547
|
-
|
|
536
|
+
import * as z18 from "zod";
|
|
537
|
+
import { Address as Address2 } from "@wavy/util";
|
|
538
|
+
var ClientIdentity = UserDetails.omit({
|
|
539
|
+
notifications: true,
|
|
540
|
+
publicKey: true
|
|
541
|
+
}).safeExtend(
|
|
542
|
+
z18.object({
|
|
543
|
+
dob: Timestamp.optional(),
|
|
544
|
+
address: Address2.optional()
|
|
545
|
+
}).shape
|
|
546
|
+
);
|
|
548
547
|
|
|
549
548
|
// src/schemas/appointment/components/payload/Medical.ts
|
|
550
|
-
import * as
|
|
551
|
-
var Vitals =
|
|
549
|
+
import * as z19 from "zod";
|
|
550
|
+
var Vitals = z19.record(
|
|
552
551
|
vitalKeys,
|
|
553
|
-
|
|
554
|
-
value:
|
|
552
|
+
z19.object({
|
|
553
|
+
value: z19.string().trim().regex(/^\d{0,3}((\/|\.)\d{1,3})?/),
|
|
555
554
|
lastModified: Timestamp.nullable()
|
|
556
555
|
})
|
|
557
556
|
);
|
|
558
|
-
var Medicine =
|
|
559
|
-
brand:
|
|
557
|
+
var Medicine = z19.object({
|
|
558
|
+
brand: z19.string().trim(),
|
|
560
559
|
expiresAt: Timestamp.nullish(),
|
|
561
|
-
quantity:
|
|
560
|
+
quantity: z19.string().trim().regex(/^\d+(\.\d{1,3})? ?[a-zA-Z]{1,20}/, {
|
|
562
561
|
error: "Failed to match the pattern <number>+(.<number>{1,3})? ?[a-zA-Z]{1,20}"
|
|
563
562
|
}),
|
|
564
|
-
refills:
|
|
565
|
-
directions:
|
|
563
|
+
refills: z19.string().trim().regex(/^[0-8]/, { error: "Must be between 0 and 8" }),
|
|
564
|
+
directions: z19.string().trim().max(100, { error: "Must be 100 characters or less" }),
|
|
566
565
|
...TimeLog.shape
|
|
567
566
|
});
|
|
568
|
-
var MedicalDetails =
|
|
567
|
+
var MedicalDetails = z19.object({
|
|
569
568
|
vitals: Vitals,
|
|
570
|
-
prescriptions:
|
|
571
|
-
doctorNote:
|
|
572
|
-
value:
|
|
569
|
+
prescriptions: z19.array(z19.array(Medicine)).nullish(),
|
|
570
|
+
doctorNote: z19.object({
|
|
571
|
+
value: z19.string(),
|
|
573
572
|
lastModified: Timestamp.nullable()
|
|
574
573
|
}),
|
|
575
|
-
physAsstNotes:
|
|
576
|
-
|
|
577
|
-
title:
|
|
578
|
-
content:
|
|
574
|
+
physAsstNotes: z19.array(
|
|
575
|
+
z19.object({
|
|
576
|
+
title: z19.string(),
|
|
577
|
+
content: z19.string(),
|
|
579
578
|
...TimeLog.shape
|
|
580
579
|
})
|
|
581
580
|
).optional()
|
|
582
581
|
});
|
|
583
582
|
|
|
584
583
|
// src/schemas/appointment/Appointment.ts
|
|
585
|
-
import * as
|
|
586
|
-
var TimelineActivity =
|
|
584
|
+
import * as z20 from "zod";
|
|
585
|
+
var TimelineActivity = z20.object({
|
|
587
586
|
postedAt: Timestamp.nullish(),
|
|
588
587
|
userUid: CompanyUser.shape.uid.nonoptional()
|
|
589
588
|
});
|
|
590
|
-
var MiniAppointmentDetails =
|
|
589
|
+
var MiniAppointmentDetails = z20.object({
|
|
591
590
|
/** A random uid that identifies the document. */
|
|
592
|
-
_id:
|
|
591
|
+
_id: z20.uuidv4(),
|
|
593
592
|
/** The company's uid */
|
|
594
593
|
src: CompanyState.shape.uid,
|
|
595
594
|
/** The ticket number */
|
|
596
595
|
tkt: TicketNo,
|
|
597
596
|
/**The reason for the service */
|
|
598
|
-
reason:
|
|
597
|
+
reason: z20.object({
|
|
599
598
|
value: Reason.shape.value,
|
|
600
599
|
...TimeLog.shape
|
|
601
600
|
}).optional(),
|
|
@@ -607,24 +606,24 @@ var MiniAppointmentDetails = z19.object({
|
|
|
607
606
|
*/
|
|
608
607
|
invoiceNo: InvoiceNo.optional(),
|
|
609
608
|
/** The services that the client has done/will do. */
|
|
610
|
-
charges:
|
|
609
|
+
charges: z20.array(PriceTag.omit({ uid: true })).max(4),
|
|
611
610
|
/**Required to calculate the accurate grandTotal of the charges */
|
|
612
|
-
additionalFees:
|
|
611
|
+
additionalFees: z20.array(PriceAdjustment).nullable().readonly(),
|
|
613
612
|
/**Required to calculate the accurate grandTotal of the charges */
|
|
614
|
-
discounts:
|
|
615
|
-
prepayments:
|
|
613
|
+
discounts: z20.array(PriceAdjustment).nullable().readonly(),
|
|
614
|
+
prepayments: z20.array(PriceAdjustment).nullable(),
|
|
616
615
|
/** The client's identity */
|
|
617
616
|
clientUid: ClientIdentity.shape.uid,
|
|
618
617
|
/**
|
|
619
618
|
* Data that is specific to the entity (for now it's just medical data).
|
|
620
619
|
* It will only be defined for the participants that have access to it.
|
|
621
620
|
*/
|
|
622
|
-
payload:
|
|
621
|
+
payload: z20.object({
|
|
623
622
|
...MedicalDetails.shape,
|
|
624
|
-
lastModified:
|
|
623
|
+
lastModified: z20.number().nullable()
|
|
625
624
|
}).nullish(),
|
|
626
625
|
/** Only defined when either the service provider or the client cancelled their appointment */
|
|
627
|
-
cancelled:
|
|
626
|
+
cancelled: z20.object({
|
|
628
627
|
/** The time that the confirm cancel button was clicked */
|
|
629
628
|
doneAt: Timestamp,
|
|
630
629
|
reason: Reason,
|
|
@@ -632,16 +631,16 @@ var MiniAppointmentDetails = z19.object({
|
|
|
632
631
|
}).optional(),
|
|
633
632
|
/** Add this after consulting with company owners about payment expectations */
|
|
634
633
|
// paymentDueDate: Timestamp.nullish(),
|
|
635
|
-
payments:
|
|
636
|
-
|
|
634
|
+
payments: z20.array(
|
|
635
|
+
z20.object({
|
|
637
636
|
method: paymentMethods,
|
|
638
|
-
amount:
|
|
637
|
+
amount: z20.number().positive(),
|
|
639
638
|
...TimeLog.shape
|
|
640
639
|
})
|
|
641
640
|
).max(100).nullish(),
|
|
642
|
-
timeline:
|
|
641
|
+
timeline: z20.object({
|
|
643
642
|
scheduler: TimelineActivity,
|
|
644
|
-
physAsst: TimelineActivity.or(
|
|
643
|
+
physAsst: TimelineActivity.or(z20.literal("none")),
|
|
645
644
|
doctor: TimelineActivity,
|
|
646
645
|
cashier: TimelineActivity.nullable()
|
|
647
646
|
}),
|
|
@@ -649,17 +648,17 @@ var MiniAppointmentDetails = z19.object({
|
|
|
649
648
|
});
|
|
650
649
|
var AppointmentDetails = MiniAppointmentDetails.omit({
|
|
651
650
|
clientUid: true
|
|
652
|
-
}).extend(
|
|
651
|
+
}).extend(z20.object({ client: ClientIdentity }).shape);
|
|
653
652
|
var MutableAppointmentDetails = AppointmentDetails.safeExtend(
|
|
654
|
-
|
|
653
|
+
z20.object({
|
|
655
654
|
/**
|
|
656
|
-
* @description An encrypted copy of the last state of the
|
|
657
|
-
* @note Used to accurately update the
|
|
655
|
+
* @description An encrypted copy of the last state of the appointment.
|
|
656
|
+
* @note Used to accurately update the appointment without having to query the database
|
|
658
657
|
*/
|
|
659
|
-
_hash:
|
|
658
|
+
_hash: z20.string()
|
|
660
659
|
}).shape
|
|
661
660
|
);
|
|
662
|
-
var ScheduleAppointmentForm =
|
|
661
|
+
var ScheduleAppointmentForm = z20.object({
|
|
663
662
|
clientUid: ClientIdentity.shape.uid,
|
|
664
663
|
/** A nullish value === next_available */
|
|
665
664
|
serviceProviderUid: CompanyUser.shape.uid.nullish(),
|
|
@@ -686,12 +685,13 @@ function findAvailableStaff(role, staff) {
|
|
|
686
685
|
// src/functions/findNextAvailableStaff.ts
|
|
687
686
|
function findNextAvailableStaff(userUids, algorithm, staff) {
|
|
688
687
|
let nextAvailable = null;
|
|
689
|
-
if (userUids.length
|
|
688
|
+
if (userUids.length <= 1) return userUids[0] ?? null;
|
|
690
689
|
switch (algorithm) {
|
|
691
690
|
case "RR": {
|
|
692
|
-
nextAvailable = userUids.find(
|
|
693
|
-
(
|
|
694
|
-
|
|
691
|
+
nextAvailable = userUids.find((uid) => {
|
|
692
|
+
const calcTotalAppts = (appointments) => appointments.ongoing + appointments.completed;
|
|
693
|
+
return calcTotalAppts(staff.members[uid].appointments) < calcTotalAppts(staff.members[userUids[0]].appointments);
|
|
694
|
+
}) || userUids[0];
|
|
695
695
|
break;
|
|
696
696
|
}
|
|
697
697
|
case "LOR": {
|
|
@@ -856,6 +856,7 @@ export {
|
|
|
856
856
|
MedicalDetails,
|
|
857
857
|
Medicine,
|
|
858
858
|
MiniAppointmentDetails,
|
|
859
|
+
MiniCompanyUser2 as MiniCompanyUser,
|
|
859
860
|
MutableAppointmentDetails,
|
|
860
861
|
MutableCompanyBilling,
|
|
861
862
|
MutableCompanyDetails,
|