@blackcode_sa/metaestetics-api 1.7.12 → 1.7.13
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 +200 -1
- package/dist/admin/index.d.ts +200 -1
- package/dist/admin/index.js +691 -35
- package/dist/admin/index.mjs +689 -35
- package/package.json +1 -1
- package/src/admin/aggregation/forms/filled-forms.aggregation.service.ts +316 -0
- package/src/admin/index.ts +8 -1
package/dist/admin/index.d.mts
CHANGED
|
@@ -171,6 +171,27 @@ interface DocumentTemplate {
|
|
|
171
171
|
version: number;
|
|
172
172
|
isActive: boolean;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Interface for a filled document (completed form)
|
|
176
|
+
*/
|
|
177
|
+
interface FilledDocument {
|
|
178
|
+
id: string;
|
|
179
|
+
templateId: string;
|
|
180
|
+
templateVersion: number;
|
|
181
|
+
isUserForm: boolean;
|
|
182
|
+
isRequired: boolean;
|
|
183
|
+
procedureId: string;
|
|
184
|
+
appointmentId: string;
|
|
185
|
+
patientId: string;
|
|
186
|
+
practitionerId: string;
|
|
187
|
+
clinicId: string;
|
|
188
|
+
createdAt: number;
|
|
189
|
+
updatedAt: number;
|
|
190
|
+
values: {
|
|
191
|
+
[elementId: string]: any;
|
|
192
|
+
};
|
|
193
|
+
status: FilledDocumentStatus;
|
|
194
|
+
}
|
|
174
195
|
/**
|
|
175
196
|
* Enum for filled document status
|
|
176
197
|
*/
|
|
@@ -219,6 +240,64 @@ interface CertificationRequirement {
|
|
|
219
240
|
requiredSpecialties?: CertificationSpecialty[];
|
|
220
241
|
}
|
|
221
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Review system type definitions
|
|
245
|
+
*/
|
|
246
|
+
/**
|
|
247
|
+
* Base review interface with common properties
|
|
248
|
+
*/
|
|
249
|
+
interface BaseReview {
|
|
250
|
+
id: string;
|
|
251
|
+
fullReviewId: string;
|
|
252
|
+
patientId: string;
|
|
253
|
+
createdAt: Date;
|
|
254
|
+
updatedAt: Date;
|
|
255
|
+
comment: string;
|
|
256
|
+
isVerified: boolean;
|
|
257
|
+
isPublished: boolean;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Clinic review interface
|
|
261
|
+
* @description Full review for a clinic
|
|
262
|
+
*/
|
|
263
|
+
interface ClinicReview extends BaseReview {
|
|
264
|
+
clinicId: string;
|
|
265
|
+
cleanliness: number;
|
|
266
|
+
facilities: number;
|
|
267
|
+
staffFriendliness: number;
|
|
268
|
+
waitingTime: number;
|
|
269
|
+
accessibility: number;
|
|
270
|
+
overallRating: number;
|
|
271
|
+
wouldRecommend: boolean;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Practitioner review interface
|
|
275
|
+
* @description Full review for a healthcare practitioner
|
|
276
|
+
*/
|
|
277
|
+
interface PractitionerReview extends BaseReview {
|
|
278
|
+
practitionerId: string;
|
|
279
|
+
knowledgeAndExpertise: number;
|
|
280
|
+
communicationSkills: number;
|
|
281
|
+
bedSideManner: number;
|
|
282
|
+
thoroughness: number;
|
|
283
|
+
trustworthiness: number;
|
|
284
|
+
overallRating: number;
|
|
285
|
+
wouldRecommend: boolean;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Procedure review interface
|
|
289
|
+
* @description Full review for a medical procedure
|
|
290
|
+
*/
|
|
291
|
+
interface ProcedureReview extends BaseReview {
|
|
292
|
+
procedureId: string;
|
|
293
|
+
effectivenessOfTreatment: number;
|
|
294
|
+
outcomeExplanation: number;
|
|
295
|
+
painManagement: number;
|
|
296
|
+
followUpCare: number;
|
|
297
|
+
valueForMoney: number;
|
|
298
|
+
overallRating: number;
|
|
299
|
+
wouldRecommend: boolean;
|
|
300
|
+
}
|
|
222
301
|
/**
|
|
223
302
|
* Condensed clinic review information
|
|
224
303
|
* @description Used for aggregated data attached to clinic documents
|
|
@@ -261,6 +340,22 @@ interface ProcedureReviewInfo {
|
|
|
261
340
|
valueForMoney: number;
|
|
262
341
|
recommendationPercentage: number;
|
|
263
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Crown review object
|
|
345
|
+
* @description Combined review data for clinic, practitioner, and procedure
|
|
346
|
+
*/
|
|
347
|
+
interface Review {
|
|
348
|
+
id: string;
|
|
349
|
+
appointmentId: string;
|
|
350
|
+
patientId: string;
|
|
351
|
+
createdAt: Date;
|
|
352
|
+
updatedAt: Date;
|
|
353
|
+
clinicReview?: ClinicReview;
|
|
354
|
+
practitionerReview?: PractitionerReview;
|
|
355
|
+
procedureReview?: ProcedureReview;
|
|
356
|
+
overallComment: string;
|
|
357
|
+
overallRating: number;
|
|
358
|
+
}
|
|
264
359
|
|
|
265
360
|
/**
|
|
266
361
|
* Familije procedura u sistemu
|
|
@@ -2028,6 +2123,110 @@ declare class AppointmentAggregationService {
|
|
|
2028
2123
|
private fetchClinicInfo;
|
|
2029
2124
|
}
|
|
2030
2125
|
|
|
2126
|
+
/**
|
|
2127
|
+
* @class FilledFormsAggregationService
|
|
2128
|
+
* @description Handles aggregation tasks related to filled forms data updates.
|
|
2129
|
+
* Updates appointment documents with LinkedFormInfo when forms are created, updated, or deleted.
|
|
2130
|
+
*/
|
|
2131
|
+
declare class FilledFormsAggregationService {
|
|
2132
|
+
private db;
|
|
2133
|
+
/**
|
|
2134
|
+
* Constructor for FilledFormsAggregationService.
|
|
2135
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2136
|
+
*/
|
|
2137
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2138
|
+
/**
|
|
2139
|
+
* Handles side effects when a filled form is created or updated.
|
|
2140
|
+
* This function would typically be called by a Firestore onCreate or onUpdate trigger.
|
|
2141
|
+
* @param filledDocument The filled document that was created or updated.
|
|
2142
|
+
* @returns {Promise<void>}
|
|
2143
|
+
*/
|
|
2144
|
+
handleFilledFormCreateOrUpdate(filledDocument: FilledDocument): Promise<void>;
|
|
2145
|
+
/**
|
|
2146
|
+
* Handles side effects when a filled form is deleted.
|
|
2147
|
+
* This function would typically be called by a Firestore onDelete trigger.
|
|
2148
|
+
* @param filledDocument The filled document that was deleted.
|
|
2149
|
+
* @returns {Promise<void>}
|
|
2150
|
+
*/
|
|
2151
|
+
handleFilledFormDelete(filledDocument: FilledDocument): Promise<void>;
|
|
2152
|
+
/**
|
|
2153
|
+
* Updates the appointment's pendingUserFormsIds for a new required user form.
|
|
2154
|
+
* This should be called when a required user form is first created.
|
|
2155
|
+
* @param filledDocument The newly created filled document.
|
|
2156
|
+
* @returns {Promise<void>}
|
|
2157
|
+
*/
|
|
2158
|
+
handleRequiredUserFormCreate(filledDocument: FilledDocument): Promise<void>;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
/**
|
|
2162
|
+
* @class ReviewsAggregationService
|
|
2163
|
+
* @description Handles aggregation tasks related to review data updates.
|
|
2164
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2165
|
+
* triggered by changes in the reviews collection.
|
|
2166
|
+
*/
|
|
2167
|
+
declare class ReviewsAggregationService {
|
|
2168
|
+
private db;
|
|
2169
|
+
/**
|
|
2170
|
+
* Constructor for ReviewsAggregationService.
|
|
2171
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2172
|
+
*/
|
|
2173
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2174
|
+
/**
|
|
2175
|
+
* Process a newly created review and update all related entities
|
|
2176
|
+
* @param review The newly created review
|
|
2177
|
+
* @returns Promise resolving when all updates are complete
|
|
2178
|
+
*/
|
|
2179
|
+
processNewReview(review: Review): Promise<void>;
|
|
2180
|
+
/**
|
|
2181
|
+
* Process a deleted review and update all related entities
|
|
2182
|
+
* @param review The deleted review
|
|
2183
|
+
* @returns Promise resolving when all updates are complete
|
|
2184
|
+
*/
|
|
2185
|
+
processDeletedReview(review: Review): Promise<void>;
|
|
2186
|
+
/**
|
|
2187
|
+
* Updates the review info for a clinic
|
|
2188
|
+
* @param clinicId The ID of the clinic to update
|
|
2189
|
+
* @param removedReview Optional review being removed
|
|
2190
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2191
|
+
* @returns The updated clinic review info
|
|
2192
|
+
*/
|
|
2193
|
+
updateClinicReviewInfo(clinicId: string, removedReview?: ClinicReview, isRemoval?: boolean): Promise<ClinicReviewInfo>;
|
|
2194
|
+
/**
|
|
2195
|
+
* Updates the review info for a practitioner
|
|
2196
|
+
* @param practitionerId The ID of the practitioner to update
|
|
2197
|
+
* @param removedReview Optional review being removed
|
|
2198
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2199
|
+
* @returns The updated practitioner review info
|
|
2200
|
+
*/
|
|
2201
|
+
updatePractitionerReviewInfo(practitionerId: string, removedReview?: PractitionerReview, isRemoval?: boolean): Promise<PractitionerReviewInfo>;
|
|
2202
|
+
/**
|
|
2203
|
+
* Updates the review info for a procedure
|
|
2204
|
+
* @param procedureId The ID of the procedure to update
|
|
2205
|
+
* @param removedReview Optional review being removed
|
|
2206
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2207
|
+
* @returns The updated procedure review info
|
|
2208
|
+
*/
|
|
2209
|
+
updateProcedureReviewInfo(procedureId: string, removedReview?: ProcedureReview, isRemoval?: boolean): Promise<ProcedureReviewInfo>;
|
|
2210
|
+
/**
|
|
2211
|
+
* Updates doctorInfo rating in all procedures for a practitioner
|
|
2212
|
+
* @param practitionerId The ID of the practitioner
|
|
2213
|
+
* @param rating The new rating to set
|
|
2214
|
+
*/
|
|
2215
|
+
private updateDoctorInfoInProcedures;
|
|
2216
|
+
/**
|
|
2217
|
+
* Verifies a review as checked by admin/staff
|
|
2218
|
+
* @param reviewId The ID of the review to verify
|
|
2219
|
+
*/
|
|
2220
|
+
verifyReview(reviewId: string): Promise<void>;
|
|
2221
|
+
/**
|
|
2222
|
+
* Calculate the average of all reviews for an entity
|
|
2223
|
+
* @param entityId The entity ID
|
|
2224
|
+
* @param entityType The type of entity ('clinic', 'practitioner', or 'procedure')
|
|
2225
|
+
* @returns Promise that resolves to the calculated review info
|
|
2226
|
+
*/
|
|
2227
|
+
calculateEntityReviewInfo(entityId: string, entityType: "clinic" | "practitioner" | "procedure"): Promise<ClinicReviewInfo | PractitionerReviewInfo | ProcedureReviewInfo>;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2031
2230
|
/**
|
|
2032
2231
|
* Minimal interface for the new mailgun.js client's messages API
|
|
2033
2232
|
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
@@ -2671,4 +2870,4 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
2671
2870
|
sendReviewAddedEmail(data: ReviewAddedEmailData): Promise<any>;
|
|
2672
2871
|
}
|
|
2673
2872
|
|
|
2674
|
-
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientReviewInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type ReviewAddedEmailData, type ReviewRequestEmailData, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole };
|
|
2873
|
+
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type FilledDocument, FilledFormsAggregationService, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientReviewInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole };
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -171,6 +171,27 @@ interface DocumentTemplate {
|
|
|
171
171
|
version: number;
|
|
172
172
|
isActive: boolean;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Interface for a filled document (completed form)
|
|
176
|
+
*/
|
|
177
|
+
interface FilledDocument {
|
|
178
|
+
id: string;
|
|
179
|
+
templateId: string;
|
|
180
|
+
templateVersion: number;
|
|
181
|
+
isUserForm: boolean;
|
|
182
|
+
isRequired: boolean;
|
|
183
|
+
procedureId: string;
|
|
184
|
+
appointmentId: string;
|
|
185
|
+
patientId: string;
|
|
186
|
+
practitionerId: string;
|
|
187
|
+
clinicId: string;
|
|
188
|
+
createdAt: number;
|
|
189
|
+
updatedAt: number;
|
|
190
|
+
values: {
|
|
191
|
+
[elementId: string]: any;
|
|
192
|
+
};
|
|
193
|
+
status: FilledDocumentStatus;
|
|
194
|
+
}
|
|
174
195
|
/**
|
|
175
196
|
* Enum for filled document status
|
|
176
197
|
*/
|
|
@@ -219,6 +240,64 @@ interface CertificationRequirement {
|
|
|
219
240
|
requiredSpecialties?: CertificationSpecialty[];
|
|
220
241
|
}
|
|
221
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Review system type definitions
|
|
245
|
+
*/
|
|
246
|
+
/**
|
|
247
|
+
* Base review interface with common properties
|
|
248
|
+
*/
|
|
249
|
+
interface BaseReview {
|
|
250
|
+
id: string;
|
|
251
|
+
fullReviewId: string;
|
|
252
|
+
patientId: string;
|
|
253
|
+
createdAt: Date;
|
|
254
|
+
updatedAt: Date;
|
|
255
|
+
comment: string;
|
|
256
|
+
isVerified: boolean;
|
|
257
|
+
isPublished: boolean;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Clinic review interface
|
|
261
|
+
* @description Full review for a clinic
|
|
262
|
+
*/
|
|
263
|
+
interface ClinicReview extends BaseReview {
|
|
264
|
+
clinicId: string;
|
|
265
|
+
cleanliness: number;
|
|
266
|
+
facilities: number;
|
|
267
|
+
staffFriendliness: number;
|
|
268
|
+
waitingTime: number;
|
|
269
|
+
accessibility: number;
|
|
270
|
+
overallRating: number;
|
|
271
|
+
wouldRecommend: boolean;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Practitioner review interface
|
|
275
|
+
* @description Full review for a healthcare practitioner
|
|
276
|
+
*/
|
|
277
|
+
interface PractitionerReview extends BaseReview {
|
|
278
|
+
practitionerId: string;
|
|
279
|
+
knowledgeAndExpertise: number;
|
|
280
|
+
communicationSkills: number;
|
|
281
|
+
bedSideManner: number;
|
|
282
|
+
thoroughness: number;
|
|
283
|
+
trustworthiness: number;
|
|
284
|
+
overallRating: number;
|
|
285
|
+
wouldRecommend: boolean;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Procedure review interface
|
|
289
|
+
* @description Full review for a medical procedure
|
|
290
|
+
*/
|
|
291
|
+
interface ProcedureReview extends BaseReview {
|
|
292
|
+
procedureId: string;
|
|
293
|
+
effectivenessOfTreatment: number;
|
|
294
|
+
outcomeExplanation: number;
|
|
295
|
+
painManagement: number;
|
|
296
|
+
followUpCare: number;
|
|
297
|
+
valueForMoney: number;
|
|
298
|
+
overallRating: number;
|
|
299
|
+
wouldRecommend: boolean;
|
|
300
|
+
}
|
|
222
301
|
/**
|
|
223
302
|
* Condensed clinic review information
|
|
224
303
|
* @description Used for aggregated data attached to clinic documents
|
|
@@ -261,6 +340,22 @@ interface ProcedureReviewInfo {
|
|
|
261
340
|
valueForMoney: number;
|
|
262
341
|
recommendationPercentage: number;
|
|
263
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Crown review object
|
|
345
|
+
* @description Combined review data for clinic, practitioner, and procedure
|
|
346
|
+
*/
|
|
347
|
+
interface Review {
|
|
348
|
+
id: string;
|
|
349
|
+
appointmentId: string;
|
|
350
|
+
patientId: string;
|
|
351
|
+
createdAt: Date;
|
|
352
|
+
updatedAt: Date;
|
|
353
|
+
clinicReview?: ClinicReview;
|
|
354
|
+
practitionerReview?: PractitionerReview;
|
|
355
|
+
procedureReview?: ProcedureReview;
|
|
356
|
+
overallComment: string;
|
|
357
|
+
overallRating: number;
|
|
358
|
+
}
|
|
264
359
|
|
|
265
360
|
/**
|
|
266
361
|
* Familije procedura u sistemu
|
|
@@ -2028,6 +2123,110 @@ declare class AppointmentAggregationService {
|
|
|
2028
2123
|
private fetchClinicInfo;
|
|
2029
2124
|
}
|
|
2030
2125
|
|
|
2126
|
+
/**
|
|
2127
|
+
* @class FilledFormsAggregationService
|
|
2128
|
+
* @description Handles aggregation tasks related to filled forms data updates.
|
|
2129
|
+
* Updates appointment documents with LinkedFormInfo when forms are created, updated, or deleted.
|
|
2130
|
+
*/
|
|
2131
|
+
declare class FilledFormsAggregationService {
|
|
2132
|
+
private db;
|
|
2133
|
+
/**
|
|
2134
|
+
* Constructor for FilledFormsAggregationService.
|
|
2135
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2136
|
+
*/
|
|
2137
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2138
|
+
/**
|
|
2139
|
+
* Handles side effects when a filled form is created or updated.
|
|
2140
|
+
* This function would typically be called by a Firestore onCreate or onUpdate trigger.
|
|
2141
|
+
* @param filledDocument The filled document that was created or updated.
|
|
2142
|
+
* @returns {Promise<void>}
|
|
2143
|
+
*/
|
|
2144
|
+
handleFilledFormCreateOrUpdate(filledDocument: FilledDocument): Promise<void>;
|
|
2145
|
+
/**
|
|
2146
|
+
* Handles side effects when a filled form is deleted.
|
|
2147
|
+
* This function would typically be called by a Firestore onDelete trigger.
|
|
2148
|
+
* @param filledDocument The filled document that was deleted.
|
|
2149
|
+
* @returns {Promise<void>}
|
|
2150
|
+
*/
|
|
2151
|
+
handleFilledFormDelete(filledDocument: FilledDocument): Promise<void>;
|
|
2152
|
+
/**
|
|
2153
|
+
* Updates the appointment's pendingUserFormsIds for a new required user form.
|
|
2154
|
+
* This should be called when a required user form is first created.
|
|
2155
|
+
* @param filledDocument The newly created filled document.
|
|
2156
|
+
* @returns {Promise<void>}
|
|
2157
|
+
*/
|
|
2158
|
+
handleRequiredUserFormCreate(filledDocument: FilledDocument): Promise<void>;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
/**
|
|
2162
|
+
* @class ReviewsAggregationService
|
|
2163
|
+
* @description Handles aggregation tasks related to review data updates.
|
|
2164
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2165
|
+
* triggered by changes in the reviews collection.
|
|
2166
|
+
*/
|
|
2167
|
+
declare class ReviewsAggregationService {
|
|
2168
|
+
private db;
|
|
2169
|
+
/**
|
|
2170
|
+
* Constructor for ReviewsAggregationService.
|
|
2171
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2172
|
+
*/
|
|
2173
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2174
|
+
/**
|
|
2175
|
+
* Process a newly created review and update all related entities
|
|
2176
|
+
* @param review The newly created review
|
|
2177
|
+
* @returns Promise resolving when all updates are complete
|
|
2178
|
+
*/
|
|
2179
|
+
processNewReview(review: Review): Promise<void>;
|
|
2180
|
+
/**
|
|
2181
|
+
* Process a deleted review and update all related entities
|
|
2182
|
+
* @param review The deleted review
|
|
2183
|
+
* @returns Promise resolving when all updates are complete
|
|
2184
|
+
*/
|
|
2185
|
+
processDeletedReview(review: Review): Promise<void>;
|
|
2186
|
+
/**
|
|
2187
|
+
* Updates the review info for a clinic
|
|
2188
|
+
* @param clinicId The ID of the clinic to update
|
|
2189
|
+
* @param removedReview Optional review being removed
|
|
2190
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2191
|
+
* @returns The updated clinic review info
|
|
2192
|
+
*/
|
|
2193
|
+
updateClinicReviewInfo(clinicId: string, removedReview?: ClinicReview, isRemoval?: boolean): Promise<ClinicReviewInfo>;
|
|
2194
|
+
/**
|
|
2195
|
+
* Updates the review info for a practitioner
|
|
2196
|
+
* @param practitionerId The ID of the practitioner to update
|
|
2197
|
+
* @param removedReview Optional review being removed
|
|
2198
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2199
|
+
* @returns The updated practitioner review info
|
|
2200
|
+
*/
|
|
2201
|
+
updatePractitionerReviewInfo(practitionerId: string, removedReview?: PractitionerReview, isRemoval?: boolean): Promise<PractitionerReviewInfo>;
|
|
2202
|
+
/**
|
|
2203
|
+
* Updates the review info for a procedure
|
|
2204
|
+
* @param procedureId The ID of the procedure to update
|
|
2205
|
+
* @param removedReview Optional review being removed
|
|
2206
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2207
|
+
* @returns The updated procedure review info
|
|
2208
|
+
*/
|
|
2209
|
+
updateProcedureReviewInfo(procedureId: string, removedReview?: ProcedureReview, isRemoval?: boolean): Promise<ProcedureReviewInfo>;
|
|
2210
|
+
/**
|
|
2211
|
+
* Updates doctorInfo rating in all procedures for a practitioner
|
|
2212
|
+
* @param practitionerId The ID of the practitioner
|
|
2213
|
+
* @param rating The new rating to set
|
|
2214
|
+
*/
|
|
2215
|
+
private updateDoctorInfoInProcedures;
|
|
2216
|
+
/**
|
|
2217
|
+
* Verifies a review as checked by admin/staff
|
|
2218
|
+
* @param reviewId The ID of the review to verify
|
|
2219
|
+
*/
|
|
2220
|
+
verifyReview(reviewId: string): Promise<void>;
|
|
2221
|
+
/**
|
|
2222
|
+
* Calculate the average of all reviews for an entity
|
|
2223
|
+
* @param entityId The entity ID
|
|
2224
|
+
* @param entityType The type of entity ('clinic', 'practitioner', or 'procedure')
|
|
2225
|
+
* @returns Promise that resolves to the calculated review info
|
|
2226
|
+
*/
|
|
2227
|
+
calculateEntityReviewInfo(entityId: string, entityType: "clinic" | "practitioner" | "procedure"): Promise<ClinicReviewInfo | PractitionerReviewInfo | ProcedureReviewInfo>;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2031
2230
|
/**
|
|
2032
2231
|
* Minimal interface for the new mailgun.js client's messages API
|
|
2033
2232
|
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
@@ -2671,4 +2870,4 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
2671
2870
|
sendReviewAddedEmail(data: ReviewAddedEmailData): Promise<any>;
|
|
2672
2871
|
}
|
|
2673
2872
|
|
|
2674
|
-
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientReviewInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type ReviewAddedEmailData, type ReviewRequestEmailData, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole };
|
|
2873
|
+
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type FilledDocument, FilledFormsAggregationService, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientReviewInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole };
|