@blackcode_sa/metaestetics-api 1.7.29 → 1.7.30
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 +9 -1
- package/dist/admin/index.d.ts +9 -1
- package/dist/admin/index.js +144 -32
- package/dist/admin/index.mjs +142 -31
- package/package.json +1 -1
- package/src/admin/index.ts +3 -0
package/dist/admin/index.d.mts
CHANGED
|
@@ -2896,4 +2896,12 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
2896
2896
|
sendReviewAddedEmail(data: ReviewAddedEmailData): Promise<any>;
|
|
2897
2897
|
}
|
|
2898
2898
|
|
|
2899
|
-
|
|
2899
|
+
/**
|
|
2900
|
+
* Ensures that the free consultation infrastructure exists in the database
|
|
2901
|
+
* Creates category, subcategory, and technology if they don't exist
|
|
2902
|
+
* @param db - Firestore database instance (optional, defaults to admin.firestore())
|
|
2903
|
+
* @returns Promise<boolean> - Always returns true after ensuring infrastructure exists
|
|
2904
|
+
*/
|
|
2905
|
+
declare function freeConsultationInfrastructure(db?: admin.firestore.Firestore): Promise<boolean>;
|
|
2906
|
+
|
|
2907
|
+
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, freeConsultationInfrastructure };
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -2896,4 +2896,12 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
2896
2896
|
sendReviewAddedEmail(data: ReviewAddedEmailData): Promise<any>;
|
|
2897
2897
|
}
|
|
2898
2898
|
|
|
2899
|
-
|
|
2899
|
+
/**
|
|
2900
|
+
* Ensures that the free consultation infrastructure exists in the database
|
|
2901
|
+
* Creates category, subcategory, and technology if they don't exist
|
|
2902
|
+
* @param db - Firestore database instance (optional, defaults to admin.firestore())
|
|
2903
|
+
* @returns Promise<boolean> - Always returns true after ensuring infrastructure exists
|
|
2904
|
+
*/
|
|
2905
|
+
declare function freeConsultationInfrastructure(db?: admin.firestore.Firestore): Promise<boolean>;
|
|
2906
|
+
|
|
2907
|
+
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, freeConsultationInfrastructure };
|
package/dist/admin/index.js
CHANGED
|
@@ -58,7 +58,8 @@ __export(index_exports, {
|
|
|
58
58
|
PractitionerTokenStatus: () => PractitionerTokenStatus,
|
|
59
59
|
ProcedureAggregationService: () => ProcedureAggregationService,
|
|
60
60
|
ReviewsAggregationService: () => ReviewsAggregationService,
|
|
61
|
-
UserRole: () => UserRole
|
|
61
|
+
UserRole: () => UserRole,
|
|
62
|
+
freeConsultationInfrastructure: () => freeConsultationInfrastructure
|
|
62
63
|
});
|
|
63
64
|
module.exports = __toCommonJS(index_exports);
|
|
64
65
|
|
|
@@ -205,9 +206,9 @@ var Logger = class {
|
|
|
205
206
|
|
|
206
207
|
// src/admin/notifications/notifications.admin.ts
|
|
207
208
|
var NotificationsAdmin = class {
|
|
208
|
-
constructor(
|
|
209
|
+
constructor(firestore16) {
|
|
209
210
|
this.expo = new import_expo_server_sdk.Expo();
|
|
210
|
-
this.db =
|
|
211
|
+
this.db = firestore16 || admin.firestore();
|
|
211
212
|
}
|
|
212
213
|
/**
|
|
213
214
|
* Dohvata notifikaciju po ID-u
|
|
@@ -926,8 +927,8 @@ var ClinicAggregationService = class {
|
|
|
926
927
|
* Constructor for ClinicAggregationService.
|
|
927
928
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
928
929
|
*/
|
|
929
|
-
constructor(
|
|
930
|
-
this.db =
|
|
930
|
+
constructor(firestore16) {
|
|
931
|
+
this.db = firestore16 || admin3.firestore();
|
|
931
932
|
}
|
|
932
933
|
/**
|
|
933
934
|
* Adds clinic information to a clinic group when a new clinic is created
|
|
@@ -1439,8 +1440,8 @@ var ClinicAggregationService = class {
|
|
|
1439
1440
|
var admin4 = __toESM(require("firebase-admin"));
|
|
1440
1441
|
var CALENDAR_SUBCOLLECTION_ID2 = "calendar";
|
|
1441
1442
|
var PractitionerAggregationService = class {
|
|
1442
|
-
constructor(
|
|
1443
|
-
this.db =
|
|
1443
|
+
constructor(firestore16) {
|
|
1444
|
+
this.db = firestore16 || admin4.firestore();
|
|
1444
1445
|
}
|
|
1445
1446
|
/**
|
|
1446
1447
|
* Adds practitioner information to a clinic when a new practitioner is created
|
|
@@ -1775,8 +1776,8 @@ var PractitionerAggregationService = class {
|
|
|
1775
1776
|
var admin5 = __toESM(require("firebase-admin"));
|
|
1776
1777
|
var CALENDAR_SUBCOLLECTION_ID3 = "calendar";
|
|
1777
1778
|
var ProcedureAggregationService = class {
|
|
1778
|
-
constructor(
|
|
1779
|
-
this.db =
|
|
1779
|
+
constructor(firestore16) {
|
|
1780
|
+
this.db = firestore16 || admin5.firestore();
|
|
1780
1781
|
}
|
|
1781
1782
|
/**
|
|
1782
1783
|
* Adds procedure information to a practitioner when a new procedure is created
|
|
@@ -2291,8 +2292,8 @@ var ProcedureAggregationService = class {
|
|
|
2291
2292
|
var admin6 = __toESM(require("firebase-admin"));
|
|
2292
2293
|
var CALENDAR_SUBCOLLECTION_ID4 = "calendar";
|
|
2293
2294
|
var PatientAggregationService = class {
|
|
2294
|
-
constructor(
|
|
2295
|
-
this.db =
|
|
2295
|
+
constructor(firestore16) {
|
|
2296
|
+
this.db = firestore16 || admin6.firestore();
|
|
2296
2297
|
}
|
|
2297
2298
|
// --- Methods for Patient Creation --- >
|
|
2298
2299
|
// No specific aggregations defined for patient creation in the plan.
|
|
@@ -2424,8 +2425,8 @@ var PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
|
2424
2425
|
// src/admin/requirements/patient-requirements.admin.service.ts
|
|
2425
2426
|
var admin7 = __toESM(require("firebase-admin"));
|
|
2426
2427
|
var PatientRequirementsAdminService = class {
|
|
2427
|
-
constructor(
|
|
2428
|
-
this.db =
|
|
2428
|
+
constructor(firestore16) {
|
|
2429
|
+
this.db = firestore16 || admin7.firestore();
|
|
2429
2430
|
this.notificationsAdmin = new NotificationsAdmin(this.db);
|
|
2430
2431
|
}
|
|
2431
2432
|
/**
|
|
@@ -2753,8 +2754,8 @@ var PatientRequirementsAdminService = class {
|
|
|
2753
2754
|
// src/admin/calendar/calendar.admin.service.ts
|
|
2754
2755
|
var admin8 = __toESM(require("firebase-admin"));
|
|
2755
2756
|
var CalendarAdminService = class {
|
|
2756
|
-
constructor(
|
|
2757
|
-
this.db =
|
|
2757
|
+
constructor(firestore16) {
|
|
2758
|
+
this.db = firestore16 || admin8.firestore();
|
|
2758
2759
|
Logger.info("[CalendarAdminService] Initialized.");
|
|
2759
2760
|
}
|
|
2760
2761
|
/**
|
|
@@ -3037,9 +3038,9 @@ var BaseMailingService = class {
|
|
|
3037
3038
|
* @param firestore Firestore instance provided by the caller
|
|
3038
3039
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3039
3040
|
*/
|
|
3040
|
-
constructor(
|
|
3041
|
+
constructor(firestore16, mailgunClient) {
|
|
3041
3042
|
var _a;
|
|
3042
|
-
this.db =
|
|
3043
|
+
this.db = firestore16;
|
|
3043
3044
|
this.mailgunClient = mailgunClient;
|
|
3044
3045
|
if (!this.db) {
|
|
3045
3046
|
Logger.error("[BaseMailingService] No Firestore instance provided");
|
|
@@ -3183,8 +3184,8 @@ var BaseMailingService = class {
|
|
|
3183
3184
|
var patientAppointmentConfirmedTemplate = "<h1>Appointment Confirmed</h1><p>Dear {{patientName}},</p><p>Your appointment for {{procedureName}} on {{appointmentDate}} at {{appointmentTime}} with {{practitionerName}} at {{clinicName}} has been confirmed.</p><p>Thank you!</p>";
|
|
3184
3185
|
var clinicAppointmentRequestedTemplate = "<h1>New Appointment Request</h1><p>Hello {{clinicName}} Admin,</p><p>A new appointment for {{procedureName}} has been requested by {{patientName}} for {{appointmentDate}} at {{appointmentTime}} with {{practitionerName}}.</p><p>Please review and confirm in the admin panel.</p>";
|
|
3185
3186
|
var AppointmentMailingService = class extends BaseMailingService {
|
|
3186
|
-
constructor(
|
|
3187
|
-
super(
|
|
3187
|
+
constructor(firestore16, mailgunClient) {
|
|
3188
|
+
super(firestore16, mailgunClient);
|
|
3188
3189
|
this.DEFAULT_MAILGUN_DOMAIN = "mg.metaesthetics.net";
|
|
3189
3190
|
Logger.info("[AppointmentMailingService] Initialized.");
|
|
3190
3191
|
}
|
|
@@ -3333,8 +3334,8 @@ var AppointmentAggregationService = class {
|
|
|
3333
3334
|
* @param mailgunClient - An initialized Mailgun client instance.
|
|
3334
3335
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
3335
3336
|
*/
|
|
3336
|
-
constructor(mailgunClient,
|
|
3337
|
-
this.db =
|
|
3337
|
+
constructor(mailgunClient, firestore16) {
|
|
3338
|
+
this.db = firestore16 || admin10.firestore();
|
|
3338
3339
|
this.appointmentMailingService = new AppointmentMailingService(
|
|
3339
3340
|
this.db,
|
|
3340
3341
|
mailgunClient
|
|
@@ -4590,8 +4591,8 @@ var FilledFormsAggregationService = class {
|
|
|
4590
4591
|
* Constructor for FilledFormsAggregationService.
|
|
4591
4592
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
4592
4593
|
*/
|
|
4593
|
-
constructor(
|
|
4594
|
-
this.db =
|
|
4594
|
+
constructor(firestore16) {
|
|
4595
|
+
this.db = firestore16 || admin11.firestore();
|
|
4595
4596
|
Logger.info("[FilledFormsAggregationService] Initialized");
|
|
4596
4597
|
}
|
|
4597
4598
|
/**
|
|
@@ -4785,8 +4786,8 @@ var ReviewsAggregationService = class {
|
|
|
4785
4786
|
* Constructor for ReviewsAggregationService.
|
|
4786
4787
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
4787
4788
|
*/
|
|
4788
|
-
constructor(
|
|
4789
|
-
this.db =
|
|
4789
|
+
constructor(firestore16) {
|
|
4790
|
+
this.db = firestore16 || admin12.firestore();
|
|
4790
4791
|
}
|
|
4791
4792
|
/**
|
|
4792
4793
|
* Process a newly created review and update all related entities
|
|
@@ -5331,8 +5332,8 @@ var PractitionerInviteMailingService = class extends BaseMailingService {
|
|
|
5331
5332
|
* @param firestore Firestore instance provided by the caller
|
|
5332
5333
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
5333
5334
|
*/
|
|
5334
|
-
constructor(
|
|
5335
|
-
super(
|
|
5335
|
+
constructor(firestore16, mailgunClient) {
|
|
5336
|
+
super(firestore16, mailgunClient);
|
|
5336
5337
|
this.DEFAULT_REGISTRATION_URL = "https://metaesthetics.net/register";
|
|
5337
5338
|
this.DEFAULT_SUBJECT = "You've Been Invited to Join as a Practitioner";
|
|
5338
5339
|
this.DEFAULT_MAILGUN_DOMAIN = "mg.metaesthetics.net";
|
|
@@ -6006,8 +6007,8 @@ BookingAvailabilityCalculator.DEFAULT_INTERVAL_MINUTES = 15;
|
|
|
6006
6007
|
// src/admin/documentation-templates/document-manager.admin.ts
|
|
6007
6008
|
var admin13 = __toESM(require("firebase-admin"));
|
|
6008
6009
|
var DocumentManagerAdminService = class {
|
|
6009
|
-
constructor(
|
|
6010
|
-
this.db =
|
|
6010
|
+
constructor(firestore16) {
|
|
6011
|
+
this.db = firestore16;
|
|
6011
6012
|
}
|
|
6012
6013
|
/**
|
|
6013
6014
|
* Adds operations to a Firestore batch to initialize all linked forms for a new appointment
|
|
@@ -6176,8 +6177,8 @@ var BookingAdmin = class {
|
|
|
6176
6177
|
* Creates a new BookingAdmin instance
|
|
6177
6178
|
* @param firestore - Firestore instance provided by the caller
|
|
6178
6179
|
*/
|
|
6179
|
-
constructor(
|
|
6180
|
-
this.db =
|
|
6180
|
+
constructor(firestore16) {
|
|
6181
|
+
this.db = firestore16 || admin14.firestore();
|
|
6181
6182
|
this.documentManagerAdmin = new DocumentManagerAdminService(this.db);
|
|
6182
6183
|
}
|
|
6183
6184
|
/**
|
|
@@ -6779,6 +6780,116 @@ var BookingAdmin = class {
|
|
|
6779
6780
|
}
|
|
6780
6781
|
};
|
|
6781
6782
|
|
|
6783
|
+
// src/admin/free-consultation/free-consultation-utils.admin.ts
|
|
6784
|
+
var admin15 = __toESM(require("firebase-admin"));
|
|
6785
|
+
|
|
6786
|
+
// src/backoffice/types/category.types.ts
|
|
6787
|
+
var CATEGORIES_COLLECTION = "backoffice_categories";
|
|
6788
|
+
|
|
6789
|
+
// src/backoffice/types/subcategory.types.ts
|
|
6790
|
+
var SUBCATEGORIES_COLLECTION = "subcategories";
|
|
6791
|
+
|
|
6792
|
+
// src/backoffice/types/technology.types.ts
|
|
6793
|
+
var TECHNOLOGIES_COLLECTION = "technologies";
|
|
6794
|
+
|
|
6795
|
+
// src/admin/free-consultation/free-consultation-utils.admin.ts
|
|
6796
|
+
async function freeConsultationInfrastructure(db) {
|
|
6797
|
+
const firestore16 = db || admin15.firestore();
|
|
6798
|
+
try {
|
|
6799
|
+
console.log(
|
|
6800
|
+
"[freeConsultationInfrastructure] Checking free consultation infrastructure..."
|
|
6801
|
+
);
|
|
6802
|
+
const technologyRef = firestore16.collection(TECHNOLOGIES_COLLECTION).doc("free-consultation-tech");
|
|
6803
|
+
const technologyDoc = await technologyRef.get();
|
|
6804
|
+
if (technologyDoc.exists) {
|
|
6805
|
+
console.log(
|
|
6806
|
+
"[freeConsultationInfrastructure] Free consultation infrastructure already exists"
|
|
6807
|
+
);
|
|
6808
|
+
return true;
|
|
6809
|
+
}
|
|
6810
|
+
console.log(
|
|
6811
|
+
"[freeConsultationInfrastructure] Creating free consultation infrastructure..."
|
|
6812
|
+
);
|
|
6813
|
+
await createFreeConsultationInfrastructure(firestore16);
|
|
6814
|
+
console.log(
|
|
6815
|
+
"[freeConsultationInfrastructure] Successfully created free consultation infrastructure"
|
|
6816
|
+
);
|
|
6817
|
+
return true;
|
|
6818
|
+
} catch (error) {
|
|
6819
|
+
console.error(
|
|
6820
|
+
"[freeConsultationInfrastructure] Error ensuring infrastructure:",
|
|
6821
|
+
error
|
|
6822
|
+
);
|
|
6823
|
+
throw error;
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6826
|
+
async function createFreeConsultationInfrastructure(db) {
|
|
6827
|
+
const batch = db.batch();
|
|
6828
|
+
const now = /* @__PURE__ */ new Date();
|
|
6829
|
+
const categoryRef = db.collection(CATEGORIES_COLLECTION).doc("consultation");
|
|
6830
|
+
const categoryData = {
|
|
6831
|
+
id: "consultation",
|
|
6832
|
+
name: "Consultation",
|
|
6833
|
+
description: "Professional consultation services for treatment planning and assessment",
|
|
6834
|
+
family: "aesthetics" /* AESTHETICS */,
|
|
6835
|
+
isActive: true,
|
|
6836
|
+
createdAt: now,
|
|
6837
|
+
updatedAt: now
|
|
6838
|
+
};
|
|
6839
|
+
batch.set(categoryRef, categoryData);
|
|
6840
|
+
const subcategoryRef = db.collection(CATEGORIES_COLLECTION).doc("consultation").collection(SUBCATEGORIES_COLLECTION).doc("free-consultation");
|
|
6841
|
+
const subcategoryData = {
|
|
6842
|
+
id: "free-consultation",
|
|
6843
|
+
name: "Free Consultation",
|
|
6844
|
+
description: "Complimentary initial consultation to discuss treatment options and assess patient needs",
|
|
6845
|
+
categoryId: "consultation",
|
|
6846
|
+
isActive: true,
|
|
6847
|
+
createdAt: now,
|
|
6848
|
+
updatedAt: now
|
|
6849
|
+
};
|
|
6850
|
+
batch.set(subcategoryRef, subcategoryData);
|
|
6851
|
+
const technologyRef = db.collection(TECHNOLOGIES_COLLECTION).doc("free-consultation-tech");
|
|
6852
|
+
const technologyData = {
|
|
6853
|
+
id: "free-consultation-tech",
|
|
6854
|
+
name: "Free Consultation Technology",
|
|
6855
|
+
description: "Technology framework for providing free initial consultations to patients",
|
|
6856
|
+
family: "aesthetics" /* AESTHETICS */,
|
|
6857
|
+
categoryId: "consultation",
|
|
6858
|
+
subcategoryId: "free-consultation",
|
|
6859
|
+
technicalDetails: "Standard consultation protocol for initial patient assessment",
|
|
6860
|
+
requirements: {
|
|
6861
|
+
pre: [],
|
|
6862
|
+
// No pre-requirements for consultation
|
|
6863
|
+
post: []
|
|
6864
|
+
// No post-requirements for consultation
|
|
6865
|
+
},
|
|
6866
|
+
blockingConditions: [],
|
|
6867
|
+
// No blocking conditions for consultation
|
|
6868
|
+
contraindications: [],
|
|
6869
|
+
// No contraindications for consultation
|
|
6870
|
+
benefits: [
|
|
6871
|
+
"IMPROVED_PATIENT_UNDERSTANDING",
|
|
6872
|
+
"BETTER_TREATMENT_PLANNING",
|
|
6873
|
+
"ENHANCED_PATIENT_CONFIDENCE"
|
|
6874
|
+
],
|
|
6875
|
+
certificationRequirement: {
|
|
6876
|
+
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
6877
|
+
requiredSpecialties: []
|
|
6878
|
+
// No required specialties for consultation
|
|
6879
|
+
},
|
|
6880
|
+
documentationTemplates: [],
|
|
6881
|
+
isActive: true,
|
|
6882
|
+
createdAt: now,
|
|
6883
|
+
updatedAt: now
|
|
6884
|
+
};
|
|
6885
|
+
batch.set(technologyRef, technologyData);
|
|
6886
|
+
await batch.commit();
|
|
6887
|
+
console.log("[freeConsultationInfrastructure] Successfully created:");
|
|
6888
|
+
console.log(" \u2713 Category: consultation");
|
|
6889
|
+
console.log(" \u2713 Subcategory: free-consultation");
|
|
6890
|
+
console.log(" \u2713 Technology: free-consultation-tech");
|
|
6891
|
+
}
|
|
6892
|
+
|
|
6782
6893
|
// src/admin/index.ts
|
|
6783
6894
|
console.log("[Admin Module] Initialized and services exported.");
|
|
6784
6895
|
TimestampUtils.enableServerMode();
|
|
@@ -6812,5 +6923,6 @@ TimestampUtils.enableServerMode();
|
|
|
6812
6923
|
PractitionerTokenStatus,
|
|
6813
6924
|
ProcedureAggregationService,
|
|
6814
6925
|
ReviewsAggregationService,
|
|
6815
|
-
UserRole
|
|
6926
|
+
UserRole,
|
|
6927
|
+
freeConsultationInfrastructure
|
|
6816
6928
|
});
|
package/dist/admin/index.mjs
CHANGED
|
@@ -148,9 +148,9 @@ var Logger = class {
|
|
|
148
148
|
|
|
149
149
|
// src/admin/notifications/notifications.admin.ts
|
|
150
150
|
var NotificationsAdmin = class {
|
|
151
|
-
constructor(
|
|
151
|
+
constructor(firestore16) {
|
|
152
152
|
this.expo = new Expo();
|
|
153
|
-
this.db =
|
|
153
|
+
this.db = firestore16 || admin.firestore();
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Dohvata notifikaciju po ID-u
|
|
@@ -869,8 +869,8 @@ var ClinicAggregationService = class {
|
|
|
869
869
|
* Constructor for ClinicAggregationService.
|
|
870
870
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
871
871
|
*/
|
|
872
|
-
constructor(
|
|
873
|
-
this.db =
|
|
872
|
+
constructor(firestore16) {
|
|
873
|
+
this.db = firestore16 || admin3.firestore();
|
|
874
874
|
}
|
|
875
875
|
/**
|
|
876
876
|
* Adds clinic information to a clinic group when a new clinic is created
|
|
@@ -1382,8 +1382,8 @@ var ClinicAggregationService = class {
|
|
|
1382
1382
|
import * as admin4 from "firebase-admin";
|
|
1383
1383
|
var CALENDAR_SUBCOLLECTION_ID2 = "calendar";
|
|
1384
1384
|
var PractitionerAggregationService = class {
|
|
1385
|
-
constructor(
|
|
1386
|
-
this.db =
|
|
1385
|
+
constructor(firestore16) {
|
|
1386
|
+
this.db = firestore16 || admin4.firestore();
|
|
1387
1387
|
}
|
|
1388
1388
|
/**
|
|
1389
1389
|
* Adds practitioner information to a clinic when a new practitioner is created
|
|
@@ -1718,8 +1718,8 @@ var PractitionerAggregationService = class {
|
|
|
1718
1718
|
import * as admin5 from "firebase-admin";
|
|
1719
1719
|
var CALENDAR_SUBCOLLECTION_ID3 = "calendar";
|
|
1720
1720
|
var ProcedureAggregationService = class {
|
|
1721
|
-
constructor(
|
|
1722
|
-
this.db =
|
|
1721
|
+
constructor(firestore16) {
|
|
1722
|
+
this.db = firestore16 || admin5.firestore();
|
|
1723
1723
|
}
|
|
1724
1724
|
/**
|
|
1725
1725
|
* Adds procedure information to a practitioner when a new procedure is created
|
|
@@ -2234,8 +2234,8 @@ var ProcedureAggregationService = class {
|
|
|
2234
2234
|
import * as admin6 from "firebase-admin";
|
|
2235
2235
|
var CALENDAR_SUBCOLLECTION_ID4 = "calendar";
|
|
2236
2236
|
var PatientAggregationService = class {
|
|
2237
|
-
constructor(
|
|
2238
|
-
this.db =
|
|
2237
|
+
constructor(firestore16) {
|
|
2238
|
+
this.db = firestore16 || admin6.firestore();
|
|
2239
2239
|
}
|
|
2240
2240
|
// --- Methods for Patient Creation --- >
|
|
2241
2241
|
// No specific aggregations defined for patient creation in the plan.
|
|
@@ -2367,8 +2367,8 @@ var PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
|
2367
2367
|
// src/admin/requirements/patient-requirements.admin.service.ts
|
|
2368
2368
|
import * as admin7 from "firebase-admin";
|
|
2369
2369
|
var PatientRequirementsAdminService = class {
|
|
2370
|
-
constructor(
|
|
2371
|
-
this.db =
|
|
2370
|
+
constructor(firestore16) {
|
|
2371
|
+
this.db = firestore16 || admin7.firestore();
|
|
2372
2372
|
this.notificationsAdmin = new NotificationsAdmin(this.db);
|
|
2373
2373
|
}
|
|
2374
2374
|
/**
|
|
@@ -2696,8 +2696,8 @@ var PatientRequirementsAdminService = class {
|
|
|
2696
2696
|
// src/admin/calendar/calendar.admin.service.ts
|
|
2697
2697
|
import * as admin8 from "firebase-admin";
|
|
2698
2698
|
var CalendarAdminService = class {
|
|
2699
|
-
constructor(
|
|
2700
|
-
this.db =
|
|
2699
|
+
constructor(firestore16) {
|
|
2700
|
+
this.db = firestore16 || admin8.firestore();
|
|
2701
2701
|
Logger.info("[CalendarAdminService] Initialized.");
|
|
2702
2702
|
}
|
|
2703
2703
|
/**
|
|
@@ -2980,9 +2980,9 @@ var BaseMailingService = class {
|
|
|
2980
2980
|
* @param firestore Firestore instance provided by the caller
|
|
2981
2981
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2982
2982
|
*/
|
|
2983
|
-
constructor(
|
|
2983
|
+
constructor(firestore16, mailgunClient) {
|
|
2984
2984
|
var _a;
|
|
2985
|
-
this.db =
|
|
2985
|
+
this.db = firestore16;
|
|
2986
2986
|
this.mailgunClient = mailgunClient;
|
|
2987
2987
|
if (!this.db) {
|
|
2988
2988
|
Logger.error("[BaseMailingService] No Firestore instance provided");
|
|
@@ -3126,8 +3126,8 @@ var BaseMailingService = class {
|
|
|
3126
3126
|
var patientAppointmentConfirmedTemplate = "<h1>Appointment Confirmed</h1><p>Dear {{patientName}},</p><p>Your appointment for {{procedureName}} on {{appointmentDate}} at {{appointmentTime}} with {{practitionerName}} at {{clinicName}} has been confirmed.</p><p>Thank you!</p>";
|
|
3127
3127
|
var clinicAppointmentRequestedTemplate = "<h1>New Appointment Request</h1><p>Hello {{clinicName}} Admin,</p><p>A new appointment for {{procedureName}} has been requested by {{patientName}} for {{appointmentDate}} at {{appointmentTime}} with {{practitionerName}}.</p><p>Please review and confirm in the admin panel.</p>";
|
|
3128
3128
|
var AppointmentMailingService = class extends BaseMailingService {
|
|
3129
|
-
constructor(
|
|
3130
|
-
super(
|
|
3129
|
+
constructor(firestore16, mailgunClient) {
|
|
3130
|
+
super(firestore16, mailgunClient);
|
|
3131
3131
|
this.DEFAULT_MAILGUN_DOMAIN = "mg.metaesthetics.net";
|
|
3132
3132
|
Logger.info("[AppointmentMailingService] Initialized.");
|
|
3133
3133
|
}
|
|
@@ -3276,8 +3276,8 @@ var AppointmentAggregationService = class {
|
|
|
3276
3276
|
* @param mailgunClient - An initialized Mailgun client instance.
|
|
3277
3277
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
3278
3278
|
*/
|
|
3279
|
-
constructor(mailgunClient,
|
|
3280
|
-
this.db =
|
|
3279
|
+
constructor(mailgunClient, firestore16) {
|
|
3280
|
+
this.db = firestore16 || admin10.firestore();
|
|
3281
3281
|
this.appointmentMailingService = new AppointmentMailingService(
|
|
3282
3282
|
this.db,
|
|
3283
3283
|
mailgunClient
|
|
@@ -4533,8 +4533,8 @@ var FilledFormsAggregationService = class {
|
|
|
4533
4533
|
* Constructor for FilledFormsAggregationService.
|
|
4534
4534
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
4535
4535
|
*/
|
|
4536
|
-
constructor(
|
|
4537
|
-
this.db =
|
|
4536
|
+
constructor(firestore16) {
|
|
4537
|
+
this.db = firestore16 || admin11.firestore();
|
|
4538
4538
|
Logger.info("[FilledFormsAggregationService] Initialized");
|
|
4539
4539
|
}
|
|
4540
4540
|
/**
|
|
@@ -4728,8 +4728,8 @@ var ReviewsAggregationService = class {
|
|
|
4728
4728
|
* Constructor for ReviewsAggregationService.
|
|
4729
4729
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
4730
4730
|
*/
|
|
4731
|
-
constructor(
|
|
4732
|
-
this.db =
|
|
4731
|
+
constructor(firestore16) {
|
|
4732
|
+
this.db = firestore16 || admin12.firestore();
|
|
4733
4733
|
}
|
|
4734
4734
|
/**
|
|
4735
4735
|
* Process a newly created review and update all related entities
|
|
@@ -5274,8 +5274,8 @@ var PractitionerInviteMailingService = class extends BaseMailingService {
|
|
|
5274
5274
|
* @param firestore Firestore instance provided by the caller
|
|
5275
5275
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
5276
5276
|
*/
|
|
5277
|
-
constructor(
|
|
5278
|
-
super(
|
|
5277
|
+
constructor(firestore16, mailgunClient) {
|
|
5278
|
+
super(firestore16, mailgunClient);
|
|
5279
5279
|
this.DEFAULT_REGISTRATION_URL = "https://metaesthetics.net/register";
|
|
5280
5280
|
this.DEFAULT_SUBJECT = "You've Been Invited to Join as a Practitioner";
|
|
5281
5281
|
this.DEFAULT_MAILGUN_DOMAIN = "mg.metaesthetics.net";
|
|
@@ -5949,8 +5949,8 @@ BookingAvailabilityCalculator.DEFAULT_INTERVAL_MINUTES = 15;
|
|
|
5949
5949
|
// src/admin/documentation-templates/document-manager.admin.ts
|
|
5950
5950
|
import * as admin13 from "firebase-admin";
|
|
5951
5951
|
var DocumentManagerAdminService = class {
|
|
5952
|
-
constructor(
|
|
5953
|
-
this.db =
|
|
5952
|
+
constructor(firestore16) {
|
|
5953
|
+
this.db = firestore16;
|
|
5954
5954
|
}
|
|
5955
5955
|
/**
|
|
5956
5956
|
* Adds operations to a Firestore batch to initialize all linked forms for a new appointment
|
|
@@ -6119,8 +6119,8 @@ var BookingAdmin = class {
|
|
|
6119
6119
|
* Creates a new BookingAdmin instance
|
|
6120
6120
|
* @param firestore - Firestore instance provided by the caller
|
|
6121
6121
|
*/
|
|
6122
|
-
constructor(
|
|
6123
|
-
this.db =
|
|
6122
|
+
constructor(firestore16) {
|
|
6123
|
+
this.db = firestore16 || admin14.firestore();
|
|
6124
6124
|
this.documentManagerAdmin = new DocumentManagerAdminService(this.db);
|
|
6125
6125
|
}
|
|
6126
6126
|
/**
|
|
@@ -6722,6 +6722,116 @@ var BookingAdmin = class {
|
|
|
6722
6722
|
}
|
|
6723
6723
|
};
|
|
6724
6724
|
|
|
6725
|
+
// src/admin/free-consultation/free-consultation-utils.admin.ts
|
|
6726
|
+
import * as admin15 from "firebase-admin";
|
|
6727
|
+
|
|
6728
|
+
// src/backoffice/types/category.types.ts
|
|
6729
|
+
var CATEGORIES_COLLECTION = "backoffice_categories";
|
|
6730
|
+
|
|
6731
|
+
// src/backoffice/types/subcategory.types.ts
|
|
6732
|
+
var SUBCATEGORIES_COLLECTION = "subcategories";
|
|
6733
|
+
|
|
6734
|
+
// src/backoffice/types/technology.types.ts
|
|
6735
|
+
var TECHNOLOGIES_COLLECTION = "technologies";
|
|
6736
|
+
|
|
6737
|
+
// src/admin/free-consultation/free-consultation-utils.admin.ts
|
|
6738
|
+
async function freeConsultationInfrastructure(db) {
|
|
6739
|
+
const firestore16 = db || admin15.firestore();
|
|
6740
|
+
try {
|
|
6741
|
+
console.log(
|
|
6742
|
+
"[freeConsultationInfrastructure] Checking free consultation infrastructure..."
|
|
6743
|
+
);
|
|
6744
|
+
const technologyRef = firestore16.collection(TECHNOLOGIES_COLLECTION).doc("free-consultation-tech");
|
|
6745
|
+
const technologyDoc = await technologyRef.get();
|
|
6746
|
+
if (technologyDoc.exists) {
|
|
6747
|
+
console.log(
|
|
6748
|
+
"[freeConsultationInfrastructure] Free consultation infrastructure already exists"
|
|
6749
|
+
);
|
|
6750
|
+
return true;
|
|
6751
|
+
}
|
|
6752
|
+
console.log(
|
|
6753
|
+
"[freeConsultationInfrastructure] Creating free consultation infrastructure..."
|
|
6754
|
+
);
|
|
6755
|
+
await createFreeConsultationInfrastructure(firestore16);
|
|
6756
|
+
console.log(
|
|
6757
|
+
"[freeConsultationInfrastructure] Successfully created free consultation infrastructure"
|
|
6758
|
+
);
|
|
6759
|
+
return true;
|
|
6760
|
+
} catch (error) {
|
|
6761
|
+
console.error(
|
|
6762
|
+
"[freeConsultationInfrastructure] Error ensuring infrastructure:",
|
|
6763
|
+
error
|
|
6764
|
+
);
|
|
6765
|
+
throw error;
|
|
6766
|
+
}
|
|
6767
|
+
}
|
|
6768
|
+
async function createFreeConsultationInfrastructure(db) {
|
|
6769
|
+
const batch = db.batch();
|
|
6770
|
+
const now = /* @__PURE__ */ new Date();
|
|
6771
|
+
const categoryRef = db.collection(CATEGORIES_COLLECTION).doc("consultation");
|
|
6772
|
+
const categoryData = {
|
|
6773
|
+
id: "consultation",
|
|
6774
|
+
name: "Consultation",
|
|
6775
|
+
description: "Professional consultation services for treatment planning and assessment",
|
|
6776
|
+
family: "aesthetics" /* AESTHETICS */,
|
|
6777
|
+
isActive: true,
|
|
6778
|
+
createdAt: now,
|
|
6779
|
+
updatedAt: now
|
|
6780
|
+
};
|
|
6781
|
+
batch.set(categoryRef, categoryData);
|
|
6782
|
+
const subcategoryRef = db.collection(CATEGORIES_COLLECTION).doc("consultation").collection(SUBCATEGORIES_COLLECTION).doc("free-consultation");
|
|
6783
|
+
const subcategoryData = {
|
|
6784
|
+
id: "free-consultation",
|
|
6785
|
+
name: "Free Consultation",
|
|
6786
|
+
description: "Complimentary initial consultation to discuss treatment options and assess patient needs",
|
|
6787
|
+
categoryId: "consultation",
|
|
6788
|
+
isActive: true,
|
|
6789
|
+
createdAt: now,
|
|
6790
|
+
updatedAt: now
|
|
6791
|
+
};
|
|
6792
|
+
batch.set(subcategoryRef, subcategoryData);
|
|
6793
|
+
const technologyRef = db.collection(TECHNOLOGIES_COLLECTION).doc("free-consultation-tech");
|
|
6794
|
+
const technologyData = {
|
|
6795
|
+
id: "free-consultation-tech",
|
|
6796
|
+
name: "Free Consultation Technology",
|
|
6797
|
+
description: "Technology framework for providing free initial consultations to patients",
|
|
6798
|
+
family: "aesthetics" /* AESTHETICS */,
|
|
6799
|
+
categoryId: "consultation",
|
|
6800
|
+
subcategoryId: "free-consultation",
|
|
6801
|
+
technicalDetails: "Standard consultation protocol for initial patient assessment",
|
|
6802
|
+
requirements: {
|
|
6803
|
+
pre: [],
|
|
6804
|
+
// No pre-requirements for consultation
|
|
6805
|
+
post: []
|
|
6806
|
+
// No post-requirements for consultation
|
|
6807
|
+
},
|
|
6808
|
+
blockingConditions: [],
|
|
6809
|
+
// No blocking conditions for consultation
|
|
6810
|
+
contraindications: [],
|
|
6811
|
+
// No contraindications for consultation
|
|
6812
|
+
benefits: [
|
|
6813
|
+
"IMPROVED_PATIENT_UNDERSTANDING",
|
|
6814
|
+
"BETTER_TREATMENT_PLANNING",
|
|
6815
|
+
"ENHANCED_PATIENT_CONFIDENCE"
|
|
6816
|
+
],
|
|
6817
|
+
certificationRequirement: {
|
|
6818
|
+
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
6819
|
+
requiredSpecialties: []
|
|
6820
|
+
// No required specialties for consultation
|
|
6821
|
+
},
|
|
6822
|
+
documentationTemplates: [],
|
|
6823
|
+
isActive: true,
|
|
6824
|
+
createdAt: now,
|
|
6825
|
+
updatedAt: now
|
|
6826
|
+
};
|
|
6827
|
+
batch.set(technologyRef, technologyData);
|
|
6828
|
+
await batch.commit();
|
|
6829
|
+
console.log("[freeConsultationInfrastructure] Successfully created:");
|
|
6830
|
+
console.log(" \u2713 Category: consultation");
|
|
6831
|
+
console.log(" \u2713 Subcategory: free-consultation");
|
|
6832
|
+
console.log(" \u2713 Technology: free-consultation-tech");
|
|
6833
|
+
}
|
|
6834
|
+
|
|
6725
6835
|
// src/admin/index.ts
|
|
6726
6836
|
console.log("[Admin Module] Initialized and services exported.");
|
|
6727
6837
|
TimestampUtils.enableServerMode();
|
|
@@ -6754,5 +6864,6 @@ export {
|
|
|
6754
6864
|
PractitionerTokenStatus,
|
|
6755
6865
|
ProcedureAggregationService,
|
|
6756
6866
|
ReviewsAggregationService,
|
|
6757
|
-
UserRole
|
|
6867
|
+
UserRole,
|
|
6868
|
+
freeConsultationInfrastructure
|
|
6758
6869
|
};
|
package/package.json
CHANGED
package/src/admin/index.ts
CHANGED
|
@@ -139,3 +139,6 @@ export * from "./aggregation/reviews/reviews.aggregation.service";
|
|
|
139
139
|
// Re-export types that Cloud Functions might need direct access to
|
|
140
140
|
export * from "../types/appointment";
|
|
141
141
|
// Add other types as needed
|
|
142
|
+
|
|
143
|
+
// Export free consultation utilities
|
|
144
|
+
export * from "./free-consultation/free-consultation-utils.admin";
|