@blackcode_sa/metaestetics-api 1.5.32 → 1.5.34
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 +226 -1
- package/dist/admin/index.d.ts +226 -1
- package/dist/admin/index.js +597 -14
- package/dist/admin/index.mjs +596 -14
- package/dist/backoffice/index.d.mts +2 -0
- package/dist/backoffice/index.d.ts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/admin/booking/booking.admin.ts +234 -0
- package/src/admin/booking/booking.calculator.ts +686 -0
- package/src/admin/booking/booking.types.ts +56 -0
- package/src/admin/booking/index.ts +3 -0
- package/src/admin/index.ts +9 -0
- package/src/services/appointment/appointment.service.ts +603 -0
- package/src/services/appointment/index.ts +2 -0
- package/src/services/appointment/utils/appointment.utils.ts +590 -0
- package/src/types/appointment/index.ts +161 -0
- package/src/types/procedure/index.ts +2 -0
- package/src/validations/appointment.schema.ts +125 -0
package/dist/admin/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Timestamp } from 'firebase/firestore';
|
|
2
2
|
import * as admin from 'firebase-admin';
|
|
3
|
+
import { Timestamp as Timestamp$1 } from 'firebase-admin/firestore';
|
|
3
4
|
import * as mailgun from 'mailgun-js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -607,6 +608,8 @@ interface ProcedureSummaryInfo {
|
|
|
607
608
|
categoryName: string;
|
|
608
609
|
subcategoryName: string;
|
|
609
610
|
technologyName: string;
|
|
611
|
+
brandName?: string;
|
|
612
|
+
productName?: string;
|
|
610
613
|
price: number;
|
|
611
614
|
pricingMeasure: PricingMeasure;
|
|
612
615
|
currency: Currency;
|
|
@@ -736,6 +739,17 @@ interface PractitionerToken {
|
|
|
736
739
|
usedAt?: Timestamp;
|
|
737
740
|
}
|
|
738
741
|
|
|
742
|
+
/**
|
|
743
|
+
* Enumeracija za pol pacijenta
|
|
744
|
+
*/
|
|
745
|
+
declare enum Gender {
|
|
746
|
+
MALE = "male",
|
|
747
|
+
FEMALE = "female",
|
|
748
|
+
TRANSGENDER_MALE = "transgender_male",
|
|
749
|
+
TRANSGENDER_FEMALE = "transgender_female",
|
|
750
|
+
PREFER_NOT_TO_SAY = "prefer_not_to_say",
|
|
751
|
+
OTHER = "other"
|
|
752
|
+
}
|
|
739
753
|
/**
|
|
740
754
|
* Interfejs za gamifikaciju
|
|
741
755
|
*/
|
|
@@ -798,6 +812,28 @@ interface ClinicInfo {
|
|
|
798
812
|
location: ClinicLocation;
|
|
799
813
|
contactInfo: ClinicContactInfo;
|
|
800
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* Interface for practitioner profile information
|
|
817
|
+
*/
|
|
818
|
+
interface PractitionerProfileInfo {
|
|
819
|
+
id: string;
|
|
820
|
+
practitionerPhoto: string | null;
|
|
821
|
+
name: string;
|
|
822
|
+
email: string;
|
|
823
|
+
phone: string | null;
|
|
824
|
+
certification: PractitionerCertification;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Interface for patient profile information
|
|
828
|
+
*/
|
|
829
|
+
interface PatientProfileInfo {
|
|
830
|
+
id: string;
|
|
831
|
+
fullName: string;
|
|
832
|
+
email: string;
|
|
833
|
+
phone: string | null;
|
|
834
|
+
dateOfBirth: Timestamp$1;
|
|
835
|
+
gender: Gender;
|
|
836
|
+
}
|
|
801
837
|
|
|
802
838
|
/**
|
|
803
839
|
* Enum for all possible clinic tags
|
|
@@ -978,6 +1014,96 @@ interface Clinic {
|
|
|
978
1014
|
logo?: string;
|
|
979
1015
|
}
|
|
980
1016
|
|
|
1017
|
+
/**
|
|
1018
|
+
* Enum for synced calendar provider
|
|
1019
|
+
*/
|
|
1020
|
+
declare enum SyncedCalendarProvider {
|
|
1021
|
+
GOOGLE = "google",
|
|
1022
|
+
OUTLOOK = "outlook",
|
|
1023
|
+
APPLE = "apple"
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Enum for calendar event status
|
|
1028
|
+
*/
|
|
1029
|
+
declare enum CalendarEventStatus {
|
|
1030
|
+
PENDING = "pending",// When event is created, but not confirmed
|
|
1031
|
+
CONFIRMED = "confirmed",// When event is confirmed and ready to be used
|
|
1032
|
+
REJECTED = "rejected",// When event is rejected by the clinic administrator or patient
|
|
1033
|
+
CANCELED = "canceled",// When event is canceled by the patient
|
|
1034
|
+
RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
|
|
1035
|
+
COMPLETED = "completed"
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Enum for calendar event sync status
|
|
1039
|
+
*/
|
|
1040
|
+
declare enum CalendarSyncStatus {
|
|
1041
|
+
INTERNAL = "internal",
|
|
1042
|
+
EXTERNAL = "external"
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Enum for calendar event types
|
|
1046
|
+
*/
|
|
1047
|
+
declare enum CalendarEventType {
|
|
1048
|
+
APPOINTMENT = "appointment",
|
|
1049
|
+
BLOCKING = "blocking",
|
|
1050
|
+
BREAK = "break",
|
|
1051
|
+
FREE_DAY = "free_day",
|
|
1052
|
+
OTHER = "other"
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Interface for calendar event time
|
|
1056
|
+
*/
|
|
1057
|
+
interface CalendarEventTime {
|
|
1058
|
+
start: Timestamp;
|
|
1059
|
+
end: Timestamp;
|
|
1060
|
+
}
|
|
1061
|
+
interface ProcedureInfo {
|
|
1062
|
+
name: string;
|
|
1063
|
+
description: string;
|
|
1064
|
+
duration: number;
|
|
1065
|
+
price: number;
|
|
1066
|
+
currency: Currency;
|
|
1067
|
+
}
|
|
1068
|
+
interface ProcedureCategorization {
|
|
1069
|
+
procedureFamily: ProcedureFamily;
|
|
1070
|
+
procedureCategory: Category;
|
|
1071
|
+
procedureSubcategory: Subcategory;
|
|
1072
|
+
procedureTechnology: Technology;
|
|
1073
|
+
procedureProduct: Product;
|
|
1074
|
+
}
|
|
1075
|
+
interface SyncedCalendarEvent {
|
|
1076
|
+
eventId: string;
|
|
1077
|
+
syncedCalendarProvider: SyncedCalendarProvider;
|
|
1078
|
+
syncedAt: Timestamp;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Interface for calendar event
|
|
1082
|
+
*/
|
|
1083
|
+
interface CalendarEvent {
|
|
1084
|
+
id: string;
|
|
1085
|
+
clinicBranchId?: string | null;
|
|
1086
|
+
clinicBranchInfo?: ClinicInfo | null;
|
|
1087
|
+
practitionerProfileId?: string | null;
|
|
1088
|
+
practitionerProfileInfo?: PractitionerProfileInfo | null;
|
|
1089
|
+
patientProfileId?: string | null;
|
|
1090
|
+
patientProfileInfo?: PatientProfileInfo | null;
|
|
1091
|
+
procedureId?: string | null;
|
|
1092
|
+
procedureInfo?: ProcedureInfo | null;
|
|
1093
|
+
procedureCategorization?: ProcedureCategorization | null;
|
|
1094
|
+
appointmentId?: string | null;
|
|
1095
|
+
syncedCalendarEventId?: SyncedCalendarEvent[] | null;
|
|
1096
|
+
eventName: string;
|
|
1097
|
+
eventLocation?: ClinicLocation;
|
|
1098
|
+
eventTime: CalendarEventTime;
|
|
1099
|
+
description?: string;
|
|
1100
|
+
status: CalendarEventStatus;
|
|
1101
|
+
syncStatus: CalendarSyncStatus;
|
|
1102
|
+
eventType: CalendarEventType;
|
|
1103
|
+
createdAt: Timestamp;
|
|
1104
|
+
updatedAt: Timestamp;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
981
1107
|
declare enum UserRole {
|
|
982
1108
|
PATIENT = "patient",
|
|
983
1109
|
PRACTITIONER = "practitioner",
|
|
@@ -1475,4 +1601,103 @@ declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
|
1475
1601
|
handleTokenCreationEvent(tokenData: PractitionerToken, fromAddress: string): Promise<void>;
|
|
1476
1602
|
}
|
|
1477
1603
|
|
|
1478
|
-
|
|
1604
|
+
/**
|
|
1605
|
+
* Admin service for handling booking-related operations.
|
|
1606
|
+
* This is the cloud-based implementation that will be used in Cloud Functions.
|
|
1607
|
+
*/
|
|
1608
|
+
declare class BookingAdmin {
|
|
1609
|
+
private db;
|
|
1610
|
+
/**
|
|
1611
|
+
* Creates a new BookingAdmin instance
|
|
1612
|
+
* @param firestore - Firestore instance provided by the caller
|
|
1613
|
+
*/
|
|
1614
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
1615
|
+
/**
|
|
1616
|
+
* Gets available booking time slots for a specific clinic, practitioner, and procedure
|
|
1617
|
+
*
|
|
1618
|
+
* @param clinicId - ID of the clinic
|
|
1619
|
+
* @param practitionerId - ID of the practitioner
|
|
1620
|
+
* @param procedureId - ID of the procedure
|
|
1621
|
+
* @param timeframe - Time range to check for availability
|
|
1622
|
+
* @returns Promise resolving to an array of available booking slots
|
|
1623
|
+
*/
|
|
1624
|
+
getAvailableBookingSlots(clinicId: string, practitionerId: string, procedureId: string, timeframe: {
|
|
1625
|
+
start: Date | admin.firestore.Timestamp;
|
|
1626
|
+
end: Date | admin.firestore.Timestamp;
|
|
1627
|
+
}): Promise<{
|
|
1628
|
+
availableSlots: {
|
|
1629
|
+
start: admin.firestore.Timestamp;
|
|
1630
|
+
}[];
|
|
1631
|
+
}>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Converts an admin Firestore Timestamp to a client Firestore Timestamp
|
|
1634
|
+
*/
|
|
1635
|
+
private adminTimestampToClientTimestamp;
|
|
1636
|
+
/**
|
|
1637
|
+
* Converts timestamps in calendar events from admin Firestore Timestamps to client Firestore Timestamps
|
|
1638
|
+
*/
|
|
1639
|
+
private convertEventsTimestamps;
|
|
1640
|
+
/**
|
|
1641
|
+
* Fetches clinic calendar events for a specific time range
|
|
1642
|
+
*
|
|
1643
|
+
* @param clinicId - ID of the clinic
|
|
1644
|
+
* @param start - Start time of the range
|
|
1645
|
+
* @param end - End time of the range
|
|
1646
|
+
* @returns Promise resolving to an array of calendar events
|
|
1647
|
+
*/
|
|
1648
|
+
private getClinicCalendarEvents;
|
|
1649
|
+
/**
|
|
1650
|
+
* Fetches practitioner calendar events for a specific time range
|
|
1651
|
+
*
|
|
1652
|
+
* @param practitionerId - ID of the practitioner
|
|
1653
|
+
* @param start - Start time of the range
|
|
1654
|
+
* @param end - End time of the range
|
|
1655
|
+
* @returns Promise resolving to an array of calendar events
|
|
1656
|
+
*/
|
|
1657
|
+
private getPractitionerCalendarEvents;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Request parameters for calculating available booking slots
|
|
1662
|
+
*/
|
|
1663
|
+
interface BookingAvailabilityRequest {
|
|
1664
|
+
/** The clinic for which to calculate booking slots */
|
|
1665
|
+
clinic: Clinic;
|
|
1666
|
+
/** The practitioner for which to calculate booking slots */
|
|
1667
|
+
practitioner: Practitioner;
|
|
1668
|
+
/** The procedure for which to calculate booking slots */
|
|
1669
|
+
procedure: Procedure;
|
|
1670
|
+
/** The timeframe for which to calculate booking slots */
|
|
1671
|
+
timeframe: {
|
|
1672
|
+
start: Timestamp;
|
|
1673
|
+
end: Timestamp;
|
|
1674
|
+
};
|
|
1675
|
+
/** Calendar events for the clinic during the specified timeframe */
|
|
1676
|
+
clinicCalendarEvents: CalendarEvent[];
|
|
1677
|
+
/** Calendar events for the practitioner during the specified timeframe */
|
|
1678
|
+
practitionerCalendarEvents: CalendarEvent[];
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Represents a single available booking slot
|
|
1682
|
+
*/
|
|
1683
|
+
interface AvailableSlot {
|
|
1684
|
+
/** Start time of the available booking slot */
|
|
1685
|
+
start: Timestamp;
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Response with available booking slots
|
|
1689
|
+
*/
|
|
1690
|
+
interface BookingAvailabilityResponse {
|
|
1691
|
+
/** Array of available booking slots */
|
|
1692
|
+
availableSlots: AvailableSlot[];
|
|
1693
|
+
}
|
|
1694
|
+
/**
|
|
1695
|
+
* Represents a time interval with start and end times
|
|
1696
|
+
* Used internally for availability calculations
|
|
1697
|
+
*/
|
|
1698
|
+
interface TimeInterval {
|
|
1699
|
+
start: Timestamp;
|
|
1700
|
+
end: Timestamp;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
export { type AppointmentNotification, type AppointmentReminderNotification, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, type BookingAvailabilityRequest, type BookingAvailabilityResponse, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type PatientProfile as Patient, PatientAggregationService, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type TimeInterval, UserRole };
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Timestamp } from 'firebase/firestore';
|
|
2
2
|
import * as admin from 'firebase-admin';
|
|
3
|
+
import { Timestamp as Timestamp$1 } from 'firebase-admin/firestore';
|
|
3
4
|
import * as mailgun from 'mailgun-js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -607,6 +608,8 @@ interface ProcedureSummaryInfo {
|
|
|
607
608
|
categoryName: string;
|
|
608
609
|
subcategoryName: string;
|
|
609
610
|
technologyName: string;
|
|
611
|
+
brandName?: string;
|
|
612
|
+
productName?: string;
|
|
610
613
|
price: number;
|
|
611
614
|
pricingMeasure: PricingMeasure;
|
|
612
615
|
currency: Currency;
|
|
@@ -736,6 +739,17 @@ interface PractitionerToken {
|
|
|
736
739
|
usedAt?: Timestamp;
|
|
737
740
|
}
|
|
738
741
|
|
|
742
|
+
/**
|
|
743
|
+
* Enumeracija za pol pacijenta
|
|
744
|
+
*/
|
|
745
|
+
declare enum Gender {
|
|
746
|
+
MALE = "male",
|
|
747
|
+
FEMALE = "female",
|
|
748
|
+
TRANSGENDER_MALE = "transgender_male",
|
|
749
|
+
TRANSGENDER_FEMALE = "transgender_female",
|
|
750
|
+
PREFER_NOT_TO_SAY = "prefer_not_to_say",
|
|
751
|
+
OTHER = "other"
|
|
752
|
+
}
|
|
739
753
|
/**
|
|
740
754
|
* Interfejs za gamifikaciju
|
|
741
755
|
*/
|
|
@@ -798,6 +812,28 @@ interface ClinicInfo {
|
|
|
798
812
|
location: ClinicLocation;
|
|
799
813
|
contactInfo: ClinicContactInfo;
|
|
800
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* Interface for practitioner profile information
|
|
817
|
+
*/
|
|
818
|
+
interface PractitionerProfileInfo {
|
|
819
|
+
id: string;
|
|
820
|
+
practitionerPhoto: string | null;
|
|
821
|
+
name: string;
|
|
822
|
+
email: string;
|
|
823
|
+
phone: string | null;
|
|
824
|
+
certification: PractitionerCertification;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Interface for patient profile information
|
|
828
|
+
*/
|
|
829
|
+
interface PatientProfileInfo {
|
|
830
|
+
id: string;
|
|
831
|
+
fullName: string;
|
|
832
|
+
email: string;
|
|
833
|
+
phone: string | null;
|
|
834
|
+
dateOfBirth: Timestamp$1;
|
|
835
|
+
gender: Gender;
|
|
836
|
+
}
|
|
801
837
|
|
|
802
838
|
/**
|
|
803
839
|
* Enum for all possible clinic tags
|
|
@@ -978,6 +1014,96 @@ interface Clinic {
|
|
|
978
1014
|
logo?: string;
|
|
979
1015
|
}
|
|
980
1016
|
|
|
1017
|
+
/**
|
|
1018
|
+
* Enum for synced calendar provider
|
|
1019
|
+
*/
|
|
1020
|
+
declare enum SyncedCalendarProvider {
|
|
1021
|
+
GOOGLE = "google",
|
|
1022
|
+
OUTLOOK = "outlook",
|
|
1023
|
+
APPLE = "apple"
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Enum for calendar event status
|
|
1028
|
+
*/
|
|
1029
|
+
declare enum CalendarEventStatus {
|
|
1030
|
+
PENDING = "pending",// When event is created, but not confirmed
|
|
1031
|
+
CONFIRMED = "confirmed",// When event is confirmed and ready to be used
|
|
1032
|
+
REJECTED = "rejected",// When event is rejected by the clinic administrator or patient
|
|
1033
|
+
CANCELED = "canceled",// When event is canceled by the patient
|
|
1034
|
+
RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
|
|
1035
|
+
COMPLETED = "completed"
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Enum for calendar event sync status
|
|
1039
|
+
*/
|
|
1040
|
+
declare enum CalendarSyncStatus {
|
|
1041
|
+
INTERNAL = "internal",
|
|
1042
|
+
EXTERNAL = "external"
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Enum for calendar event types
|
|
1046
|
+
*/
|
|
1047
|
+
declare enum CalendarEventType {
|
|
1048
|
+
APPOINTMENT = "appointment",
|
|
1049
|
+
BLOCKING = "blocking",
|
|
1050
|
+
BREAK = "break",
|
|
1051
|
+
FREE_DAY = "free_day",
|
|
1052
|
+
OTHER = "other"
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Interface for calendar event time
|
|
1056
|
+
*/
|
|
1057
|
+
interface CalendarEventTime {
|
|
1058
|
+
start: Timestamp;
|
|
1059
|
+
end: Timestamp;
|
|
1060
|
+
}
|
|
1061
|
+
interface ProcedureInfo {
|
|
1062
|
+
name: string;
|
|
1063
|
+
description: string;
|
|
1064
|
+
duration: number;
|
|
1065
|
+
price: number;
|
|
1066
|
+
currency: Currency;
|
|
1067
|
+
}
|
|
1068
|
+
interface ProcedureCategorization {
|
|
1069
|
+
procedureFamily: ProcedureFamily;
|
|
1070
|
+
procedureCategory: Category;
|
|
1071
|
+
procedureSubcategory: Subcategory;
|
|
1072
|
+
procedureTechnology: Technology;
|
|
1073
|
+
procedureProduct: Product;
|
|
1074
|
+
}
|
|
1075
|
+
interface SyncedCalendarEvent {
|
|
1076
|
+
eventId: string;
|
|
1077
|
+
syncedCalendarProvider: SyncedCalendarProvider;
|
|
1078
|
+
syncedAt: Timestamp;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Interface for calendar event
|
|
1082
|
+
*/
|
|
1083
|
+
interface CalendarEvent {
|
|
1084
|
+
id: string;
|
|
1085
|
+
clinicBranchId?: string | null;
|
|
1086
|
+
clinicBranchInfo?: ClinicInfo | null;
|
|
1087
|
+
practitionerProfileId?: string | null;
|
|
1088
|
+
practitionerProfileInfo?: PractitionerProfileInfo | null;
|
|
1089
|
+
patientProfileId?: string | null;
|
|
1090
|
+
patientProfileInfo?: PatientProfileInfo | null;
|
|
1091
|
+
procedureId?: string | null;
|
|
1092
|
+
procedureInfo?: ProcedureInfo | null;
|
|
1093
|
+
procedureCategorization?: ProcedureCategorization | null;
|
|
1094
|
+
appointmentId?: string | null;
|
|
1095
|
+
syncedCalendarEventId?: SyncedCalendarEvent[] | null;
|
|
1096
|
+
eventName: string;
|
|
1097
|
+
eventLocation?: ClinicLocation;
|
|
1098
|
+
eventTime: CalendarEventTime;
|
|
1099
|
+
description?: string;
|
|
1100
|
+
status: CalendarEventStatus;
|
|
1101
|
+
syncStatus: CalendarSyncStatus;
|
|
1102
|
+
eventType: CalendarEventType;
|
|
1103
|
+
createdAt: Timestamp;
|
|
1104
|
+
updatedAt: Timestamp;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
981
1107
|
declare enum UserRole {
|
|
982
1108
|
PATIENT = "patient",
|
|
983
1109
|
PRACTITIONER = "practitioner",
|
|
@@ -1475,4 +1601,103 @@ declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
|
1475
1601
|
handleTokenCreationEvent(tokenData: PractitionerToken, fromAddress: string): Promise<void>;
|
|
1476
1602
|
}
|
|
1477
1603
|
|
|
1478
|
-
|
|
1604
|
+
/**
|
|
1605
|
+
* Admin service for handling booking-related operations.
|
|
1606
|
+
* This is the cloud-based implementation that will be used in Cloud Functions.
|
|
1607
|
+
*/
|
|
1608
|
+
declare class BookingAdmin {
|
|
1609
|
+
private db;
|
|
1610
|
+
/**
|
|
1611
|
+
* Creates a new BookingAdmin instance
|
|
1612
|
+
* @param firestore - Firestore instance provided by the caller
|
|
1613
|
+
*/
|
|
1614
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
1615
|
+
/**
|
|
1616
|
+
* Gets available booking time slots for a specific clinic, practitioner, and procedure
|
|
1617
|
+
*
|
|
1618
|
+
* @param clinicId - ID of the clinic
|
|
1619
|
+
* @param practitionerId - ID of the practitioner
|
|
1620
|
+
* @param procedureId - ID of the procedure
|
|
1621
|
+
* @param timeframe - Time range to check for availability
|
|
1622
|
+
* @returns Promise resolving to an array of available booking slots
|
|
1623
|
+
*/
|
|
1624
|
+
getAvailableBookingSlots(clinicId: string, practitionerId: string, procedureId: string, timeframe: {
|
|
1625
|
+
start: Date | admin.firestore.Timestamp;
|
|
1626
|
+
end: Date | admin.firestore.Timestamp;
|
|
1627
|
+
}): Promise<{
|
|
1628
|
+
availableSlots: {
|
|
1629
|
+
start: admin.firestore.Timestamp;
|
|
1630
|
+
}[];
|
|
1631
|
+
}>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Converts an admin Firestore Timestamp to a client Firestore Timestamp
|
|
1634
|
+
*/
|
|
1635
|
+
private adminTimestampToClientTimestamp;
|
|
1636
|
+
/**
|
|
1637
|
+
* Converts timestamps in calendar events from admin Firestore Timestamps to client Firestore Timestamps
|
|
1638
|
+
*/
|
|
1639
|
+
private convertEventsTimestamps;
|
|
1640
|
+
/**
|
|
1641
|
+
* Fetches clinic calendar events for a specific time range
|
|
1642
|
+
*
|
|
1643
|
+
* @param clinicId - ID of the clinic
|
|
1644
|
+
* @param start - Start time of the range
|
|
1645
|
+
* @param end - End time of the range
|
|
1646
|
+
* @returns Promise resolving to an array of calendar events
|
|
1647
|
+
*/
|
|
1648
|
+
private getClinicCalendarEvents;
|
|
1649
|
+
/**
|
|
1650
|
+
* Fetches practitioner calendar events for a specific time range
|
|
1651
|
+
*
|
|
1652
|
+
* @param practitionerId - ID of the practitioner
|
|
1653
|
+
* @param start - Start time of the range
|
|
1654
|
+
* @param end - End time of the range
|
|
1655
|
+
* @returns Promise resolving to an array of calendar events
|
|
1656
|
+
*/
|
|
1657
|
+
private getPractitionerCalendarEvents;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Request parameters for calculating available booking slots
|
|
1662
|
+
*/
|
|
1663
|
+
interface BookingAvailabilityRequest {
|
|
1664
|
+
/** The clinic for which to calculate booking slots */
|
|
1665
|
+
clinic: Clinic;
|
|
1666
|
+
/** The practitioner for which to calculate booking slots */
|
|
1667
|
+
practitioner: Practitioner;
|
|
1668
|
+
/** The procedure for which to calculate booking slots */
|
|
1669
|
+
procedure: Procedure;
|
|
1670
|
+
/** The timeframe for which to calculate booking slots */
|
|
1671
|
+
timeframe: {
|
|
1672
|
+
start: Timestamp;
|
|
1673
|
+
end: Timestamp;
|
|
1674
|
+
};
|
|
1675
|
+
/** Calendar events for the clinic during the specified timeframe */
|
|
1676
|
+
clinicCalendarEvents: CalendarEvent[];
|
|
1677
|
+
/** Calendar events for the practitioner during the specified timeframe */
|
|
1678
|
+
practitionerCalendarEvents: CalendarEvent[];
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Represents a single available booking slot
|
|
1682
|
+
*/
|
|
1683
|
+
interface AvailableSlot {
|
|
1684
|
+
/** Start time of the available booking slot */
|
|
1685
|
+
start: Timestamp;
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Response with available booking slots
|
|
1689
|
+
*/
|
|
1690
|
+
interface BookingAvailabilityResponse {
|
|
1691
|
+
/** Array of available booking slots */
|
|
1692
|
+
availableSlots: AvailableSlot[];
|
|
1693
|
+
}
|
|
1694
|
+
/**
|
|
1695
|
+
* Represents a time interval with start and end times
|
|
1696
|
+
* Used internally for availability calculations
|
|
1697
|
+
*/
|
|
1698
|
+
interface TimeInterval {
|
|
1699
|
+
start: Timestamp;
|
|
1700
|
+
end: Timestamp;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
export { type AppointmentNotification, type AppointmentReminderNotification, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, type BookingAvailabilityRequest, type BookingAvailabilityResponse, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type PatientProfile as Patient, PatientAggregationService, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type TimeInterval, UserRole };
|