@blackcode_sa/metaestetics-api 1.8.0 → 1.8.2
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 +956 -848
- package/dist/admin/index.d.ts +956 -848
- package/dist/admin/index.js +7215 -6757
- package/dist/admin/index.mjs +7215 -6754
- package/dist/backoffice/index.d.mts +1418 -1418
- package/dist/backoffice/index.d.ts +1418 -1418
- package/dist/backoffice/index.js +1464 -1454
- package/dist/backoffice/index.mjs +1509 -1499
- package/dist/index.d.mts +5565 -5565
- package/dist/index.d.ts +5565 -5565
- package/dist/index.js +5834 -3388
- package/dist/index.mjs +6374 -3873
- package/package.json +1 -1
- package/src/admin/aggregation/appointment/index.ts +1 -0
- package/src/admin/aggregation/clinic/index.ts +1 -0
- package/src/admin/aggregation/forms/index.ts +1 -0
- package/src/admin/aggregation/index.ts +8 -0
- package/src/admin/aggregation/patient/index.ts +1 -0
- package/src/admin/aggregation/practitioner/index.ts +1 -0
- package/src/admin/aggregation/practitioner-invite/index.ts +1 -0
- package/src/admin/aggregation/procedure/index.ts +1 -0
- package/src/admin/aggregation/reviews/index.ts +1 -0
- package/src/admin/booking/index.ts +1 -1
- package/src/admin/calendar/index.ts +1 -0
- package/src/admin/documentation-templates/index.ts +1 -0
- package/src/admin/free-consultation/index.ts +1 -0
- package/src/admin/index.ts +18 -120
- package/src/admin/mailing/appointment/index.ts +1 -0
- package/src/admin/mailing/index.ts +1 -2
- package/src/admin/mailing/practitionerInvite/index.ts +1 -0
- package/src/admin/notifications/index.ts +1 -0
- package/src/admin/requirements/index.ts +1 -0
- package/src/admin/users/index.ts +1 -0
- package/src/admin/users/user-profile.admin.ts +1 -0
- package/src/backoffice/constants/index.ts +1 -0
- package/src/backoffice/errors/index.ts +1 -0
- package/src/backoffice/index.ts +5 -14
- package/src/backoffice/services/index.ts +7 -0
- package/src/backoffice/validations/index.ts +1 -0
- package/src/index.backup.ts +1 -1
- package/src/services/appointment/appointment.service.ts +1 -1
- package/src/services/calendar/index.ts +1 -1
- package/src/services/index.ts +13 -14
- /package/src/services/calendar/{calendar-refactored.service.ts → calendar.v2.service.ts} +0 -0
package/dist/admin/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Timestamp
|
|
2
|
-
import * as admin from 'firebase-admin';
|
|
1
|
+
import { Timestamp } from 'firebase/firestore';
|
|
3
2
|
import { Timestamp as Timestamp$1 } from 'firebase-admin/firestore';
|
|
3
|
+
import * as admin from 'firebase-admin';
|
|
4
4
|
|
|
5
5
|
declare enum UserRole {
|
|
6
6
|
PATIENT = "patient",
|
|
@@ -8,6 +8,18 @@ declare enum UserRole {
|
|
|
8
8
|
APP_ADMIN = "app_admin",
|
|
9
9
|
CLINIC_ADMIN = "clinic_admin"
|
|
10
10
|
}
|
|
11
|
+
interface User {
|
|
12
|
+
uid: string;
|
|
13
|
+
email: string | null;
|
|
14
|
+
roles: UserRole[];
|
|
15
|
+
isAnonymous: boolean;
|
|
16
|
+
createdAt: any;
|
|
17
|
+
updatedAt: any;
|
|
18
|
+
lastLoginAt: any;
|
|
19
|
+
patientProfile?: string;
|
|
20
|
+
practitionerProfile?: string;
|
|
21
|
+
adminProfile?: string;
|
|
22
|
+
}
|
|
11
23
|
|
|
12
24
|
/**
|
|
13
25
|
* Review system type definitions
|
|
@@ -922,6 +934,101 @@ interface PractitionerToken {
|
|
|
922
934
|
emailErrorAt?: Timestamp;
|
|
923
935
|
}
|
|
924
936
|
|
|
937
|
+
declare enum AllergyType {
|
|
938
|
+
MEDICATION = "medication",
|
|
939
|
+
FOOD = "food",
|
|
940
|
+
ENVIRONMENTAL = "environmental",
|
|
941
|
+
LATEX = "latex",
|
|
942
|
+
COSMETIC = "cosmetic",
|
|
943
|
+
OTHER = "other"
|
|
944
|
+
}
|
|
945
|
+
declare enum MedicationAllergySubtype {
|
|
946
|
+
ANTIBIOTICS = "antibiotics",
|
|
947
|
+
NSAIDS = "nsaids",
|
|
948
|
+
OPIOIDS = "opioids",
|
|
949
|
+
ANESTHETICS = "anesthetics",
|
|
950
|
+
VACCINES = "vaccines",
|
|
951
|
+
OTHER = "other"
|
|
952
|
+
}
|
|
953
|
+
declare enum FoodAllergySubtype {
|
|
954
|
+
NUTS = "nuts",
|
|
955
|
+
SHELLFISH = "shellfish",
|
|
956
|
+
DAIRY = "dairy",
|
|
957
|
+
EGGS = "eggs",
|
|
958
|
+
WHEAT = "wheat",
|
|
959
|
+
SOY = "soy",
|
|
960
|
+
FISH = "fish",
|
|
961
|
+
FRUITS = "fruits",
|
|
962
|
+
OTHER = "other"
|
|
963
|
+
}
|
|
964
|
+
declare enum EnvironmentalAllergySubtype {
|
|
965
|
+
POLLEN = "pollen",
|
|
966
|
+
DUST = "dust",
|
|
967
|
+
MOLD = "mold",
|
|
968
|
+
PET_DANDER = "pet_dander",
|
|
969
|
+
INSECTS = "insects",
|
|
970
|
+
OTHER = "other"
|
|
971
|
+
}
|
|
972
|
+
declare enum CosmeticAllergySubtype {
|
|
973
|
+
FRAGRANCES = "fragrances",
|
|
974
|
+
PRESERVATIVES = "preservatives",
|
|
975
|
+
DYES = "dyes",
|
|
976
|
+
METALS = "metals",
|
|
977
|
+
OTHER = "other"
|
|
978
|
+
}
|
|
979
|
+
type AllergySubtype = MedicationAllergySubtype | FoodAllergySubtype | EnvironmentalAllergySubtype | CosmeticAllergySubtype | "other";
|
|
980
|
+
|
|
981
|
+
interface Allergy {
|
|
982
|
+
type: AllergyType;
|
|
983
|
+
subtype: AllergySubtype;
|
|
984
|
+
name?: string | null;
|
|
985
|
+
severity?: "mild" | "moderate" | "severe" | null;
|
|
986
|
+
reaction?: string | null;
|
|
987
|
+
diagnosed?: Timestamp | null;
|
|
988
|
+
notes?: string | null;
|
|
989
|
+
}
|
|
990
|
+
interface VitalStats {
|
|
991
|
+
height?: number;
|
|
992
|
+
weight?: number;
|
|
993
|
+
bloodType?: "A+" | "A-" | "B+" | "B-" | "AB+" | "AB-" | "O+" | "O-";
|
|
994
|
+
bloodPressure?: {
|
|
995
|
+
systolic: number;
|
|
996
|
+
diastolic: number;
|
|
997
|
+
lastMeasured: Timestamp;
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
interface PatientMedicalInfo {
|
|
1001
|
+
patientId: string;
|
|
1002
|
+
vitalStats: VitalStats;
|
|
1003
|
+
blockingConditions: {
|
|
1004
|
+
condition: BlockingCondition;
|
|
1005
|
+
diagnosedAt: Timestamp;
|
|
1006
|
+
isActive: boolean;
|
|
1007
|
+
notes?: string | null;
|
|
1008
|
+
}[];
|
|
1009
|
+
contraindications: {
|
|
1010
|
+
condition: Contraindication;
|
|
1011
|
+
lastOccurrence: Timestamp;
|
|
1012
|
+
frequency: "rare" | "occasional" | "frequent";
|
|
1013
|
+
isActive: boolean;
|
|
1014
|
+
notes?: string | null;
|
|
1015
|
+
}[];
|
|
1016
|
+
allergies: Allergy[];
|
|
1017
|
+
currentMedications: {
|
|
1018
|
+
name: string;
|
|
1019
|
+
dosage: string;
|
|
1020
|
+
frequency: string;
|
|
1021
|
+
startDate?: Timestamp | null;
|
|
1022
|
+
endDate?: Timestamp | null;
|
|
1023
|
+
prescribedBy?: string | null;
|
|
1024
|
+
}[];
|
|
1025
|
+
emergencyNotes?: string;
|
|
1026
|
+
lastUpdated: Timestamp;
|
|
1027
|
+
updatedBy: string;
|
|
1028
|
+
verifiedBy?: string;
|
|
1029
|
+
verifiedAt?: Timestamp;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
925
1032
|
declare const PATIENTS_COLLECTION = "patients";
|
|
926
1033
|
declare const PATIENT_SENSITIVE_INFO_COLLECTION = "sensitive-info";
|
|
927
1034
|
/**
|
|
@@ -981,6 +1088,23 @@ interface PatientSensitiveInfo {
|
|
|
981
1088
|
createdAt: Timestamp;
|
|
982
1089
|
updatedAt: Timestamp;
|
|
983
1090
|
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Tip za kreiranje osetljivih informacija
|
|
1093
|
+
*/
|
|
1094
|
+
interface CreatePatientSensitiveInfoData {
|
|
1095
|
+
patientId: string;
|
|
1096
|
+
userRef?: string;
|
|
1097
|
+
photoUrl?: MediaResource | null;
|
|
1098
|
+
firstName: string;
|
|
1099
|
+
lastName: string;
|
|
1100
|
+
dateOfBirth: Timestamp | null;
|
|
1101
|
+
gender: Gender;
|
|
1102
|
+
email?: string;
|
|
1103
|
+
phoneNumber?: string;
|
|
1104
|
+
alternativePhoneNumber?: string;
|
|
1105
|
+
addressData?: AddressData;
|
|
1106
|
+
emergencyContacts?: EmergencyContact[];
|
|
1107
|
+
}
|
|
984
1108
|
/**
|
|
985
1109
|
* Interfejs za doktora pacijenta
|
|
986
1110
|
*/
|
|
@@ -1022,6 +1146,22 @@ interface PatientProfile {
|
|
|
1022
1146
|
createdAt: Timestamp;
|
|
1023
1147
|
updatedAt: Timestamp;
|
|
1024
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Tip za kreiranje novog Patient profila
|
|
1151
|
+
*/
|
|
1152
|
+
interface CreatePatientProfileData {
|
|
1153
|
+
userRef?: string;
|
|
1154
|
+
displayName: string;
|
|
1155
|
+
expoTokens: string[];
|
|
1156
|
+
gamification?: GamificationInfo;
|
|
1157
|
+
isActive: boolean;
|
|
1158
|
+
isVerified: boolean;
|
|
1159
|
+
isManual: boolean;
|
|
1160
|
+
doctors?: PatientDoctor[];
|
|
1161
|
+
clinics?: PatientClinic[];
|
|
1162
|
+
doctorIds?: string[];
|
|
1163
|
+
clinicIds?: string[];
|
|
1164
|
+
}
|
|
1025
1165
|
|
|
1026
1166
|
/**
|
|
1027
1167
|
* Interface for clinic profile information
|
|
@@ -1507,90 +1647,6 @@ interface Appointment {
|
|
|
1507
1647
|
/** NEW: Metadata for the appointment - used for area selection and photos */
|
|
1508
1648
|
metadata?: AppointmentMetadata;
|
|
1509
1649
|
}
|
|
1510
|
-
/**
|
|
1511
|
-
* Data needed to create a new Appointment
|
|
1512
|
-
*/
|
|
1513
|
-
interface CreateAppointmentData {
|
|
1514
|
-
clinicBranchId: string;
|
|
1515
|
-
practitionerId: string;
|
|
1516
|
-
patientId: string;
|
|
1517
|
-
procedureId: string;
|
|
1518
|
-
appointmentStartTime: Timestamp;
|
|
1519
|
-
appointmentEndTime: Timestamp;
|
|
1520
|
-
cost: number;
|
|
1521
|
-
currency: Currency;
|
|
1522
|
-
patientNotes?: string | null;
|
|
1523
|
-
initialStatus: AppointmentStatus;
|
|
1524
|
-
initialPaymentStatus?: PaymentStatus;
|
|
1525
|
-
}
|
|
1526
|
-
/**
|
|
1527
|
-
* Data needed to create a new Appointment via CreateAppointmentHttp method
|
|
1528
|
-
*/
|
|
1529
|
-
interface CreateAppointmentHttpData {
|
|
1530
|
-
patientId: string;
|
|
1531
|
-
procedureId: string;
|
|
1532
|
-
appointmentStartTime: Timestamp;
|
|
1533
|
-
appointmentEndTime: Timestamp;
|
|
1534
|
-
patientNotes?: string | null;
|
|
1535
|
-
}
|
|
1536
|
-
/**
|
|
1537
|
-
* Data allowed for updating an Appointment
|
|
1538
|
-
*/
|
|
1539
|
-
interface UpdateAppointmentData {
|
|
1540
|
-
status?: AppointmentStatus;
|
|
1541
|
-
confirmationTime?: Timestamp | FieldValue | null;
|
|
1542
|
-
cancellationTime?: Timestamp | FieldValue | null;
|
|
1543
|
-
rescheduleTime?: Timestamp | FieldValue | null;
|
|
1544
|
-
procedureActualStartTime?: Timestamp | FieldValue | null;
|
|
1545
|
-
actualDurationMinutes?: number;
|
|
1546
|
-
cancellationReason?: string | null;
|
|
1547
|
-
canceledBy?: "patient" | "clinic" | "practitioner" | "system";
|
|
1548
|
-
internalNotes?: string | null;
|
|
1549
|
-
patientNotes?: string | FieldValue | null;
|
|
1550
|
-
paymentStatus?: PaymentStatus;
|
|
1551
|
-
paymentTransactionId?: string | FieldValue | null;
|
|
1552
|
-
completedPreRequirements?: string[] | FieldValue;
|
|
1553
|
-
completedPostRequirements?: string[] | FieldValue;
|
|
1554
|
-
appointmentStartTime?: Timestamp;
|
|
1555
|
-
appointmentEndTime?: Timestamp;
|
|
1556
|
-
calendarEventId?: string;
|
|
1557
|
-
cost?: number;
|
|
1558
|
-
clinicBranchId?: string;
|
|
1559
|
-
practitionerId?: string;
|
|
1560
|
-
/** NEW: For updating linked forms - typically managed by dedicated methods */
|
|
1561
|
-
linkedFormIds?: string[] | FieldValue;
|
|
1562
|
-
linkedForms?: LinkedFormInfo[] | FieldValue;
|
|
1563
|
-
/** NEW: For updating media items - typically managed by dedicated methods */
|
|
1564
|
-
media?: AppointmentMediaItem[] | FieldValue;
|
|
1565
|
-
/** NEW: For adding/updating review information */
|
|
1566
|
-
reviewInfo?: PatientReviewInfo | FieldValue | null;
|
|
1567
|
-
/** NEW: For setting practitioner finalization details */
|
|
1568
|
-
finalizedDetails?: {
|
|
1569
|
-
by: string;
|
|
1570
|
-
at: Timestamp;
|
|
1571
|
-
notes?: string;
|
|
1572
|
-
} | FieldValue;
|
|
1573
|
-
/** NEW: For archiving/unarchiving */
|
|
1574
|
-
isArchived?: boolean;
|
|
1575
|
-
updatedAt?: FieldValue;
|
|
1576
|
-
/** NEW: For updating metadata */
|
|
1577
|
-
metadata?: AppointmentMetadata;
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* Parameters for searching appointments
|
|
1581
|
-
*/
|
|
1582
|
-
interface SearchAppointmentsParams {
|
|
1583
|
-
patientId?: string;
|
|
1584
|
-
practitionerId?: string;
|
|
1585
|
-
clinicBranchId?: string;
|
|
1586
|
-
startDate?: Date;
|
|
1587
|
-
endDate?: Date;
|
|
1588
|
-
status?: AppointmentStatus | AppointmentStatus[];
|
|
1589
|
-
limit?: number;
|
|
1590
|
-
startAfter?: any;
|
|
1591
|
-
}
|
|
1592
|
-
/** Firestore collection name */
|
|
1593
|
-
declare const APPOINTMENTS_COLLECTION = "appointments";
|
|
1594
1650
|
|
|
1595
1651
|
/**
|
|
1596
1652
|
* Enum for synced calendar provider
|
|
@@ -1945,271 +2001,136 @@ interface PaymentConfirmationNotification extends BaseNotification {
|
|
|
1945
2001
|
*/
|
|
1946
2002
|
type Notification = PreRequirementNotification | PostRequirementNotification | RequirementInstructionDueNotification | AppointmentReminderNotification | AppointmentStatusChangeNotification | AppointmentRescheduledProposalNotification | AppointmentCancelledNotification | FormReminderNotification | FormSubmissionConfirmationNotification | ReviewRequestNotification | GeneralMessageNotification | PaymentConfirmationNotification;
|
|
1947
2003
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
*/
|
|
1967
|
-
updateNotificationStatus(notificationId: string, status: NotificationStatus, error?: string): Promise<void>;
|
|
2004
|
+
/**
|
|
2005
|
+
* Minimal interface for the new mailgun.js client's messages API
|
|
2006
|
+
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
2007
|
+
* or provides clearer typing if it is.
|
|
2008
|
+
*/
|
|
2009
|
+
interface NewMailgunMessagesAPI$2 {
|
|
2010
|
+
create(domain: string, data: any): Promise<any>;
|
|
2011
|
+
}
|
|
2012
|
+
interface NewMailgunClient$2 {
|
|
2013
|
+
messages: NewMailgunMessagesAPI$2;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Base mailing service class that provides common functionality for all mailing services
|
|
2017
|
+
* This version is updated to expect a mailgun.js v10+ client.
|
|
2018
|
+
*/
|
|
2019
|
+
declare class BaseMailingService {
|
|
2020
|
+
protected db: FirebaseFirestore.Firestore;
|
|
2021
|
+
protected mailgunClient: NewMailgunClient$2;
|
|
1968
2022
|
/**
|
|
1969
|
-
*
|
|
2023
|
+
* Constructor for BaseMailingService
|
|
2024
|
+
* @param firestore Firestore instance provided by the caller
|
|
2025
|
+
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
1970
2026
|
*/
|
|
1971
|
-
|
|
2027
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$2);
|
|
1972
2028
|
/**
|
|
1973
|
-
*
|
|
2029
|
+
* Sends an email using the new Mailgun client API.
|
|
2030
|
+
* @param domain The Mailgun domain to send from (e.g., mg.metaesthetics.net)
|
|
2031
|
+
* @param data Email data to send, compatible with mailgun.js messages.create API
|
|
2032
|
+
* @returns Promise with the sending result
|
|
1974
2033
|
*/
|
|
1975
|
-
|
|
2034
|
+
protected sendEmail(domain: string, // The new API requires the domain as the first argument to messages.create
|
|
2035
|
+
data: any): Promise<any>;
|
|
1976
2036
|
/**
|
|
1977
|
-
*
|
|
2037
|
+
* Logs email sending attempt to Firestore for tracking
|
|
2038
|
+
* @param emailData Email data that was sent
|
|
2039
|
+
* @param success Whether the email was sent successfully
|
|
2040
|
+
* @param error Error object if the email failed to send
|
|
1978
2041
|
*/
|
|
1979
|
-
|
|
2042
|
+
protected logEmailAttempt(emailData: {
|
|
2043
|
+
to: string;
|
|
2044
|
+
subject: string;
|
|
2045
|
+
templateName?: string;
|
|
2046
|
+
}, success: boolean, error?: any): Promise<void>;
|
|
1980
2047
|
/**
|
|
1981
|
-
*
|
|
1982
|
-
* @param
|
|
1983
|
-
* @param
|
|
1984
|
-
* @
|
|
1985
|
-
* @param recipientRole The role of the recipient (e.g., PATIENT, PRACTITIONER).
|
|
2048
|
+
* Renders a simple HTML email template with variables
|
|
2049
|
+
* @param template HTML template string
|
|
2050
|
+
* @param variables Key-value pairs to replace in the template
|
|
2051
|
+
* @returns Rendered HTML string
|
|
1986
2052
|
*/
|
|
1987
|
-
|
|
1988
|
-
sendAppointmentCancelledPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
1989
|
-
sendAppointmentRescheduledProposalPush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
1990
|
-
sendPaymentUpdatePush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
1991
|
-
sendReviewRequestPush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
1992
|
-
sendReviewAddedPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
2053
|
+
protected renderTemplate(template: string, variables: Record<string, string>): string;
|
|
1993
2054
|
}
|
|
1994
2055
|
|
|
2056
|
+
interface NewMailgunMessagesAPI$1 {
|
|
2057
|
+
create(domain: string, data: any): Promise<any>;
|
|
2058
|
+
}
|
|
2059
|
+
interface NewMailgunClient$1 {
|
|
2060
|
+
messages: NewMailgunMessagesAPI$1;
|
|
2061
|
+
}
|
|
1995
2062
|
/**
|
|
1996
|
-
*
|
|
1997
|
-
* @description Handles aggregation tasks related to clinic data updates.
|
|
1998
|
-
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
1999
|
-
* triggered by changes in the clinics collection.
|
|
2063
|
+
* Interface for the data required to send a practitioner invitation email
|
|
2000
2064
|
*/
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2065
|
+
interface PractitionerInviteEmailData {
|
|
2066
|
+
/** The token object from the practitioner service */
|
|
2067
|
+
token: {
|
|
2068
|
+
id: string;
|
|
2069
|
+
token: string;
|
|
2070
|
+
practitionerId: string;
|
|
2071
|
+
email: string;
|
|
2072
|
+
clinicId: string;
|
|
2073
|
+
expiresAt: admin.firestore.Timestamp;
|
|
2074
|
+
};
|
|
2075
|
+
/** Practitioner basic info */
|
|
2076
|
+
practitioner: {
|
|
2077
|
+
firstName: string;
|
|
2078
|
+
lastName: string;
|
|
2079
|
+
};
|
|
2080
|
+
/** Clinic info */
|
|
2081
|
+
clinic: {
|
|
2082
|
+
name: string;
|
|
2083
|
+
contactEmail: string;
|
|
2084
|
+
contactName?: string;
|
|
2085
|
+
};
|
|
2086
|
+
/** Config options */
|
|
2087
|
+
options?: {
|
|
2088
|
+
registrationUrl?: string;
|
|
2089
|
+
customSubject?: string;
|
|
2090
|
+
fromAddress?: string;
|
|
2091
|
+
mailgunDomain?: string;
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* Service for sending practitioner invitation emails, updated for mailgun.js v10+
|
|
2096
|
+
*/
|
|
2097
|
+
declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
2098
|
+
private readonly DEFAULT_REGISTRATION_URL;
|
|
2099
|
+
private readonly DEFAULT_SUBJECT;
|
|
2100
|
+
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
2016
2101
|
/**
|
|
2017
|
-
*
|
|
2018
|
-
*
|
|
2019
|
-
* @param
|
|
2020
|
-
* @param clinicInfo - The updated ClinicInfo object to aggregate.
|
|
2021
|
-
* @returns {Promise<void>}
|
|
2022
|
-
* @throws Will throw an error if the batch write fails.
|
|
2102
|
+
* Constructor for PractitionerInviteMailingService
|
|
2103
|
+
* @param firestore Firestore instance provided by the caller
|
|
2104
|
+
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2023
2105
|
*/
|
|
2024
|
-
|
|
2106
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$1);
|
|
2025
2107
|
/**
|
|
2026
|
-
*
|
|
2027
|
-
* @param
|
|
2028
|
-
* @
|
|
2108
|
+
* Sends a practitioner invitation email
|
|
2109
|
+
* @param data The practitioner invitation data
|
|
2110
|
+
* @returns Promise resolved when email is sent
|
|
2029
2111
|
*/
|
|
2030
|
-
|
|
2112
|
+
sendInvitationEmail(data: PractitionerInviteEmailData): Promise<any>;
|
|
2031
2113
|
/**
|
|
2032
|
-
*
|
|
2033
|
-
*
|
|
2034
|
-
*
|
|
2114
|
+
* Handles the practitioner token creation event from Cloud Functions
|
|
2115
|
+
* Fetches necessary data using defined types and collection constants,
|
|
2116
|
+
* and sends the invitation email.
|
|
2117
|
+
* @param tokenData The fully typed token object including its id
|
|
2118
|
+
* @param fromAddress The 'from' email address to use, obtained from config
|
|
2119
|
+
* @param mailgunDomain The mailgun domain to use for sending
|
|
2120
|
+
* @returns Promise resolved when the email is sent
|
|
2035
2121
|
*/
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
* ClinicInfo (like name, photo). Therefore, this method currently has limited use
|
|
2042
|
-
* for general clinic info updates. It might be relevant if Clinic.isActive status changes.
|
|
2043
|
-
*
|
|
2044
|
-
* @param patientIds IDs of patients associated with the clinic (e.g., from PatientProfile.clinicIds).
|
|
2045
|
-
* @param clinicInfo The updated ClinicInfo object (primarily for logging/context).
|
|
2046
|
-
* @param clinicIsActive The current active status of the updated clinic.
|
|
2047
|
-
*/
|
|
2048
|
-
updateClinicInfoInPatients(patientIds: string[], clinicInfo: ClinicInfo, clinicIsActive: boolean): Promise<void>;
|
|
2049
|
-
/**
|
|
2050
|
-
* Updates the eventLocation for upcoming calendar events associated with a specific clinic.
|
|
2051
|
-
* Uses a collection group query to find relevant events across all potential parent collections.
|
|
2052
|
-
*
|
|
2053
|
-
* @param clinicId The ID of the clinic whose location might have changed.
|
|
2054
|
-
* @param newLocation The new ClinicLocation object.
|
|
2055
|
-
*/
|
|
2056
|
-
updateClinicLocationInCalendarEvents(clinicId: string, newLocation: ClinicLocation): Promise<void>;
|
|
2057
|
-
/**
|
|
2058
|
-
* Updates clinic info in all upcoming calendar events associated with a specific clinic.
|
|
2059
|
-
* @param clinicId The ID of the clinic whose info has been updated.
|
|
2060
|
-
* @param clinicInfo The updated ClinicInfo object.
|
|
2061
|
-
*/
|
|
2062
|
-
updateClinicInfoInCalendarEvents(clinicId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
2063
|
-
/**
|
|
2064
|
-
* Removes clinic from practitioners when a clinic is deleted.
|
|
2065
|
-
* @param practitionerIds IDs of practitioners associated with the clinic.
|
|
2066
|
-
* @param clinicId The ID of the deleted clinic.
|
|
2067
|
-
*/
|
|
2068
|
-
removeClinicFromPractitioners(practitionerIds: string[], clinicId: string): Promise<void>;
|
|
2069
|
-
/**
|
|
2070
|
-
* Inactivates all procedures associated with a deleted clinic
|
|
2071
|
-
* @param procedureIds IDs of procedures associated with the clinic
|
|
2072
|
-
*/
|
|
2073
|
-
inactivateProceduresForClinic(procedureIds: string[]): Promise<void>;
|
|
2074
|
-
/**
|
|
2075
|
-
* Removes clinic from clinic group when a clinic is deleted
|
|
2076
|
-
* @param clinicGroupId ID of the parent clinic group
|
|
2077
|
-
* @param clinicId ID of the deleted clinic
|
|
2078
|
-
*/
|
|
2079
|
-
removeClinicFromClinicGroup(clinicGroupId: string, clinicId: string): Promise<void>;
|
|
2080
|
-
/**
|
|
2081
|
-
* Removes clinic from patients when a clinic is deleted
|
|
2082
|
-
* @param patientIds IDs of patients associated with the clinic
|
|
2083
|
-
* @param clinicId ID of the deleted clinic
|
|
2084
|
-
*/
|
|
2085
|
-
removeClinicFromPatients(patientIds: string[], clinicId: string): Promise<void>;
|
|
2086
|
-
/**
|
|
2087
|
-
* Cancels all upcoming calendar events associated with a deleted clinic
|
|
2088
|
-
* @param clinicId ID of the deleted clinic
|
|
2089
|
-
*/
|
|
2090
|
-
cancelUpcomingCalendarEventsForClinic(clinicId: string): Promise<void>;
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
/**
|
|
2094
|
-
* @class PractitionerAggregationService
|
|
2095
|
-
* @description Handles aggregation tasks related to practitioner data updates/deletions.
|
|
2096
|
-
*/
|
|
2097
|
-
declare class PractitionerAggregationService {
|
|
2098
|
-
private db;
|
|
2099
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2100
|
-
/**
|
|
2101
|
-
* Adds practitioner information to a clinic when a new practitioner is created
|
|
2102
|
-
* @param clinicId - ID of the clinic to update
|
|
2103
|
-
* @param doctorInfo - Doctor information to add to the clinic
|
|
2104
|
-
* @returns {Promise<void>}
|
|
2105
|
-
*/
|
|
2106
|
-
addPractitionerToClinic(clinicId: string, doctorInfo: DoctorInfo): Promise<void>;
|
|
2107
|
-
/**
|
|
2108
|
-
* Updates practitioner information in associated clinics
|
|
2109
|
-
* @param clinicIds - IDs of clinics associated with the practitioner
|
|
2110
|
-
* @param doctorInfo - Updated doctor information
|
|
2111
|
-
* @returns {Promise<void>}
|
|
2112
|
-
*/
|
|
2113
|
-
updatePractitionerInfoInClinics(clinicIds: string[], doctorInfo: DoctorInfo): Promise<void>;
|
|
2114
|
-
/**
|
|
2115
|
-
* Updates practitioner information in associated procedures
|
|
2116
|
-
* @param procedureIds - IDs of procedures associated with the practitioner
|
|
2117
|
-
* @param doctorInfo - Updated doctor information
|
|
2118
|
-
* @returns {Promise<void>}
|
|
2119
|
-
*/
|
|
2120
|
-
updatePractitionerInfoInProcedures(procedureIds: string[], doctorInfo: DoctorInfo): Promise<void>;
|
|
2121
|
-
/**
|
|
2122
|
-
* Updates practitioner information in calendar events
|
|
2123
|
-
* @param practitionerId - ID of the practitioner
|
|
2124
|
-
* @param practitionerInfo - Updated practitioner information
|
|
2125
|
-
* @returns {Promise<void>}
|
|
2126
|
-
*/
|
|
2127
|
-
updatePractitionerInfoInCalendarEvents(practitionerId: string, practitionerInfo: DoctorInfo): Promise<void>;
|
|
2128
|
-
/**
|
|
2129
|
-
* Removes practitioner from clinics when a practitioner is deleted
|
|
2130
|
-
* @param clinicIds - IDs of clinics associated with the practitioner
|
|
2131
|
-
* @param practitionerId - ID of the deleted practitioner
|
|
2132
|
-
* @returns {Promise<void>}
|
|
2133
|
-
*/
|
|
2134
|
-
removePractitionerFromClinics(clinicIds: string[], practitionerId: string): Promise<void>;
|
|
2135
|
-
/**
|
|
2136
|
-
* Cancels all upcoming calendar events for a deleted practitioner
|
|
2137
|
-
* @param practitionerId - ID of the deleted practitioner
|
|
2138
|
-
* @returns {Promise<void>}
|
|
2139
|
-
*/
|
|
2140
|
-
cancelUpcomingCalendarEventsForPractitioner(practitionerId: string): Promise<void>;
|
|
2141
|
-
/**
|
|
2142
|
-
* Removes practitioner from patients when a practitioner is deleted
|
|
2143
|
-
* @param patientIds - IDs of patients associated with the practitioner
|
|
2144
|
-
* @param practitionerId - ID of the deleted practitioner
|
|
2145
|
-
* @returns {Promise<void>}
|
|
2146
|
-
*/
|
|
2147
|
-
removePractitionerFromPatients(patientIds: string[], practitionerId: string): Promise<void>;
|
|
2148
|
-
/**
|
|
2149
|
-
* Inactivates all procedures associated with a deleted practitioner
|
|
2150
|
-
* @param procedureIds - IDs of procedures provided by the practitioner
|
|
2151
|
-
* @returns {Promise<void>}
|
|
2152
|
-
*/
|
|
2153
|
-
inactivateProceduresForPractitioner(procedureIds: string[]): Promise<void>;
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
/**
|
|
2157
|
-
* Minimal interface for the new mailgun.js client's messages API
|
|
2158
|
-
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
2159
|
-
* or provides clearer typing if it is.
|
|
2160
|
-
*/
|
|
2161
|
-
interface NewMailgunMessagesAPI$2 {
|
|
2162
|
-
create(domain: string, data: any): Promise<any>;
|
|
2163
|
-
}
|
|
2164
|
-
interface NewMailgunClient$2 {
|
|
2165
|
-
messages: NewMailgunMessagesAPI$2;
|
|
2166
|
-
}
|
|
2167
|
-
/**
|
|
2168
|
-
* Base mailing service class that provides common functionality for all mailing services
|
|
2169
|
-
* This version is updated to expect a mailgun.js v10+ client.
|
|
2170
|
-
*/
|
|
2171
|
-
declare class BaseMailingService {
|
|
2172
|
-
protected db: FirebaseFirestore.Firestore;
|
|
2173
|
-
protected mailgunClient: NewMailgunClient$2;
|
|
2174
|
-
/**
|
|
2175
|
-
* Constructor for BaseMailingService
|
|
2176
|
-
* @param firestore Firestore instance provided by the caller
|
|
2177
|
-
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2178
|
-
*/
|
|
2179
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$2);
|
|
2180
|
-
/**
|
|
2181
|
-
* Sends an email using the new Mailgun client API.
|
|
2182
|
-
* @param domain The Mailgun domain to send from (e.g., mg.metaesthetics.net)
|
|
2183
|
-
* @param data Email data to send, compatible with mailgun.js messages.create API
|
|
2184
|
-
* @returns Promise with the sending result
|
|
2185
|
-
*/
|
|
2186
|
-
protected sendEmail(domain: string, // The new API requires the domain as the first argument to messages.create
|
|
2187
|
-
data: any): Promise<any>;
|
|
2188
|
-
/**
|
|
2189
|
-
* Logs email sending attempt to Firestore for tracking
|
|
2190
|
-
* @param emailData Email data that was sent
|
|
2191
|
-
* @param success Whether the email was sent successfully
|
|
2192
|
-
* @param error Error object if the email failed to send
|
|
2193
|
-
*/
|
|
2194
|
-
protected logEmailAttempt(emailData: {
|
|
2195
|
-
to: string;
|
|
2196
|
-
subject: string;
|
|
2197
|
-
templateName?: string;
|
|
2198
|
-
}, success: boolean, error?: any): Promise<void>;
|
|
2199
|
-
/**
|
|
2200
|
-
* Renders a simple HTML email template with variables
|
|
2201
|
-
* @param template HTML template string
|
|
2202
|
-
* @param variables Key-value pairs to replace in the template
|
|
2203
|
-
* @returns Rendered HTML string
|
|
2204
|
-
*/
|
|
2205
|
-
protected renderTemplate(template: string, variables: Record<string, string>): string;
|
|
2122
|
+
handleTokenCreationEvent(tokenData: PractitionerToken, mailgunConfig: {
|
|
2123
|
+
fromAddress: string;
|
|
2124
|
+
domain: string;
|
|
2125
|
+
registrationUrl?: string;
|
|
2126
|
+
}): Promise<void>;
|
|
2206
2127
|
}
|
|
2207
2128
|
|
|
2208
|
-
interface NewMailgunMessagesAPI
|
|
2129
|
+
interface NewMailgunMessagesAPI {
|
|
2209
2130
|
create(domain: string, data: any): Promise<any>;
|
|
2210
2131
|
}
|
|
2211
|
-
interface NewMailgunClient
|
|
2212
|
-
messages: NewMailgunMessagesAPI
|
|
2132
|
+
interface NewMailgunClient {
|
|
2133
|
+
messages: NewMailgunMessagesAPI;
|
|
2213
2134
|
}
|
|
2214
2135
|
/**
|
|
2215
2136
|
* Interface for sending practitioner invitation email data
|
|
@@ -2295,7 +2216,7 @@ declare class ExistingPractitionerInviteMailingService extends BaseMailingServic
|
|
|
2295
2216
|
* @param firestore Firestore instance provided by the caller
|
|
2296
2217
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2297
2218
|
*/
|
|
2298
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient
|
|
2219
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient);
|
|
2299
2220
|
/**
|
|
2300
2221
|
* Sends an invitation email to an existing practitioner
|
|
2301
2222
|
* @param data The invitation email data
|
|
@@ -2354,287 +2275,55 @@ declare class ExistingPractitionerInviteMailingService extends BaseMailingServic
|
|
|
2354
2275
|
}
|
|
2355
2276
|
|
|
2356
2277
|
/**
|
|
2357
|
-
* @class
|
|
2358
|
-
* @description Handles aggregation tasks and side effects related to
|
|
2278
|
+
* @class AppointmentAggregationService
|
|
2279
|
+
* @description Handles aggregation tasks and side effects related to appointment lifecycle events.
|
|
2359
2280
|
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2360
|
-
* triggered by changes in the
|
|
2281
|
+
* triggered by changes in the appointments collection.
|
|
2361
2282
|
*/
|
|
2362
|
-
declare class
|
|
2283
|
+
declare class AppointmentAggregationService {
|
|
2363
2284
|
private db;
|
|
2364
|
-
private
|
|
2285
|
+
private appointmentMailingService;
|
|
2286
|
+
private notificationsAdmin;
|
|
2287
|
+
private calendarAdminService;
|
|
2288
|
+
private patientRequirementsAdminService;
|
|
2365
2289
|
/**
|
|
2366
|
-
* Constructor for
|
|
2290
|
+
* Constructor for AppointmentAggregationService.
|
|
2291
|
+
* @param mailgunClient - An initialized Mailgun client instance.
|
|
2367
2292
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2368
|
-
* @param mailingService Optional mailing service for sending emails
|
|
2369
2293
|
*/
|
|
2370
|
-
constructor(
|
|
2294
|
+
constructor(mailgunClient: any, // Type as 'any' for now, to be provided by the calling Cloud Function
|
|
2295
|
+
firestore?: admin.firestore.Firestore);
|
|
2371
2296
|
/**
|
|
2372
|
-
* Handles side effects when
|
|
2373
|
-
* This function would typically be called by
|
|
2374
|
-
* @param {
|
|
2375
|
-
* @param {object} emailConfig - Optional email configuration for sending invite emails
|
|
2297
|
+
* Handles side effects when an appointment is first created.
|
|
2298
|
+
* This function would typically be called by an Firestore onCreate trigger.
|
|
2299
|
+
* @param {Appointment} appointment - The newly created Appointment object.
|
|
2376
2300
|
* @returns {Promise<void>}
|
|
2377
2301
|
*/
|
|
2378
|
-
|
|
2379
|
-
fromAddress: string;
|
|
2380
|
-
domain: string;
|
|
2381
|
-
acceptUrl: string;
|
|
2382
|
-
rejectUrl: string;
|
|
2383
|
-
}): Promise<void>;
|
|
2302
|
+
handleAppointmentCreate(appointment: Appointment): Promise<void>;
|
|
2384
2303
|
/**
|
|
2385
|
-
* Handles side effects when
|
|
2386
|
-
* This function would typically be called by
|
|
2387
|
-
* @param {
|
|
2388
|
-
* @param {
|
|
2389
|
-
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2304
|
+
* Handles side effects when an appointment is updated.
|
|
2305
|
+
* This function would typically be called by an Firestore onUpdate trigger.
|
|
2306
|
+
* @param {Appointment} before - The Appointment object before the update.
|
|
2307
|
+
* @param {Appointment} after - The Appointment object after the update.
|
|
2390
2308
|
* @returns {Promise<void>}
|
|
2391
2309
|
*/
|
|
2392
|
-
|
|
2393
|
-
fromAddress: string;
|
|
2394
|
-
domain: string;
|
|
2395
|
-
clinicDashboardUrl: string;
|
|
2396
|
-
practitionerProfileUrl?: string;
|
|
2397
|
-
findPractitionersUrl?: string;
|
|
2398
|
-
}): Promise<void>;
|
|
2310
|
+
handleAppointmentUpdate(before: Appointment, after: Appointment): Promise<void>;
|
|
2399
2311
|
/**
|
|
2400
|
-
* Handles side effects when
|
|
2401
|
-
* @param
|
|
2312
|
+
* Handles side effects when an appointment is deleted.
|
|
2313
|
+
* @param deletedAppointment - The Appointment object that was deleted.
|
|
2402
2314
|
* @returns {Promise<void>}
|
|
2403
2315
|
*/
|
|
2404
|
-
|
|
2316
|
+
handleAppointmentDelete(deletedAppointment: Appointment): Promise<void>;
|
|
2405
2317
|
/**
|
|
2406
|
-
*
|
|
2407
|
-
*
|
|
2408
|
-
*
|
|
2409
|
-
*
|
|
2410
|
-
*
|
|
2318
|
+
* Creates PRE_APPOINTMENT PatientRequirementInstance documents for a given appointment.
|
|
2319
|
+
* Uses the `appointment.preProcedureRequirements` array, which should contain relevant Requirement templates.
|
|
2320
|
+
* For each active PRE requirement template, it constructs a new PatientRequirementInstance document
|
|
2321
|
+
* with derived instructions and batch writes them to Firestore under the patient's `patient_requirements` subcollection.
|
|
2322
|
+
*
|
|
2323
|
+
* @param {Appointment} appointment - The appointment for which to create pre-requirement instances.
|
|
2324
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
2411
2325
|
*/
|
|
2412
|
-
private
|
|
2413
|
-
/**
|
|
2414
|
-
* Handles the business logic when a practitioner rejects an invite.
|
|
2415
|
-
* @param {PractitionerInvite} invite - The rejected invite
|
|
2416
|
-
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2417
|
-
* @returns {Promise<void>}
|
|
2418
|
-
*/
|
|
2419
|
-
private handleInviteRejected;
|
|
2420
|
-
/**
|
|
2421
|
-
* Handles the business logic when an invite is cancelled by admin.
|
|
2422
|
-
* @param {PractitionerInvite} invite - The cancelled invite
|
|
2423
|
-
* @returns {Promise<void>}
|
|
2424
|
-
*/
|
|
2425
|
-
private handleInviteCancelled;
|
|
2426
|
-
/**
|
|
2427
|
-
* Adds practitioner information to a clinic when an invite is accepted.
|
|
2428
|
-
* @param clinicId - ID of the clinic to update
|
|
2429
|
-
* @param doctorInfo - Doctor information to add to the clinic
|
|
2430
|
-
* @returns {Promise<void>}
|
|
2431
|
-
*/
|
|
2432
|
-
private addPractitionerToClinic;
|
|
2433
|
-
/**
|
|
2434
|
-
* Updates practitioner information in a clinic.
|
|
2435
|
-
* @param clinicId - ID of the clinic to update
|
|
2436
|
-
* @param doctorInfo - Updated doctor information
|
|
2437
|
-
* @returns {Promise<void>}
|
|
2438
|
-
*/
|
|
2439
|
-
private updatePractitionerInfoInClinic;
|
|
2440
|
-
/**
|
|
2441
|
-
* Adds a clinic to a practitioner's profile with working hours from the invite.
|
|
2442
|
-
* @param {string} practitionerId - The practitioner ID
|
|
2443
|
-
* @param {ClinicInfo} clinicInfo - The clinic information
|
|
2444
|
-
* @param {PractitionerInvite} invite - The accepted invite containing working hours
|
|
2445
|
-
* @returns {Promise<void>}
|
|
2446
|
-
*/
|
|
2447
|
-
private addClinicToPractitioner;
|
|
2448
|
-
/**
|
|
2449
|
-
* Updates the working hours for an existing practitioner-clinic relationship.
|
|
2450
|
-
* @param {string} practitionerId - The practitioner ID
|
|
2451
|
-
* @param {PractitionerInvite} invite - The accepted invite containing new working hours
|
|
2452
|
-
* @returns {Promise<void>}
|
|
2453
|
-
*/
|
|
2454
|
-
private updatePractitionerWorkingHours;
|
|
2455
|
-
/**
|
|
2456
|
-
* Fetches a clinic admin by ID
|
|
2457
|
-
* @param adminId The clinic admin ID
|
|
2458
|
-
* @returns The clinic admin or null if not found
|
|
2459
|
-
*/
|
|
2460
|
-
private fetchClinicAdminById;
|
|
2461
|
-
/**
|
|
2462
|
-
* Fetches a practitioner by ID.
|
|
2463
|
-
* @param practitionerId The practitioner ID.
|
|
2464
|
-
* @returns {Promise<Practitioner | null>} The practitioner or null if not found.
|
|
2465
|
-
*/
|
|
2466
|
-
private fetchPractitionerById;
|
|
2467
|
-
/**
|
|
2468
|
-
* Fetches a clinic by ID.
|
|
2469
|
-
* @param clinicId The clinic ID.
|
|
2470
|
-
* @returns {Promise<Clinic | null>} The clinic or null if not found.
|
|
2471
|
-
*/
|
|
2472
|
-
private fetchClinicById;
|
|
2473
|
-
/**
|
|
2474
|
-
* Sends acceptance notification email to clinic admin
|
|
2475
|
-
* @param invite The accepted invite
|
|
2476
|
-
* @param practitioner The practitioner who accepted
|
|
2477
|
-
* @param clinic The clinic that sent the invite
|
|
2478
|
-
* @param emailConfig Email configuration
|
|
2479
|
-
*/
|
|
2480
|
-
private sendAcceptanceNotificationEmail;
|
|
2481
|
-
/**
|
|
2482
|
-
* Sends rejection notification email to clinic admin
|
|
2483
|
-
* @param invite The rejected invite
|
|
2484
|
-
* @param practitioner The practitioner who rejected
|
|
2485
|
-
* @param clinic The clinic that sent the invite
|
|
2486
|
-
* @param emailConfig Email configuration
|
|
2487
|
-
*/
|
|
2488
|
-
private sendRejectionNotificationEmail;
|
|
2489
|
-
}
|
|
2490
|
-
|
|
2491
|
-
/**
|
|
2492
|
-
* @class ProcedureAggregationService
|
|
2493
|
-
* @description Handles aggregation tasks related to procedure data updates/deletions.
|
|
2494
|
-
*/
|
|
2495
|
-
declare class ProcedureAggregationService {
|
|
2496
|
-
private db;
|
|
2497
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2498
|
-
/**
|
|
2499
|
-
* Adds procedure information to a practitioner when a new procedure is created
|
|
2500
|
-
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2501
|
-
* @param procedureSummary - Summary information about the procedure
|
|
2502
|
-
* @returns {Promise<void>}
|
|
2503
|
-
*/
|
|
2504
|
-
addProcedureToPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2505
|
-
/**
|
|
2506
|
-
* Adds procedure information to a clinic when a new procedure is created
|
|
2507
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2508
|
-
* @param procedureSummary - Summary information about the procedure
|
|
2509
|
-
* @returns {Promise<void>}
|
|
2510
|
-
*/
|
|
2511
|
-
addProcedureToClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2512
|
-
/**
|
|
2513
|
-
* Updates procedure information in a practitioner document
|
|
2514
|
-
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2515
|
-
* @param procedureSummary - Updated summary information about the procedure
|
|
2516
|
-
* @returns {Promise<void>}
|
|
2517
|
-
*/
|
|
2518
|
-
updateProcedureInfoInPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2519
|
-
/**
|
|
2520
|
-
* Updates procedure information in a clinic document
|
|
2521
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2522
|
-
* @param procedureSummary - Updated summary information about the procedure
|
|
2523
|
-
* @returns {Promise<void>}
|
|
2524
|
-
*/
|
|
2525
|
-
updateProcedureInfoInClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2526
|
-
/**
|
|
2527
|
-
* Updates procedure information in calendar events
|
|
2528
|
-
* @param procedureId - ID of the procedure
|
|
2529
|
-
* @param procedureInfo - Updated procedure information
|
|
2530
|
-
* @returns {Promise<void>}
|
|
2531
|
-
*/
|
|
2532
|
-
updateProcedureInfoInCalendarEvents(procedureId: string, procedureInfo: any): Promise<void>;
|
|
2533
|
-
/**
|
|
2534
|
-
* Cancels all upcoming calendar events for a procedure
|
|
2535
|
-
* @param procedureId - ID of the procedure
|
|
2536
|
-
* @returns {Promise<void>}
|
|
2537
|
-
*/
|
|
2538
|
-
cancelUpcomingCalendarEventsForProcedure(procedureId: string): Promise<void>;
|
|
2539
|
-
/**
|
|
2540
|
-
* Removes procedure from a practitioner when a procedure is deleted or inactivated
|
|
2541
|
-
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2542
|
-
* @param procedureId - ID of the procedure
|
|
2543
|
-
* @param clinicId - Optional clinic ID for free consultation removal
|
|
2544
|
-
* @returns {Promise<void>}
|
|
2545
|
-
*/
|
|
2546
|
-
removeProcedureFromPractitioner(practitionerId: string, procedureId: string, clinicId?: string): Promise<void>;
|
|
2547
|
-
/**
|
|
2548
|
-
* Removes procedure from a clinic when a procedure is deleted or inactivated
|
|
2549
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2550
|
-
* @param procedureId - ID of the procedure
|
|
2551
|
-
* @returns {Promise<void>}
|
|
2552
|
-
*/
|
|
2553
|
-
removeProcedureFromClinic(clinicId: string, procedureId: string): Promise<void>;
|
|
2554
|
-
/**
|
|
2555
|
-
* Handles procedure status changes (activation/deactivation) specifically for free consultations
|
|
2556
|
-
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2557
|
-
* @param procedureId - ID of the procedure
|
|
2558
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2559
|
-
* @param isActive - New active status of the procedure
|
|
2560
|
-
* @param technologyName - Technology name of the procedure (to check if it's a free consultation)
|
|
2561
|
-
* @returns {Promise<void>}
|
|
2562
|
-
*/
|
|
2563
|
-
handleFreeConsultationStatusChange(practitionerId: string, procedureId: string, clinicId: string, isActive: boolean, technologyName: string): Promise<void>;
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
/**
|
|
2567
|
-
* @class PatientAggregationService
|
|
2568
|
-
* @description Handles aggregation tasks related to patient data updates/deletions.
|
|
2569
|
-
*/
|
|
2570
|
-
declare class PatientAggregationService {
|
|
2571
|
-
private db;
|
|
2572
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2573
|
-
/**
|
|
2574
|
-
* Updates patient information in calendar events
|
|
2575
|
-
* @param patientId - ID of the patient
|
|
2576
|
-
* @param patientInfo - Updated patient information
|
|
2577
|
-
* @returns {Promise<void>}
|
|
2578
|
-
*/
|
|
2579
|
-
updatePatientInfoInCalendarEvents(patientId: string, patientInfo: any): Promise<void>;
|
|
2580
|
-
/**
|
|
2581
|
-
* Cancels all upcoming calendar events associated with a deleted patient
|
|
2582
|
-
* @param patientId - ID of the deleted patient
|
|
2583
|
-
* @returns {Promise<void>}
|
|
2584
|
-
*/
|
|
2585
|
-
cancelUpcomingCalendarEventsForPatient(patientId: string): Promise<void>;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
/**
|
|
2589
|
-
* @class AppointmentAggregationService
|
|
2590
|
-
* @description Handles aggregation tasks and side effects related to appointment lifecycle events.
|
|
2591
|
-
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2592
|
-
* triggered by changes in the appointments collection.
|
|
2593
|
-
*/
|
|
2594
|
-
declare class AppointmentAggregationService {
|
|
2595
|
-
private db;
|
|
2596
|
-
private appointmentMailingService;
|
|
2597
|
-
private notificationsAdmin;
|
|
2598
|
-
private calendarAdminService;
|
|
2599
|
-
private patientRequirementsAdminService;
|
|
2600
|
-
/**
|
|
2601
|
-
* Constructor for AppointmentAggregationService.
|
|
2602
|
-
* @param mailgunClient - An initialized Mailgun client instance.
|
|
2603
|
-
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2604
|
-
*/
|
|
2605
|
-
constructor(mailgunClient: any, // Type as 'any' for now, to be provided by the calling Cloud Function
|
|
2606
|
-
firestore?: admin.firestore.Firestore);
|
|
2607
|
-
/**
|
|
2608
|
-
* Handles side effects when an appointment is first created.
|
|
2609
|
-
* This function would typically be called by an Firestore onCreate trigger.
|
|
2610
|
-
* @param {Appointment} appointment - The newly created Appointment object.
|
|
2611
|
-
* @returns {Promise<void>}
|
|
2612
|
-
*/
|
|
2613
|
-
handleAppointmentCreate(appointment: Appointment): Promise<void>;
|
|
2614
|
-
/**
|
|
2615
|
-
* Handles side effects when an appointment is updated.
|
|
2616
|
-
* This function would typically be called by an Firestore onUpdate trigger.
|
|
2617
|
-
* @param {Appointment} before - The Appointment object before the update.
|
|
2618
|
-
* @param {Appointment} after - The Appointment object after the update.
|
|
2619
|
-
* @returns {Promise<void>}
|
|
2620
|
-
*/
|
|
2621
|
-
handleAppointmentUpdate(before: Appointment, after: Appointment): Promise<void>;
|
|
2622
|
-
/**
|
|
2623
|
-
* Handles side effects when an appointment is deleted.
|
|
2624
|
-
* @param deletedAppointment - The Appointment object that was deleted.
|
|
2625
|
-
* @returns {Promise<void>}
|
|
2626
|
-
*/
|
|
2627
|
-
handleAppointmentDelete(deletedAppointment: Appointment): Promise<void>;
|
|
2628
|
-
/**
|
|
2629
|
-
* Creates PRE_APPOINTMENT PatientRequirementInstance documents for a given appointment.
|
|
2630
|
-
* Uses the `appointment.preProcedureRequirements` array, which should contain relevant Requirement templates.
|
|
2631
|
-
* For each active PRE requirement template, it constructs a new PatientRequirementInstance document
|
|
2632
|
-
* with derived instructions and batch writes them to Firestore under the patient's `patient_requirements` subcollection.
|
|
2633
|
-
*
|
|
2634
|
-
* @param {Appointment} appointment - The appointment for which to create pre-requirement instances.
|
|
2635
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
2636
|
-
*/
|
|
2637
|
-
private createPreAppointmentRequirementInstances;
|
|
2326
|
+
private createPreAppointmentRequirementInstances;
|
|
2638
2327
|
/**
|
|
2639
2328
|
* Creates POST_APPOINTMENT PatientRequirementInstance documents for a given appointment.
|
|
2640
2329
|
* Uses the `appointment.postProcedureRequirements` array.
|
|
@@ -2715,40 +2404,433 @@ declare class AppointmentAggregationService {
|
|
|
2715
2404
|
}
|
|
2716
2405
|
|
|
2717
2406
|
/**
|
|
2718
|
-
* @class
|
|
2719
|
-
* @description Handles aggregation tasks related to
|
|
2720
|
-
*
|
|
2407
|
+
* @class ClinicAggregationService
|
|
2408
|
+
* @description Handles aggregation tasks related to clinic data updates.
|
|
2409
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2410
|
+
* triggered by changes in the clinics collection.
|
|
2721
2411
|
*/
|
|
2722
|
-
declare class
|
|
2412
|
+
declare class ClinicAggregationService {
|
|
2723
2413
|
private db;
|
|
2724
2414
|
/**
|
|
2725
|
-
* Constructor for
|
|
2415
|
+
* Constructor for ClinicAggregationService.
|
|
2726
2416
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2727
2417
|
*/
|
|
2728
2418
|
constructor(firestore?: admin.firestore.Firestore);
|
|
2729
2419
|
/**
|
|
2730
|
-
*
|
|
2731
|
-
*
|
|
2732
|
-
* @param
|
|
2420
|
+
* Adds clinic information to a clinic group when a new clinic is created
|
|
2421
|
+
* @param clinicGroupId - ID of the parent clinic group
|
|
2422
|
+
* @param clinicInfo - The clinic information to add to the group
|
|
2733
2423
|
* @returns {Promise<void>}
|
|
2424
|
+
* @throws Will throw an error if the batch write fails
|
|
2734
2425
|
*/
|
|
2735
|
-
|
|
2426
|
+
addClinicToClinicGroup(clinicGroupId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
2736
2427
|
/**
|
|
2737
|
-
*
|
|
2738
|
-
* This
|
|
2739
|
-
* @param
|
|
2428
|
+
* Updates the ClinicInfo within the clinicsInfo array for multiple practitioners.
|
|
2429
|
+
* This method is designed to be called when a clinic's core information changes.
|
|
2430
|
+
* @param practitionerIds - IDs of practitioners associated with the clinic.
|
|
2431
|
+
* @param clinicInfo - The updated ClinicInfo object to aggregate.
|
|
2740
2432
|
* @returns {Promise<void>}
|
|
2433
|
+
* @throws Will throw an error if the batch write fails.
|
|
2741
2434
|
*/
|
|
2742
|
-
|
|
2435
|
+
updateClinicInfoInPractitioners(practitionerIds: string[], clinicInfo: ClinicInfo): Promise<void>;
|
|
2743
2436
|
/**
|
|
2744
|
-
* Updates the
|
|
2745
|
-
*
|
|
2746
|
-
* @param
|
|
2747
|
-
|
|
2437
|
+
* Updates the aggregated clinicInfo field within relevant Procedure documents.
|
|
2438
|
+
* @param procedureIds IDs of procedures performed at the clinic.
|
|
2439
|
+
* @param clinicInfo The updated ClinicInfo object.
|
|
2440
|
+
*/
|
|
2441
|
+
updateClinicInfoInProcedures(procedureIds: string[], clinicInfo: ClinicInfo): Promise<void>;
|
|
2442
|
+
/**
|
|
2443
|
+
* Updates the aggregated clinicsInfo array within the parent ClinicGroup document.
|
|
2444
|
+
* @param clinicGroupId The ID of the parent clinic group.
|
|
2445
|
+
* @param clinicInfo The updated ClinicInfo object.
|
|
2446
|
+
*/
|
|
2447
|
+
updateClinicInfoInClinicGroup(clinicGroupId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
2448
|
+
/**
|
|
2449
|
+
* Updates relevant clinic information within Patient documents.
|
|
2450
|
+
* NOTE: PatientProfile stores an array of PatientClinic objects, which only contain
|
|
2451
|
+
* clinicId, assignedAt, assignedBy, isActive, notes. It does *not* store aggregated
|
|
2452
|
+
* ClinicInfo (like name, photo). Therefore, this method currently has limited use
|
|
2453
|
+
* for general clinic info updates. It might be relevant if Clinic.isActive status changes.
|
|
2454
|
+
*
|
|
2455
|
+
* @param patientIds IDs of patients associated with the clinic (e.g., from PatientProfile.clinicIds).
|
|
2456
|
+
* @param clinicInfo The updated ClinicInfo object (primarily for logging/context).
|
|
2457
|
+
* @param clinicIsActive The current active status of the updated clinic.
|
|
2458
|
+
*/
|
|
2459
|
+
updateClinicInfoInPatients(patientIds: string[], clinicInfo: ClinicInfo, clinicIsActive: boolean): Promise<void>;
|
|
2460
|
+
/**
|
|
2461
|
+
* Updates the eventLocation for upcoming calendar events associated with a specific clinic.
|
|
2462
|
+
* Uses a collection group query to find relevant events across all potential parent collections.
|
|
2463
|
+
*
|
|
2464
|
+
* @param clinicId The ID of the clinic whose location might have changed.
|
|
2465
|
+
* @param newLocation The new ClinicLocation object.
|
|
2466
|
+
*/
|
|
2467
|
+
updateClinicLocationInCalendarEvents(clinicId: string, newLocation: ClinicLocation): Promise<void>;
|
|
2468
|
+
/**
|
|
2469
|
+
* Updates clinic info in all upcoming calendar events associated with a specific clinic.
|
|
2470
|
+
* @param clinicId The ID of the clinic whose info has been updated.
|
|
2471
|
+
* @param clinicInfo The updated ClinicInfo object.
|
|
2472
|
+
*/
|
|
2473
|
+
updateClinicInfoInCalendarEvents(clinicId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
2474
|
+
/**
|
|
2475
|
+
* Removes clinic from practitioners when a clinic is deleted.
|
|
2476
|
+
* @param practitionerIds IDs of practitioners associated with the clinic.
|
|
2477
|
+
* @param clinicId The ID of the deleted clinic.
|
|
2478
|
+
*/
|
|
2479
|
+
removeClinicFromPractitioners(practitionerIds: string[], clinicId: string): Promise<void>;
|
|
2480
|
+
/**
|
|
2481
|
+
* Inactivates all procedures associated with a deleted clinic
|
|
2482
|
+
* @param procedureIds IDs of procedures associated with the clinic
|
|
2483
|
+
*/
|
|
2484
|
+
inactivateProceduresForClinic(procedureIds: string[]): Promise<void>;
|
|
2485
|
+
/**
|
|
2486
|
+
* Removes clinic from clinic group when a clinic is deleted
|
|
2487
|
+
* @param clinicGroupId ID of the parent clinic group
|
|
2488
|
+
* @param clinicId ID of the deleted clinic
|
|
2489
|
+
*/
|
|
2490
|
+
removeClinicFromClinicGroup(clinicGroupId: string, clinicId: string): Promise<void>;
|
|
2491
|
+
/**
|
|
2492
|
+
* Removes clinic from patients when a clinic is deleted
|
|
2493
|
+
* @param patientIds IDs of patients associated with the clinic
|
|
2494
|
+
* @param clinicId ID of the deleted clinic
|
|
2495
|
+
*/
|
|
2496
|
+
removeClinicFromPatients(patientIds: string[], clinicId: string): Promise<void>;
|
|
2497
|
+
/**
|
|
2498
|
+
* Cancels all upcoming calendar events associated with a deleted clinic
|
|
2499
|
+
* @param clinicId ID of the deleted clinic
|
|
2500
|
+
*/
|
|
2501
|
+
cancelUpcomingCalendarEventsForClinic(clinicId: string): Promise<void>;
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
/**
|
|
2505
|
+
* @class FilledFormsAggregationService
|
|
2506
|
+
* @description Handles aggregation tasks related to filled forms data updates.
|
|
2507
|
+
* Updates appointment documents with LinkedFormInfo when forms are created, updated, or deleted.
|
|
2508
|
+
*/
|
|
2509
|
+
declare class FilledFormsAggregationService {
|
|
2510
|
+
private db;
|
|
2511
|
+
/**
|
|
2512
|
+
* Constructor for FilledFormsAggregationService.
|
|
2513
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2514
|
+
*/
|
|
2515
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2516
|
+
/**
|
|
2517
|
+
* Handles side effects when a filled form is created or updated.
|
|
2518
|
+
* This function would typically be called by a Firestore onCreate or onUpdate trigger.
|
|
2519
|
+
* @param filledDocument The filled document that was created or updated.
|
|
2520
|
+
* @returns {Promise<void>}
|
|
2521
|
+
*/
|
|
2522
|
+
handleFilledFormCreateOrUpdate(filledDocument: FilledDocument): Promise<void>;
|
|
2523
|
+
/**
|
|
2524
|
+
* Handles side effects when a filled form is deleted.
|
|
2525
|
+
* This function would typically be called by a Firestore onDelete trigger.
|
|
2526
|
+
* @param filledDocument The filled document that was deleted.
|
|
2527
|
+
* @returns {Promise<void>}
|
|
2528
|
+
*/
|
|
2529
|
+
handleFilledFormDelete(filledDocument: FilledDocument): Promise<void>;
|
|
2530
|
+
/**
|
|
2531
|
+
* Updates the appointment's pendingUserFormsIds for a new required user form.
|
|
2532
|
+
* This should be called when a required user form is first created.
|
|
2533
|
+
* @param filledDocument The newly created filled document.
|
|
2534
|
+
* @returns {Promise<void>}
|
|
2748
2535
|
*/
|
|
2749
2536
|
handleRequiredUserFormCreate(filledDocument: FilledDocument): Promise<void>;
|
|
2750
2537
|
}
|
|
2751
2538
|
|
|
2539
|
+
/**
|
|
2540
|
+
* @class PatientAggregationService
|
|
2541
|
+
* @description Handles aggregation tasks related to patient data updates/deletions.
|
|
2542
|
+
*/
|
|
2543
|
+
declare class PatientAggregationService {
|
|
2544
|
+
private db;
|
|
2545
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2546
|
+
/**
|
|
2547
|
+
* Updates patient information in calendar events
|
|
2548
|
+
* @param patientId - ID of the patient
|
|
2549
|
+
* @param patientInfo - Updated patient information
|
|
2550
|
+
* @returns {Promise<void>}
|
|
2551
|
+
*/
|
|
2552
|
+
updatePatientInfoInCalendarEvents(patientId: string, patientInfo: any): Promise<void>;
|
|
2553
|
+
/**
|
|
2554
|
+
* Cancels all upcoming calendar events associated with a deleted patient
|
|
2555
|
+
* @param patientId - ID of the deleted patient
|
|
2556
|
+
* @returns {Promise<void>}
|
|
2557
|
+
*/
|
|
2558
|
+
cancelUpcomingCalendarEventsForPatient(patientId: string): Promise<void>;
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* @class PractitionerAggregationService
|
|
2563
|
+
* @description Handles aggregation tasks related to practitioner data updates/deletions.
|
|
2564
|
+
*/
|
|
2565
|
+
declare class PractitionerAggregationService {
|
|
2566
|
+
private db;
|
|
2567
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2568
|
+
/**
|
|
2569
|
+
* Adds practitioner information to a clinic when a new practitioner is created
|
|
2570
|
+
* @param clinicId - ID of the clinic to update
|
|
2571
|
+
* @param doctorInfo - Doctor information to add to the clinic
|
|
2572
|
+
* @returns {Promise<void>}
|
|
2573
|
+
*/
|
|
2574
|
+
addPractitionerToClinic(clinicId: string, doctorInfo: DoctorInfo): Promise<void>;
|
|
2575
|
+
/**
|
|
2576
|
+
* Updates practitioner information in associated clinics
|
|
2577
|
+
* @param clinicIds - IDs of clinics associated with the practitioner
|
|
2578
|
+
* @param doctorInfo - Updated doctor information
|
|
2579
|
+
* @returns {Promise<void>}
|
|
2580
|
+
*/
|
|
2581
|
+
updatePractitionerInfoInClinics(clinicIds: string[], doctorInfo: DoctorInfo): Promise<void>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Updates practitioner information in associated procedures
|
|
2584
|
+
* @param procedureIds - IDs of procedures associated with the practitioner
|
|
2585
|
+
* @param doctorInfo - Updated doctor information
|
|
2586
|
+
* @returns {Promise<void>}
|
|
2587
|
+
*/
|
|
2588
|
+
updatePractitionerInfoInProcedures(procedureIds: string[], doctorInfo: DoctorInfo): Promise<void>;
|
|
2589
|
+
/**
|
|
2590
|
+
* Updates practitioner information in calendar events
|
|
2591
|
+
* @param practitionerId - ID of the practitioner
|
|
2592
|
+
* @param practitionerInfo - Updated practitioner information
|
|
2593
|
+
* @returns {Promise<void>}
|
|
2594
|
+
*/
|
|
2595
|
+
updatePractitionerInfoInCalendarEvents(practitionerId: string, practitionerInfo: DoctorInfo): Promise<void>;
|
|
2596
|
+
/**
|
|
2597
|
+
* Removes practitioner from clinics when a practitioner is deleted
|
|
2598
|
+
* @param clinicIds - IDs of clinics associated with the practitioner
|
|
2599
|
+
* @param practitionerId - ID of the deleted practitioner
|
|
2600
|
+
* @returns {Promise<void>}
|
|
2601
|
+
*/
|
|
2602
|
+
removePractitionerFromClinics(clinicIds: string[], practitionerId: string): Promise<void>;
|
|
2603
|
+
/**
|
|
2604
|
+
* Cancels all upcoming calendar events for a deleted practitioner
|
|
2605
|
+
* @param practitionerId - ID of the deleted practitioner
|
|
2606
|
+
* @returns {Promise<void>}
|
|
2607
|
+
*/
|
|
2608
|
+
cancelUpcomingCalendarEventsForPractitioner(practitionerId: string): Promise<void>;
|
|
2609
|
+
/**
|
|
2610
|
+
* Removes practitioner from patients when a practitioner is deleted
|
|
2611
|
+
* @param patientIds - IDs of patients associated with the practitioner
|
|
2612
|
+
* @param practitionerId - ID of the deleted practitioner
|
|
2613
|
+
* @returns {Promise<void>}
|
|
2614
|
+
*/
|
|
2615
|
+
removePractitionerFromPatients(patientIds: string[], practitionerId: string): Promise<void>;
|
|
2616
|
+
/**
|
|
2617
|
+
* Inactivates all procedures associated with a deleted practitioner
|
|
2618
|
+
* @param procedureIds - IDs of procedures provided by the practitioner
|
|
2619
|
+
* @returns {Promise<void>}
|
|
2620
|
+
*/
|
|
2621
|
+
inactivateProceduresForPractitioner(procedureIds: string[]): Promise<void>;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* @class PractitionerInviteAggregationService
|
|
2626
|
+
* @description Handles aggregation tasks and side effects related to practitioner invite lifecycle events.
|
|
2627
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2628
|
+
* triggered by changes in the practitioner-invites collection.
|
|
2629
|
+
*/
|
|
2630
|
+
declare class PractitionerInviteAggregationService {
|
|
2631
|
+
private db;
|
|
2632
|
+
private mailingService?;
|
|
2633
|
+
/**
|
|
2634
|
+
* Constructor for PractitionerInviteAggregationService.
|
|
2635
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2636
|
+
* @param mailingService Optional mailing service for sending emails
|
|
2637
|
+
*/
|
|
2638
|
+
constructor(firestore?: admin.firestore.Firestore, mailingService?: ExistingPractitionerInviteMailingService);
|
|
2639
|
+
/**
|
|
2640
|
+
* Handles side effects when a practitioner invite is first created.
|
|
2641
|
+
* This function would typically be called by a Firestore onCreate trigger.
|
|
2642
|
+
* @param {PractitionerInvite} invite - The newly created PractitionerInvite object.
|
|
2643
|
+
* @param {object} emailConfig - Optional email configuration for sending invite emails
|
|
2644
|
+
* @returns {Promise<void>}
|
|
2645
|
+
*/
|
|
2646
|
+
handleInviteCreate(invite: PractitionerInvite, emailConfig?: {
|
|
2647
|
+
fromAddress: string;
|
|
2648
|
+
domain: string;
|
|
2649
|
+
acceptUrl: string;
|
|
2650
|
+
rejectUrl: string;
|
|
2651
|
+
}): Promise<void>;
|
|
2652
|
+
/**
|
|
2653
|
+
* Handles side effects when a practitioner invite is updated.
|
|
2654
|
+
* This function would typically be called by a Firestore onUpdate trigger.
|
|
2655
|
+
* @param {PractitionerInvite} before - The PractitionerInvite object before the update.
|
|
2656
|
+
* @param {PractitionerInvite} after - The PractitionerInvite object after the update.
|
|
2657
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2658
|
+
* @returns {Promise<void>}
|
|
2659
|
+
*/
|
|
2660
|
+
handleInviteUpdate(before: PractitionerInvite, after: PractitionerInvite, emailConfig?: {
|
|
2661
|
+
fromAddress: string;
|
|
2662
|
+
domain: string;
|
|
2663
|
+
clinicDashboardUrl: string;
|
|
2664
|
+
practitionerProfileUrl?: string;
|
|
2665
|
+
findPractitionersUrl?: string;
|
|
2666
|
+
}): Promise<void>;
|
|
2667
|
+
/**
|
|
2668
|
+
* Handles side effects when a practitioner invite is deleted.
|
|
2669
|
+
* @param deletedInvite - The PractitionerInvite object that was deleted.
|
|
2670
|
+
* @returns {Promise<void>}
|
|
2671
|
+
*/
|
|
2672
|
+
handleInviteDelete(deletedInvite: PractitionerInvite): Promise<void>;
|
|
2673
|
+
/**
|
|
2674
|
+
* Handles the business logic when a practitioner accepts an invite.
|
|
2675
|
+
* This includes adding the practitioner to the clinic and the clinic to the practitioner.
|
|
2676
|
+
* @param {PractitionerInvite} invite - The accepted invite
|
|
2677
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2678
|
+
* @returns {Promise<void>}
|
|
2679
|
+
*/
|
|
2680
|
+
private handleInviteAccepted;
|
|
2681
|
+
/**
|
|
2682
|
+
* Handles the business logic when a practitioner rejects an invite.
|
|
2683
|
+
* @param {PractitionerInvite} invite - The rejected invite
|
|
2684
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2685
|
+
* @returns {Promise<void>}
|
|
2686
|
+
*/
|
|
2687
|
+
private handleInviteRejected;
|
|
2688
|
+
/**
|
|
2689
|
+
* Handles the business logic when an invite is cancelled by admin.
|
|
2690
|
+
* @param {PractitionerInvite} invite - The cancelled invite
|
|
2691
|
+
* @returns {Promise<void>}
|
|
2692
|
+
*/
|
|
2693
|
+
private handleInviteCancelled;
|
|
2694
|
+
/**
|
|
2695
|
+
* Adds practitioner information to a clinic when an invite is accepted.
|
|
2696
|
+
* @param clinicId - ID of the clinic to update
|
|
2697
|
+
* @param doctorInfo - Doctor information to add to the clinic
|
|
2698
|
+
* @returns {Promise<void>}
|
|
2699
|
+
*/
|
|
2700
|
+
private addPractitionerToClinic;
|
|
2701
|
+
/**
|
|
2702
|
+
* Updates practitioner information in a clinic.
|
|
2703
|
+
* @param clinicId - ID of the clinic to update
|
|
2704
|
+
* @param doctorInfo - Updated doctor information
|
|
2705
|
+
* @returns {Promise<void>}
|
|
2706
|
+
*/
|
|
2707
|
+
private updatePractitionerInfoInClinic;
|
|
2708
|
+
/**
|
|
2709
|
+
* Adds a clinic to a practitioner's profile with working hours from the invite.
|
|
2710
|
+
* @param {string} practitionerId - The practitioner ID
|
|
2711
|
+
* @param {ClinicInfo} clinicInfo - The clinic information
|
|
2712
|
+
* @param {PractitionerInvite} invite - The accepted invite containing working hours
|
|
2713
|
+
* @returns {Promise<void>}
|
|
2714
|
+
*/
|
|
2715
|
+
private addClinicToPractitioner;
|
|
2716
|
+
/**
|
|
2717
|
+
* Updates the working hours for an existing practitioner-clinic relationship.
|
|
2718
|
+
* @param {string} practitionerId - The practitioner ID
|
|
2719
|
+
* @param {PractitionerInvite} invite - The accepted invite containing new working hours
|
|
2720
|
+
* @returns {Promise<void>}
|
|
2721
|
+
*/
|
|
2722
|
+
private updatePractitionerWorkingHours;
|
|
2723
|
+
/**
|
|
2724
|
+
* Fetches a clinic admin by ID
|
|
2725
|
+
* @param adminId The clinic admin ID
|
|
2726
|
+
* @returns The clinic admin or null if not found
|
|
2727
|
+
*/
|
|
2728
|
+
private fetchClinicAdminById;
|
|
2729
|
+
/**
|
|
2730
|
+
* Fetches a practitioner by ID.
|
|
2731
|
+
* @param practitionerId The practitioner ID.
|
|
2732
|
+
* @returns {Promise<Practitioner | null>} The practitioner or null if not found.
|
|
2733
|
+
*/
|
|
2734
|
+
private fetchPractitionerById;
|
|
2735
|
+
/**
|
|
2736
|
+
* Fetches a clinic by ID.
|
|
2737
|
+
* @param clinicId The clinic ID.
|
|
2738
|
+
* @returns {Promise<Clinic | null>} The clinic or null if not found.
|
|
2739
|
+
*/
|
|
2740
|
+
private fetchClinicById;
|
|
2741
|
+
/**
|
|
2742
|
+
* Sends acceptance notification email to clinic admin
|
|
2743
|
+
* @param invite The accepted invite
|
|
2744
|
+
* @param practitioner The practitioner who accepted
|
|
2745
|
+
* @param clinic The clinic that sent the invite
|
|
2746
|
+
* @param emailConfig Email configuration
|
|
2747
|
+
*/
|
|
2748
|
+
private sendAcceptanceNotificationEmail;
|
|
2749
|
+
/**
|
|
2750
|
+
* Sends rejection notification email to clinic admin
|
|
2751
|
+
* @param invite The rejected invite
|
|
2752
|
+
* @param practitioner The practitioner who rejected
|
|
2753
|
+
* @param clinic The clinic that sent the invite
|
|
2754
|
+
* @param emailConfig Email configuration
|
|
2755
|
+
*/
|
|
2756
|
+
private sendRejectionNotificationEmail;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
/**
|
|
2760
|
+
* @class ProcedureAggregationService
|
|
2761
|
+
* @description Handles aggregation tasks related to procedure data updates/deletions.
|
|
2762
|
+
*/
|
|
2763
|
+
declare class ProcedureAggregationService {
|
|
2764
|
+
private db;
|
|
2765
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2766
|
+
/**
|
|
2767
|
+
* Adds procedure information to a practitioner when a new procedure is created
|
|
2768
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2769
|
+
* @param procedureSummary - Summary information about the procedure
|
|
2770
|
+
* @returns {Promise<void>}
|
|
2771
|
+
*/
|
|
2772
|
+
addProcedureToPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2773
|
+
/**
|
|
2774
|
+
* Adds procedure information to a clinic when a new procedure is created
|
|
2775
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2776
|
+
* @param procedureSummary - Summary information about the procedure
|
|
2777
|
+
* @returns {Promise<void>}
|
|
2778
|
+
*/
|
|
2779
|
+
addProcedureToClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2780
|
+
/**
|
|
2781
|
+
* Updates procedure information in a practitioner document
|
|
2782
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2783
|
+
* @param procedureSummary - Updated summary information about the procedure
|
|
2784
|
+
* @returns {Promise<void>}
|
|
2785
|
+
*/
|
|
2786
|
+
updateProcedureInfoInPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2787
|
+
/**
|
|
2788
|
+
* Updates procedure information in a clinic document
|
|
2789
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2790
|
+
* @param procedureSummary - Updated summary information about the procedure
|
|
2791
|
+
* @returns {Promise<void>}
|
|
2792
|
+
*/
|
|
2793
|
+
updateProcedureInfoInClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2794
|
+
/**
|
|
2795
|
+
* Updates procedure information in calendar events
|
|
2796
|
+
* @param procedureId - ID of the procedure
|
|
2797
|
+
* @param procedureInfo - Updated procedure information
|
|
2798
|
+
* @returns {Promise<void>}
|
|
2799
|
+
*/
|
|
2800
|
+
updateProcedureInfoInCalendarEvents(procedureId: string, procedureInfo: any): Promise<void>;
|
|
2801
|
+
/**
|
|
2802
|
+
* Cancels all upcoming calendar events for a procedure
|
|
2803
|
+
* @param procedureId - ID of the procedure
|
|
2804
|
+
* @returns {Promise<void>}
|
|
2805
|
+
*/
|
|
2806
|
+
cancelUpcomingCalendarEventsForProcedure(procedureId: string): Promise<void>;
|
|
2807
|
+
/**
|
|
2808
|
+
* Removes procedure from a practitioner when a procedure is deleted or inactivated
|
|
2809
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2810
|
+
* @param procedureId - ID of the procedure
|
|
2811
|
+
* @param clinicId - Optional clinic ID for free consultation removal
|
|
2812
|
+
* @returns {Promise<void>}
|
|
2813
|
+
*/
|
|
2814
|
+
removeProcedureFromPractitioner(practitionerId: string, procedureId: string, clinicId?: string): Promise<void>;
|
|
2815
|
+
/**
|
|
2816
|
+
* Removes procedure from a clinic when a procedure is deleted or inactivated
|
|
2817
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2818
|
+
* @param procedureId - ID of the procedure
|
|
2819
|
+
* @returns {Promise<void>}
|
|
2820
|
+
*/
|
|
2821
|
+
removeProcedureFromClinic(clinicId: string, procedureId: string): Promise<void>;
|
|
2822
|
+
/**
|
|
2823
|
+
* Handles procedure status changes (activation/deactivation) specifically for free consultations
|
|
2824
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2825
|
+
* @param procedureId - ID of the procedure
|
|
2826
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2827
|
+
* @param isActive - New active status of the procedure
|
|
2828
|
+
* @param technologyName - Technology name of the procedure (to check if it's a free consultation)
|
|
2829
|
+
* @returns {Promise<void>}
|
|
2830
|
+
*/
|
|
2831
|
+
handleFreeConsultationStatusChange(practitionerId: string, procedureId: string, clinicId: string, isActive: boolean, technologyName: string): Promise<void>;
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2752
2834
|
/**
|
|
2753
2835
|
* @class ReviewsAggregationService
|
|
2754
2836
|
* @description Handles aggregation tasks related to review data updates.
|
|
@@ -2791,244 +2873,31 @@ declare class ReviewsAggregationService {
|
|
|
2791
2873
|
*/
|
|
2792
2874
|
updatePractitionerReviewInfo(practitionerId: string, removedReview?: PractitionerReview, isRemoval?: boolean): Promise<PractitionerReviewInfo>;
|
|
2793
2875
|
/**
|
|
2794
|
-
* Updates the review info for a procedure
|
|
2795
|
-
* @param procedureId The ID of the procedure to update
|
|
2796
|
-
* @param removedReview Optional review being removed
|
|
2797
|
-
* @param isRemoval Whether this update is for a review removal
|
|
2798
|
-
* @returns The updated procedure review info
|
|
2799
|
-
*/
|
|
2800
|
-
updateProcedureReviewInfo(procedureId: string, removedReview?: ProcedureReview, isRemoval?: boolean): Promise<ProcedureReviewInfo>;
|
|
2801
|
-
/**
|
|
2802
|
-
* Updates doctorInfo rating in all procedures for a practitioner
|
|
2803
|
-
* @param practitionerId The ID of the practitioner
|
|
2804
|
-
* @param rating The new rating to set
|
|
2805
|
-
*/
|
|
2806
|
-
private updateDoctorInfoInProcedures;
|
|
2807
|
-
/**
|
|
2808
|
-
* Verifies a review as checked by admin/staff
|
|
2809
|
-
* @param reviewId The ID of the review to verify
|
|
2810
|
-
*/
|
|
2811
|
-
verifyReview(reviewId: string): Promise<void>;
|
|
2812
|
-
/**
|
|
2813
|
-
* Calculate the average of all reviews for an entity
|
|
2814
|
-
* @param entityId The entity ID
|
|
2815
|
-
* @param entityType The type of entity ('clinic', 'practitioner', or 'procedure')
|
|
2816
|
-
* @returns Promise that resolves to the calculated review info
|
|
2817
|
-
*/
|
|
2818
|
-
calculateEntityReviewInfo(entityId: string, entityType: "clinic" | "practitioner" | "procedure"): Promise<ClinicReviewInfo | PractitionerReviewInfo | ProcedureReviewInfo>;
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
interface NewMailgunMessagesAPI {
|
|
2822
|
-
create(domain: string, data: any): Promise<any>;
|
|
2823
|
-
}
|
|
2824
|
-
interface NewMailgunClient {
|
|
2825
|
-
messages: NewMailgunMessagesAPI;
|
|
2826
|
-
}
|
|
2827
|
-
/**
|
|
2828
|
-
* Interface for the data required to send a practitioner invitation email
|
|
2829
|
-
*/
|
|
2830
|
-
interface PractitionerInviteEmailData {
|
|
2831
|
-
/** The token object from the practitioner service */
|
|
2832
|
-
token: {
|
|
2833
|
-
id: string;
|
|
2834
|
-
token: string;
|
|
2835
|
-
practitionerId: string;
|
|
2836
|
-
email: string;
|
|
2837
|
-
clinicId: string;
|
|
2838
|
-
expiresAt: admin.firestore.Timestamp;
|
|
2839
|
-
};
|
|
2840
|
-
/** Practitioner basic info */
|
|
2841
|
-
practitioner: {
|
|
2842
|
-
firstName: string;
|
|
2843
|
-
lastName: string;
|
|
2844
|
-
};
|
|
2845
|
-
/** Clinic info */
|
|
2846
|
-
clinic: {
|
|
2847
|
-
name: string;
|
|
2848
|
-
contactEmail: string;
|
|
2849
|
-
contactName?: string;
|
|
2850
|
-
};
|
|
2851
|
-
/** Config options */
|
|
2852
|
-
options?: {
|
|
2853
|
-
registrationUrl?: string;
|
|
2854
|
-
customSubject?: string;
|
|
2855
|
-
fromAddress?: string;
|
|
2856
|
-
mailgunDomain?: string;
|
|
2857
|
-
};
|
|
2858
|
-
}
|
|
2859
|
-
/**
|
|
2860
|
-
* Service for sending practitioner invitation emails, updated for mailgun.js v10+
|
|
2861
|
-
*/
|
|
2862
|
-
declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
2863
|
-
private readonly DEFAULT_REGISTRATION_URL;
|
|
2864
|
-
private readonly DEFAULT_SUBJECT;
|
|
2865
|
-
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
2866
|
-
/**
|
|
2867
|
-
* Constructor for PractitionerInviteMailingService
|
|
2868
|
-
* @param firestore Firestore instance provided by the caller
|
|
2869
|
-
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2870
|
-
*/
|
|
2871
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient);
|
|
2872
|
-
/**
|
|
2873
|
-
* Sends a practitioner invitation email
|
|
2874
|
-
* @param data The practitioner invitation data
|
|
2875
|
-
* @returns Promise resolved when email is sent
|
|
2876
|
-
*/
|
|
2877
|
-
sendInvitationEmail(data: PractitionerInviteEmailData): Promise<any>;
|
|
2878
|
-
/**
|
|
2879
|
-
* Handles the practitioner token creation event from Cloud Functions
|
|
2880
|
-
* Fetches necessary data using defined types and collection constants,
|
|
2881
|
-
* and sends the invitation email.
|
|
2882
|
-
* @param tokenData The fully typed token object including its id
|
|
2883
|
-
* @param fromAddress The 'from' email address to use, obtained from config
|
|
2884
|
-
* @param mailgunDomain The mailgun domain to use for sending
|
|
2885
|
-
* @returns Promise resolved when the email is sent
|
|
2886
|
-
*/
|
|
2887
|
-
handleTokenCreationEvent(tokenData: PractitionerToken, mailgunConfig: {
|
|
2888
|
-
fromAddress: string;
|
|
2889
|
-
domain: string;
|
|
2890
|
-
registrationUrl?: string;
|
|
2891
|
-
}): Promise<void>;
|
|
2892
|
-
}
|
|
2893
|
-
|
|
2894
|
-
/**
|
|
2895
|
-
* Interface for the data required by orchestrateAppointmentCreation
|
|
2896
|
-
*/
|
|
2897
|
-
interface OrchestrateAppointmentCreationData {
|
|
2898
|
-
patientId: string;
|
|
2899
|
-
procedureId: string;
|
|
2900
|
-
appointmentStartTime: admin.firestore.Timestamp;
|
|
2901
|
-
appointmentEndTime: admin.firestore.Timestamp;
|
|
2902
|
-
patientNotes?: string | null;
|
|
2903
|
-
}
|
|
2904
|
-
/**
|
|
2905
|
-
* Admin service for handling booking-related operations.
|
|
2906
|
-
* This is the cloud-based implementation that will be used in Cloud Functions.
|
|
2907
|
-
*/
|
|
2908
|
-
declare class BookingAdmin {
|
|
2909
|
-
private db;
|
|
2910
|
-
private documentManagerAdmin;
|
|
2911
|
-
/**
|
|
2912
|
-
* Creates a new BookingAdmin instance
|
|
2913
|
-
* @param firestore - Firestore instance provided by the caller
|
|
2914
|
-
*/
|
|
2915
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2916
|
-
/**
|
|
2917
|
-
* Gets available booking time slots for a specific clinic, practitioner, and procedure
|
|
2918
|
-
*
|
|
2919
|
-
* @param clinicId - ID of the clinic
|
|
2920
|
-
* @param practitionerId - ID of the practitioner
|
|
2921
|
-
* @param procedureId - ID of the procedure
|
|
2922
|
-
* @param timeframe - Time range to check for availability
|
|
2923
|
-
* @returns Promise resolving to an array of available booking slots
|
|
2924
|
-
*/
|
|
2925
|
-
getAvailableBookingSlots(clinicId: string, practitionerId: string, procedureId: string, timeframe: {
|
|
2926
|
-
start: Date | admin.firestore.Timestamp;
|
|
2927
|
-
end: Date | admin.firestore.Timestamp;
|
|
2928
|
-
}): Promise<{
|
|
2929
|
-
availableSlots: {
|
|
2930
|
-
start: admin.firestore.Timestamp;
|
|
2931
|
-
}[];
|
|
2932
|
-
}>;
|
|
2933
|
-
/**
|
|
2934
|
-
* Converts an admin Firestore Timestamp to a client Firestore Timestamp
|
|
2935
|
-
*/
|
|
2936
|
-
private adminTimestampToClientTimestamp;
|
|
2937
|
-
/**
|
|
2938
|
-
* Converts timestamps in calendar events from admin Firestore Timestamps to client Firestore Timestamps
|
|
2939
|
-
*/
|
|
2940
|
-
private convertEventsTimestamps;
|
|
2941
|
-
/**
|
|
2942
|
-
* Fetches clinic calendar events for a specific time range
|
|
2943
|
-
*
|
|
2944
|
-
* @param clinicId - ID of the clinic
|
|
2945
|
-
* @param start - Start time of the range
|
|
2946
|
-
* @param end - End time of the range
|
|
2947
|
-
* @returns Promise resolving to an array of calendar events
|
|
2948
|
-
*/
|
|
2949
|
-
private getClinicCalendarEvents;
|
|
2950
|
-
/**
|
|
2951
|
-
* Fetches practitioner calendar events for a specific time range
|
|
2952
|
-
*
|
|
2953
|
-
* @param practitionerId - ID of the practitioner
|
|
2954
|
-
* @param start - Start time of the range
|
|
2955
|
-
* @param end - End time of the range
|
|
2956
|
-
* @returns Promise resolving to an array of calendar events
|
|
2957
|
-
*/
|
|
2958
|
-
private getPractitionerCalendarEvents;
|
|
2959
|
-
/**
|
|
2960
|
-
* Summarizes event types for logging purposes
|
|
2961
|
-
* @param events Array of calendar events
|
|
2962
|
-
* @returns Object with counts of each event type
|
|
2963
|
-
*/
|
|
2964
|
-
private summarizeEventTypes;
|
|
2965
|
-
private _generateCalendarProcedureInfo;
|
|
2966
|
-
/**
|
|
2967
|
-
* Orchestrates the creation of a new appointment, including data aggregation.
|
|
2968
|
-
* This method is intended to be called from a trusted backend environment (e.g., an Express route handler in a Cloud Function).
|
|
2969
|
-
*
|
|
2970
|
-
* @param data - Data required to create the appointment.
|
|
2971
|
-
* @param authenticatedUserId - The ID of the user making the request (for auditing, and usually is the patientId).
|
|
2972
|
-
* @returns Promise resolving to an object indicating success, and appointmentId or an error message.
|
|
2973
|
-
*/
|
|
2974
|
-
orchestrateAppointmentCreation(data: OrchestrateAppointmentCreationData, authenticatedUserId: string): Promise<{
|
|
2975
|
-
success: boolean;
|
|
2976
|
-
appointmentId?: string;
|
|
2977
|
-
appointmentData?: Appointment;
|
|
2978
|
-
calendarEventId?: string;
|
|
2979
|
-
error?: string;
|
|
2980
|
-
}>;
|
|
2981
|
-
private _generateProcedureSummaryInfo;
|
|
2982
|
-
private _generateProcedureExtendedInfo;
|
|
2983
|
-
}
|
|
2984
|
-
|
|
2985
|
-
/**
|
|
2986
|
-
* @class PatientRequirementsAdminService
|
|
2987
|
-
* @description Handles administrative tasks for patient requirement instances, primarily managing associated notifications.
|
|
2988
|
-
* This service is intended to be used by Cloud Functions triggered by changes to PatientRequirementInstance documents.
|
|
2989
|
-
*/
|
|
2990
|
-
declare class PatientRequirementsAdminService {
|
|
2991
|
-
private db;
|
|
2992
|
-
private notificationsAdmin;
|
|
2993
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2994
|
-
/**
|
|
2995
|
-
* Processes a newly created or updated PatientRequirementInstance to schedule notifications for its instructions.
|
|
2996
|
-
* It will also cancel pre-existing notifications if due times have changed significantly.
|
|
2997
|
-
*
|
|
2998
|
-
* @param patientId - The ID of the patient.
|
|
2999
|
-
* @param instance - The PatientRequirementInstance data (either new or updated).
|
|
3000
|
-
* @param previousInstanceData - Optional. The previous state of the instance data if it's an update.
|
|
3001
|
-
* Used to determine if notifications need to be cancelled/rescheduled.
|
|
3002
|
-
* @returns {Promise<void>} A promise that resolves when processing is complete.
|
|
2876
|
+
* Updates the review info for a procedure
|
|
2877
|
+
* @param procedureId The ID of the procedure to update
|
|
2878
|
+
* @param removedReview Optional review being removed
|
|
2879
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2880
|
+
* @returns The updated procedure review info
|
|
3003
2881
|
*/
|
|
3004
|
-
|
|
2882
|
+
updateProcedureReviewInfo(procedureId: string, removedReview?: ProcedureReview, isRemoval?: boolean): Promise<ProcedureReviewInfo>;
|
|
3005
2883
|
/**
|
|
3006
|
-
*
|
|
3007
|
-
*
|
|
3008
|
-
*
|
|
3009
|
-
* @param instance - The PatientRequirementInstance.
|
|
3010
|
-
* @returns {Promise<void>}
|
|
2884
|
+
* Updates doctorInfo rating in all procedures for a practitioner
|
|
2885
|
+
* @param practitionerId The ID of the practitioner
|
|
2886
|
+
* @param rating The new rating to set
|
|
3011
2887
|
*/
|
|
3012
|
-
|
|
2888
|
+
private updateDoctorInfoInProcedures;
|
|
3013
2889
|
/**
|
|
3014
|
-
*
|
|
3015
|
-
*
|
|
3016
|
-
* This would typically be called by a scheduled Cloud Function.
|
|
3017
|
-
*
|
|
3018
|
-
* @param patientId - The ID of the patient.
|
|
3019
|
-
* @param instanceId - The ID of the PatientRequirementInstance.
|
|
3020
|
-
* @returns {Promise<void>}
|
|
2890
|
+
* Verifies a review as checked by admin/staff
|
|
2891
|
+
* @param reviewId The ID of the review to verify
|
|
3021
2892
|
*/
|
|
3022
|
-
|
|
2893
|
+
verifyReview(reviewId: string): Promise<void>;
|
|
3023
2894
|
/**
|
|
3024
|
-
*
|
|
3025
|
-
*
|
|
3026
|
-
*
|
|
3027
|
-
* @
|
|
3028
|
-
* @param instanceId - The ID of the PatientRequirementInstance to update.
|
|
3029
|
-
* @returns {Promise<void>} A promise that resolves when processing is complete.
|
|
2895
|
+
* Calculate the average of all reviews for an entity
|
|
2896
|
+
* @param entityId The entity ID
|
|
2897
|
+
* @param entityType The type of entity ('clinic', 'practitioner', or 'procedure')
|
|
2898
|
+
* @returns Promise that resolves to the calculated review info
|
|
3030
2899
|
*/
|
|
3031
|
-
|
|
2900
|
+
calculateEntityReviewInfo(entityId: string, entityType: "clinic" | "practitioner" | "procedure"): Promise<ClinicReviewInfo | PractitionerReviewInfo | ProcedureReviewInfo>;
|
|
3032
2901
|
}
|
|
3033
2902
|
|
|
3034
2903
|
/**
|
|
@@ -3185,6 +3054,97 @@ declare class BookingAvailabilityCalculator {
|
|
|
3185
3054
|
private static mergeOverlappingIntervals;
|
|
3186
3055
|
}
|
|
3187
3056
|
|
|
3057
|
+
/**
|
|
3058
|
+
* Interface for the data required by orchestrateAppointmentCreation
|
|
3059
|
+
*/
|
|
3060
|
+
interface OrchestrateAppointmentCreationData {
|
|
3061
|
+
patientId: string;
|
|
3062
|
+
procedureId: string;
|
|
3063
|
+
appointmentStartTime: admin.firestore.Timestamp;
|
|
3064
|
+
appointmentEndTime: admin.firestore.Timestamp;
|
|
3065
|
+
patientNotes?: string | null;
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Admin service for handling booking-related operations.
|
|
3069
|
+
* This is the cloud-based implementation that will be used in Cloud Functions.
|
|
3070
|
+
*/
|
|
3071
|
+
declare class BookingAdmin {
|
|
3072
|
+
private db;
|
|
3073
|
+
private documentManagerAdmin;
|
|
3074
|
+
/**
|
|
3075
|
+
* Creates a new BookingAdmin instance
|
|
3076
|
+
* @param firestore - Firestore instance provided by the caller
|
|
3077
|
+
*/
|
|
3078
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3079
|
+
/**
|
|
3080
|
+
* Gets available booking time slots for a specific clinic, practitioner, and procedure
|
|
3081
|
+
*
|
|
3082
|
+
* @param clinicId - ID of the clinic
|
|
3083
|
+
* @param practitionerId - ID of the practitioner
|
|
3084
|
+
* @param procedureId - ID of the procedure
|
|
3085
|
+
* @param timeframe - Time range to check for availability
|
|
3086
|
+
* @returns Promise resolving to an array of available booking slots
|
|
3087
|
+
*/
|
|
3088
|
+
getAvailableBookingSlots(clinicId: string, practitionerId: string, procedureId: string, timeframe: {
|
|
3089
|
+
start: Date | admin.firestore.Timestamp;
|
|
3090
|
+
end: Date | admin.firestore.Timestamp;
|
|
3091
|
+
}): Promise<{
|
|
3092
|
+
availableSlots: {
|
|
3093
|
+
start: admin.firestore.Timestamp;
|
|
3094
|
+
}[];
|
|
3095
|
+
}>;
|
|
3096
|
+
/**
|
|
3097
|
+
* Converts an admin Firestore Timestamp to a client Firestore Timestamp
|
|
3098
|
+
*/
|
|
3099
|
+
private adminTimestampToClientTimestamp;
|
|
3100
|
+
/**
|
|
3101
|
+
* Converts timestamps in calendar events from admin Firestore Timestamps to client Firestore Timestamps
|
|
3102
|
+
*/
|
|
3103
|
+
private convertEventsTimestamps;
|
|
3104
|
+
/**
|
|
3105
|
+
* Fetches clinic calendar events for a specific time range
|
|
3106
|
+
*
|
|
3107
|
+
* @param clinicId - ID of the clinic
|
|
3108
|
+
* @param start - Start time of the range
|
|
3109
|
+
* @param end - End time of the range
|
|
3110
|
+
* @returns Promise resolving to an array of calendar events
|
|
3111
|
+
*/
|
|
3112
|
+
private getClinicCalendarEvents;
|
|
3113
|
+
/**
|
|
3114
|
+
* Fetches practitioner calendar events for a specific time range
|
|
3115
|
+
*
|
|
3116
|
+
* @param practitionerId - ID of the practitioner
|
|
3117
|
+
* @param start - Start time of the range
|
|
3118
|
+
* @param end - End time of the range
|
|
3119
|
+
* @returns Promise resolving to an array of calendar events
|
|
3120
|
+
*/
|
|
3121
|
+
private getPractitionerCalendarEvents;
|
|
3122
|
+
/**
|
|
3123
|
+
* Summarizes event types for logging purposes
|
|
3124
|
+
* @param events Array of calendar events
|
|
3125
|
+
* @returns Object with counts of each event type
|
|
3126
|
+
*/
|
|
3127
|
+
private summarizeEventTypes;
|
|
3128
|
+
private _generateCalendarProcedureInfo;
|
|
3129
|
+
/**
|
|
3130
|
+
* Orchestrates the creation of a new appointment, including data aggregation.
|
|
3131
|
+
* This method is intended to be called from a trusted backend environment (e.g., an Express route handler in a Cloud Function).
|
|
3132
|
+
*
|
|
3133
|
+
* @param data - Data required to create the appointment.
|
|
3134
|
+
* @param authenticatedUserId - The ID of the user making the request (for auditing, and usually is the patientId).
|
|
3135
|
+
* @returns Promise resolving to an object indicating success, and appointmentId or an error message.
|
|
3136
|
+
*/
|
|
3137
|
+
orchestrateAppointmentCreation(data: OrchestrateAppointmentCreationData, authenticatedUserId: string): Promise<{
|
|
3138
|
+
success: boolean;
|
|
3139
|
+
appointmentId?: string;
|
|
3140
|
+
appointmentData?: Appointment;
|
|
3141
|
+
calendarEventId?: string;
|
|
3142
|
+
error?: string;
|
|
3143
|
+
}>;
|
|
3144
|
+
private _generateProcedureSummaryInfo;
|
|
3145
|
+
private _generateProcedureExtendedInfo;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3188
3148
|
/**
|
|
3189
3149
|
* @class CalendarAdminService
|
|
3190
3150
|
* @description Handles administrative tasks for calendar events linked to appointments,
|
|
@@ -3264,6 +3224,14 @@ declare class DocumentManagerAdminService {
|
|
|
3264
3224
|
batchInitializeAppointmentFormsFromTechnologyTemplates(dbBatch: admin.firestore.WriteBatch, appointmentId: string, procedureIdForForms: string, technologyTemplates: TechnologyDocumentationTemplate[], patientId: string, practitionerId: string, clinicId: string, nowMillis: number): Promise<InitializeAppointmentFormsResult>;
|
|
3265
3225
|
}
|
|
3266
3226
|
|
|
3227
|
+
/**
|
|
3228
|
+
* Ensures that the free consultation infrastructure exists in the database
|
|
3229
|
+
* Creates category, subcategory, and technology if they don't exist
|
|
3230
|
+
* @param db - Firestore database instance (optional, defaults to admin.firestore())
|
|
3231
|
+
* @returns Promise<boolean> - Always returns true after ensuring infrastructure exists
|
|
3232
|
+
*/
|
|
3233
|
+
declare function freeConsultationInfrastructure(db?: admin.firestore.Firestore): Promise<boolean>;
|
|
3234
|
+
|
|
3267
3235
|
/**
|
|
3268
3236
|
* Cloud Functions-compatible logger with fallback for other environments
|
|
3269
3237
|
*
|
|
@@ -3351,12 +3319,152 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
3351
3319
|
sendReviewAddedEmail(data: ReviewAddedEmailData): Promise<any>;
|
|
3352
3320
|
}
|
|
3353
3321
|
|
|
3322
|
+
declare class NotificationsAdmin {
|
|
3323
|
+
private expo;
|
|
3324
|
+
private db;
|
|
3325
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3326
|
+
/**
|
|
3327
|
+
* Dohvata notifikaciju po ID-u
|
|
3328
|
+
*/
|
|
3329
|
+
getNotification(id: string): Promise<Notification | null>;
|
|
3330
|
+
/**
|
|
3331
|
+
* Kreira novu notifikaciju
|
|
3332
|
+
*/
|
|
3333
|
+
createNotification(notification: Omit<Notification, "id">): Promise<string>;
|
|
3334
|
+
/**
|
|
3335
|
+
* Priprema Expo poruku za slanje
|
|
3336
|
+
*/
|
|
3337
|
+
private prepareExpoMessage;
|
|
3338
|
+
/**
|
|
3339
|
+
* Ažurira status notifikacije
|
|
3340
|
+
*/
|
|
3341
|
+
updateNotificationStatus(notificationId: string, status: NotificationStatus, error?: string): Promise<void>;
|
|
3342
|
+
/**
|
|
3343
|
+
* Šalje notifikaciju kroz Expo servis sa boljim error handlingom
|
|
3344
|
+
*/
|
|
3345
|
+
sendPushNotification(notification: Notification): Promise<boolean>;
|
|
3346
|
+
/**
|
|
3347
|
+
* Procesira notifikacije koje čekaju na slanje sa batch limitom
|
|
3348
|
+
*/
|
|
3349
|
+
processPendingNotifications(batchSize?: number): Promise<void>;
|
|
3350
|
+
/**
|
|
3351
|
+
* Briše stare notifikacije sa batch procesiranjem
|
|
3352
|
+
*/
|
|
3353
|
+
cleanupOldNotifications(daysOld?: number, batchSize?: number): Promise<void>;
|
|
3354
|
+
/**
|
|
3355
|
+
* Creates and potentially sends a push notification for a confirmed appointment.
|
|
3356
|
+
* @param appointment The confirmed appointment object.
|
|
3357
|
+
* @param recipientUserId The ID of the user receiving the notification.
|
|
3358
|
+
* @param recipientExpoTokens Array of Expo push tokens for the recipient.
|
|
3359
|
+
* @param recipientRole The role of the recipient (e.g., PATIENT, PRACTITIONER).
|
|
3360
|
+
*/
|
|
3361
|
+
sendAppointmentConfirmedPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
3362
|
+
sendAppointmentCancelledPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
3363
|
+
sendAppointmentRescheduledProposalPush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
3364
|
+
sendPaymentUpdatePush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
3365
|
+
sendReviewRequestPush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
3366
|
+
sendReviewAddedPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3354
3369
|
/**
|
|
3355
|
-
*
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
3358
|
-
* @returns Promise<boolean> - Always returns true after ensuring infrastructure exists
|
|
3370
|
+
* @class PatientRequirementsAdminService
|
|
3371
|
+
* @description Handles administrative tasks for patient requirement instances, primarily managing associated notifications.
|
|
3372
|
+
* This service is intended to be used by Cloud Functions triggered by changes to PatientRequirementInstance documents.
|
|
3359
3373
|
*/
|
|
3360
|
-
declare
|
|
3374
|
+
declare class PatientRequirementsAdminService {
|
|
3375
|
+
private db;
|
|
3376
|
+
private notificationsAdmin;
|
|
3377
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3378
|
+
/**
|
|
3379
|
+
* Processes a newly created or updated PatientRequirementInstance to schedule notifications for its instructions.
|
|
3380
|
+
* It will also cancel pre-existing notifications if due times have changed significantly.
|
|
3381
|
+
*
|
|
3382
|
+
* @param patientId - The ID of the patient.
|
|
3383
|
+
* @param instance - The PatientRequirementInstance data (either new or updated).
|
|
3384
|
+
* @param previousInstanceData - Optional. The previous state of the instance data if it's an update.
|
|
3385
|
+
* Used to determine if notifications need to be cancelled/rescheduled.
|
|
3386
|
+
* @returns {Promise<void>} A promise that resolves when processing is complete.
|
|
3387
|
+
*/
|
|
3388
|
+
processRequirementInstanceAndScheduleNotifications(patientId: string, instance: PatientRequirementInstance, previousInstanceData?: PatientRequirementInstance): Promise<void>;
|
|
3389
|
+
/**
|
|
3390
|
+
* Cancels all PENDING notifications associated with a specific PatientRequirementInstance.
|
|
3391
|
+
* Typically called when the instance itself is deleted or its overall status becomes CANCELLED.
|
|
3392
|
+
*
|
|
3393
|
+
* @param instance - The PatientRequirementInstance.
|
|
3394
|
+
* @returns {Promise<void>}
|
|
3395
|
+
*/
|
|
3396
|
+
cancelAllNotificationsForInstance(instance: PatientRequirementInstance): Promise<void>;
|
|
3397
|
+
/**
|
|
3398
|
+
* (Optional - For a cron job)
|
|
3399
|
+
* Scans for instructions that are past their due time but not yet actioned, and updates their status to MISSED.
|
|
3400
|
+
* This would typically be called by a scheduled Cloud Function.
|
|
3401
|
+
*
|
|
3402
|
+
* @param patientId - The ID of the patient.
|
|
3403
|
+
* @param instanceId - The ID of the PatientRequirementInstance.
|
|
3404
|
+
* @returns {Promise<void>}
|
|
3405
|
+
*/
|
|
3406
|
+
updateMissedInstructions(patientId: string, instanceId: string): Promise<void>;
|
|
3407
|
+
/**
|
|
3408
|
+
* Calculates and updates the overallStatus of a PatientRequirementInstance
|
|
3409
|
+
* based on the statuses of its individual instructions.
|
|
3410
|
+
*
|
|
3411
|
+
* @param patientId - The ID of the patient.
|
|
3412
|
+
* @param instanceId - The ID of the PatientRequirementInstance to update.
|
|
3413
|
+
* @returns {Promise<void>} A promise that resolves when processing is complete.
|
|
3414
|
+
*/
|
|
3415
|
+
updateOverallInstanceStatus(patientId: string, instanceId: string): Promise<void>;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
/**
|
|
3419
|
+
* @class UserProfileAdminService
|
|
3420
|
+
* @description Handles user profile management operations for admin tasks
|
|
3421
|
+
*/
|
|
3422
|
+
declare class UserProfileAdminService {
|
|
3423
|
+
private db;
|
|
3424
|
+
/**
|
|
3425
|
+
* Constructor for UserProfileAdminService
|
|
3426
|
+
* @param firestore Optional Firestore instance. If not provided, uses the default admin SDK instance.
|
|
3427
|
+
*/
|
|
3428
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3429
|
+
/**
|
|
3430
|
+
* Creates a blank user profile with minimal information
|
|
3431
|
+
* @param authUserData Basic user data from Firebase Auth
|
|
3432
|
+
* @returns The created user document
|
|
3433
|
+
*/
|
|
3434
|
+
createBlankUserProfile(authUserData: {
|
|
3435
|
+
uid: string;
|
|
3436
|
+
email: string | null;
|
|
3437
|
+
isAnonymous: boolean;
|
|
3438
|
+
}): Promise<User>;
|
|
3439
|
+
/**
|
|
3440
|
+
* Initializes patient role for a user and creates all required patient documents
|
|
3441
|
+
* Creates patient profile, sensitive info, and medical info in one operation
|
|
3442
|
+
*
|
|
3443
|
+
* @param userId The user ID to initialize with patient role
|
|
3444
|
+
* @param options Optional data for different aspects of patient initialization
|
|
3445
|
+
* @returns Object containing the updated user and all created patient documents
|
|
3446
|
+
*/
|
|
3447
|
+
initializePatientRole(userId: string, options?: {
|
|
3448
|
+
profileData?: Partial<CreatePatientProfileData>;
|
|
3449
|
+
sensitiveData?: Partial<CreatePatientSensitiveInfoData>;
|
|
3450
|
+
}): Promise<{
|
|
3451
|
+
user: User;
|
|
3452
|
+
patientProfile: PatientProfile;
|
|
3453
|
+
patientSensitiveInfo: PatientSensitiveInfo;
|
|
3454
|
+
patientMedicalInfo: PatientMedicalInfo;
|
|
3455
|
+
}>;
|
|
3456
|
+
/**
|
|
3457
|
+
* Initializes clinic admin role for a user
|
|
3458
|
+
* @param userId The user ID to initialize with clinic admin role
|
|
3459
|
+
* @returns The updated user document
|
|
3460
|
+
*/
|
|
3461
|
+
initializeClinicAdminRole(userId: string): Promise<User>;
|
|
3462
|
+
/**
|
|
3463
|
+
* Initializes practitioner role for a user
|
|
3464
|
+
* @param userId The user ID to initialize with practitioner role
|
|
3465
|
+
* @returns The updated user document
|
|
3466
|
+
*/
|
|
3467
|
+
initializePractitionerRole(userId: string): Promise<User>;
|
|
3468
|
+
}
|
|
3361
3469
|
|
|
3362
|
-
export {
|
|
3470
|
+
export { type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, DocumentManagerAdminService, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, type NewMailgunClient$2 as NewMailgunClient, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENTS_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientProfile, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientSensitiveInfo, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerInvite, PractitionerInviteAggregationService, type PractitionerInviteEmailData, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type TimeInterval, UserProfileAdminService, UserRole, freeConsultationInfrastructure };
|