@blackcode_sa/metaestetics-api 1.6.24 → 1.6.25
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 +31 -3
- package/dist/admin/index.d.ts +31 -3
- package/dist/admin/index.js +126 -36
- package/dist/admin/index.mjs +126 -36
- package/dist/backoffice/index.d.mts +67 -54
- package/dist/backoffice/index.d.ts +67 -54
- package/dist/backoffice/index.js +19 -14
- package/dist/backoffice/index.mjs +19 -14
- package/dist/index.d.mts +271 -258
- package/dist/index.d.ts +271 -258
- package/dist/index.js +19 -14
- package/dist/index.mjs +19 -14
- package/package.json +1 -1
- package/src/admin/booking/booking.admin.ts +8 -5
- package/src/admin/documentation-templates/document-manager.admin.ts +128 -0
- package/src/backoffice/types/technology.types.ts +16 -2
- package/src/services/documentation-templates/documentation-template.service.ts +37 -21
- package/src/types/procedure/index.ts +5 -2
package/dist/admin/index.mjs
CHANGED
|
@@ -72,6 +72,7 @@ var MediaType = /* @__PURE__ */ ((MediaType2) => {
|
|
|
72
72
|
var APPOINTMENTS_COLLECTION = "appointments";
|
|
73
73
|
|
|
74
74
|
// src/types/documentation-templates/index.ts
|
|
75
|
+
var DOCUMENTATION_TEMPLATES_COLLECTION = "documentation-templates";
|
|
75
76
|
var USER_FORMS_SUBCOLLECTION = "user-forms";
|
|
76
77
|
var DOCTOR_FORMS_SUBCOLLECTION = "doctor-forms";
|
|
77
78
|
|
|
@@ -147,9 +148,9 @@ var Logger = class {
|
|
|
147
148
|
|
|
148
149
|
// src/admin/notifications/notifications.admin.ts
|
|
149
150
|
var NotificationsAdmin = class {
|
|
150
|
-
constructor(
|
|
151
|
+
constructor(firestore13) {
|
|
151
152
|
this.expo = new Expo();
|
|
152
|
-
this.db =
|
|
153
|
+
this.db = firestore13 || admin.firestore();
|
|
153
154
|
}
|
|
154
155
|
/**
|
|
155
156
|
* Dohvata notifikaciju po ID-u
|
|
@@ -868,8 +869,8 @@ var ClinicAggregationService = class {
|
|
|
868
869
|
* Constructor for ClinicAggregationService.
|
|
869
870
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
870
871
|
*/
|
|
871
|
-
constructor(
|
|
872
|
-
this.db =
|
|
872
|
+
constructor(firestore13) {
|
|
873
|
+
this.db = firestore13 || admin3.firestore();
|
|
873
874
|
}
|
|
874
875
|
/**
|
|
875
876
|
* Adds clinic information to a clinic group when a new clinic is created
|
|
@@ -1343,8 +1344,8 @@ var ClinicAggregationService = class {
|
|
|
1343
1344
|
import * as admin4 from "firebase-admin";
|
|
1344
1345
|
var CALENDAR_SUBCOLLECTION_ID2 = "calendar";
|
|
1345
1346
|
var PractitionerAggregationService = class {
|
|
1346
|
-
constructor(
|
|
1347
|
-
this.db =
|
|
1347
|
+
constructor(firestore13) {
|
|
1348
|
+
this.db = firestore13 || admin4.firestore();
|
|
1348
1349
|
}
|
|
1349
1350
|
/**
|
|
1350
1351
|
* Adds practitioner information to a clinic when a new practitioner is created
|
|
@@ -1679,8 +1680,8 @@ var PractitionerAggregationService = class {
|
|
|
1679
1680
|
import * as admin5 from "firebase-admin";
|
|
1680
1681
|
var CALENDAR_SUBCOLLECTION_ID3 = "calendar";
|
|
1681
1682
|
var ProcedureAggregationService = class {
|
|
1682
|
-
constructor(
|
|
1683
|
-
this.db =
|
|
1683
|
+
constructor(firestore13) {
|
|
1684
|
+
this.db = firestore13 || admin5.firestore();
|
|
1684
1685
|
}
|
|
1685
1686
|
/**
|
|
1686
1687
|
* Adds procedure information to a practitioner when a new procedure is created
|
|
@@ -2064,8 +2065,8 @@ var ProcedureAggregationService = class {
|
|
|
2064
2065
|
import * as admin6 from "firebase-admin";
|
|
2065
2066
|
var CALENDAR_SUBCOLLECTION_ID4 = "calendar";
|
|
2066
2067
|
var PatientAggregationService = class {
|
|
2067
|
-
constructor(
|
|
2068
|
-
this.db =
|
|
2068
|
+
constructor(firestore13) {
|
|
2069
|
+
this.db = firestore13 || admin6.firestore();
|
|
2069
2070
|
}
|
|
2070
2071
|
// --- Methods for Patient Creation --- >
|
|
2071
2072
|
// No specific aggregations defined for patient creation in the plan.
|
|
@@ -2197,8 +2198,8 @@ var PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
|
2197
2198
|
// src/admin/requirements/patient-requirements.admin.service.ts
|
|
2198
2199
|
import * as admin7 from "firebase-admin";
|
|
2199
2200
|
var PatientRequirementsAdminService = class {
|
|
2200
|
-
constructor(
|
|
2201
|
-
this.db =
|
|
2201
|
+
constructor(firestore13) {
|
|
2202
|
+
this.db = firestore13 || admin7.firestore();
|
|
2202
2203
|
this.notificationsAdmin = new NotificationsAdmin(this.db);
|
|
2203
2204
|
}
|
|
2204
2205
|
/**
|
|
@@ -2526,8 +2527,8 @@ var PatientRequirementsAdminService = class {
|
|
|
2526
2527
|
// src/admin/calendar/calendar.admin.service.ts
|
|
2527
2528
|
import * as admin8 from "firebase-admin";
|
|
2528
2529
|
var CalendarAdminService = class {
|
|
2529
|
-
constructor(
|
|
2530
|
-
this.db =
|
|
2530
|
+
constructor(firestore13) {
|
|
2531
|
+
this.db = firestore13 || admin8.firestore();
|
|
2531
2532
|
Logger.info("[CalendarAdminService] Initialized.");
|
|
2532
2533
|
}
|
|
2533
2534
|
/**
|
|
@@ -2644,9 +2645,9 @@ var BaseMailingService = class {
|
|
|
2644
2645
|
* @param firestore Firestore instance provided by the caller
|
|
2645
2646
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2646
2647
|
*/
|
|
2647
|
-
constructor(
|
|
2648
|
+
constructor(firestore13, mailgunClient) {
|
|
2648
2649
|
var _a;
|
|
2649
|
-
this.db =
|
|
2650
|
+
this.db = firestore13;
|
|
2650
2651
|
this.mailgunClient = mailgunClient;
|
|
2651
2652
|
if (!this.db) {
|
|
2652
2653
|
Logger.error("[BaseMailingService] No Firestore instance provided");
|
|
@@ -2790,8 +2791,8 @@ var BaseMailingService = class {
|
|
|
2790
2791
|
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>";
|
|
2791
2792
|
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>";
|
|
2792
2793
|
var AppointmentMailingService = class extends BaseMailingService {
|
|
2793
|
-
constructor(
|
|
2794
|
-
super(
|
|
2794
|
+
constructor(firestore13, mailgunClient) {
|
|
2795
|
+
super(firestore13, mailgunClient);
|
|
2795
2796
|
this.DEFAULT_MAILGUN_DOMAIN = "mg.metaesthetics.net";
|
|
2796
2797
|
Logger.info("[AppointmentMailingService] Initialized.");
|
|
2797
2798
|
}
|
|
@@ -2940,8 +2941,8 @@ var AppointmentAggregationService = class {
|
|
|
2940
2941
|
* @param mailgunClient - An initialized Mailgun client instance.
|
|
2941
2942
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2942
2943
|
*/
|
|
2943
|
-
constructor(mailgunClient,
|
|
2944
|
-
this.db =
|
|
2944
|
+
constructor(mailgunClient, firestore13) {
|
|
2945
|
+
this.db = firestore13 || admin10.firestore();
|
|
2945
2946
|
this.appointmentMailingService = new AppointmentMailingService(
|
|
2946
2947
|
this.db,
|
|
2947
2948
|
mailgunClient
|
|
@@ -3951,8 +3952,8 @@ var PractitionerInviteMailingService = class extends BaseMailingService {
|
|
|
3951
3952
|
* @param firestore Firestore instance provided by the caller
|
|
3952
3953
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3953
3954
|
*/
|
|
3954
|
-
constructor(
|
|
3955
|
-
super(
|
|
3955
|
+
constructor(firestore13, mailgunClient) {
|
|
3956
|
+
super(firestore13, mailgunClient);
|
|
3956
3957
|
this.DEFAULT_REGISTRATION_URL = "https://metaesthetics.net/register";
|
|
3957
3958
|
this.DEFAULT_SUBJECT = "You've Been Invited to Join as a Practitioner";
|
|
3958
3959
|
this.DEFAULT_MAILGUN_DOMAIN = "mg.metaesthetics.net";
|
|
@@ -4190,7 +4191,7 @@ var PractitionerInviteMailingService = class extends BaseMailingService {
|
|
|
4190
4191
|
};
|
|
4191
4192
|
|
|
4192
4193
|
// src/admin/booking/booking.admin.ts
|
|
4193
|
-
import * as
|
|
4194
|
+
import * as admin12 from "firebase-admin";
|
|
4194
4195
|
|
|
4195
4196
|
// src/admin/booking/booking.calculator.ts
|
|
4196
4197
|
import { Timestamp } from "firebase/firestore";
|
|
@@ -4624,9 +4625,10 @@ var BookingAvailabilityCalculator = class {
|
|
|
4624
4625
|
BookingAvailabilityCalculator.DEFAULT_INTERVAL_MINUTES = 15;
|
|
4625
4626
|
|
|
4626
4627
|
// src/admin/documentation-templates/document-manager.admin.ts
|
|
4628
|
+
import * as admin11 from "firebase-admin";
|
|
4627
4629
|
var DocumentManagerAdminService = class {
|
|
4628
|
-
constructor(
|
|
4629
|
-
this.db =
|
|
4630
|
+
constructor(firestore13) {
|
|
4631
|
+
this.db = firestore13;
|
|
4630
4632
|
}
|
|
4631
4633
|
/**
|
|
4632
4634
|
* Adds operations to a Firestore batch to initialize all linked forms for a new appointment
|
|
@@ -4700,6 +4702,92 @@ var DocumentManagerAdminService = class {
|
|
|
4700
4702
|
}
|
|
4701
4703
|
return { initializedFormsInfo, pendingUserFormsIds, allLinkedTemplateIds };
|
|
4702
4704
|
}
|
|
4705
|
+
/**
|
|
4706
|
+
* Adds operations to a Firestore batch to initialize all linked forms for a new appointment
|
|
4707
|
+
* using the TechnologyDocumentationTemplate references.
|
|
4708
|
+
*
|
|
4709
|
+
* @param dbBatch - The Firestore batch to add operations to.
|
|
4710
|
+
* @param appointmentId - The ID of the newly created appointment.
|
|
4711
|
+
* @param procedureIdForForms - The ID of the procedure associated with this appointment.
|
|
4712
|
+
* @param technologyTemplates - Array of technology documentation template references.
|
|
4713
|
+
* @param patientId - ID of the patient.
|
|
4714
|
+
* @param practitionerId - ID of the practitioner associated with the procedure.
|
|
4715
|
+
* @param clinicId - ID of the clinic where the procedure is performed.
|
|
4716
|
+
* @param nowMillis - Current timestamp in milliseconds for createdAt/updatedAt.
|
|
4717
|
+
* @returns An object containing initializedFormsInfo, pendingUserFormsIds, and allLinkedTemplateIds.
|
|
4718
|
+
*/
|
|
4719
|
+
async batchInitializeAppointmentFormsFromTechnologyTemplates(dbBatch, appointmentId, procedureIdForForms, technologyTemplates, patientId, practitionerId, clinicId, nowMillis) {
|
|
4720
|
+
const initializedFormsInfo = [];
|
|
4721
|
+
const pendingUserFormsIds = [];
|
|
4722
|
+
const allLinkedTemplateIds = [];
|
|
4723
|
+
if (!technologyTemplates || technologyTemplates.length === 0) {
|
|
4724
|
+
console.log(
|
|
4725
|
+
`[DocManagerAdmin] No document templates to initialize for appointment ${appointmentId}.`
|
|
4726
|
+
);
|
|
4727
|
+
return {
|
|
4728
|
+
initializedFormsInfo,
|
|
4729
|
+
pendingUserFormsIds,
|
|
4730
|
+
allLinkedTemplateIds
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4733
|
+
const templateIds = technologyTemplates.map((t) => t.templateId);
|
|
4734
|
+
const templatesSnapshot = await this.db.collection(DOCUMENTATION_TEMPLATES_COLLECTION).where(admin11.firestore.FieldPath.documentId(), "in", templateIds).get();
|
|
4735
|
+
const templatesMap = /* @__PURE__ */ new Map();
|
|
4736
|
+
templatesSnapshot.forEach((doc) => {
|
|
4737
|
+
templatesMap.set(doc.id, doc.data());
|
|
4738
|
+
});
|
|
4739
|
+
for (const templateRef of technologyTemplates) {
|
|
4740
|
+
const template = templatesMap.get(templateRef.templateId);
|
|
4741
|
+
if (!template) {
|
|
4742
|
+
console.warn(
|
|
4743
|
+
`[DocManagerAdmin] Template ${templateRef.templateId} not found in Firestore.`
|
|
4744
|
+
);
|
|
4745
|
+
continue;
|
|
4746
|
+
}
|
|
4747
|
+
const isUserForm = templateRef.isUserForm;
|
|
4748
|
+
const isRequired = templateRef.isRequired;
|
|
4749
|
+
const formSubcollectionPath = isUserForm ? USER_FORMS_SUBCOLLECTION : DOCTOR_FORMS_SUBCOLLECTION;
|
|
4750
|
+
const filledDocumentId = this.db.collection(APPOINTMENTS_COLLECTION).doc(appointmentId).collection(formSubcollectionPath).doc().id;
|
|
4751
|
+
if (isUserForm && isRequired) {
|
|
4752
|
+
pendingUserFormsIds.push(filledDocumentId);
|
|
4753
|
+
}
|
|
4754
|
+
allLinkedTemplateIds.push(filledDocumentId);
|
|
4755
|
+
const initialStatus = "pending" /* PENDING */;
|
|
4756
|
+
const filledDocumentData = {
|
|
4757
|
+
id: filledDocumentId,
|
|
4758
|
+
templateId: templateRef.templateId,
|
|
4759
|
+
templateVersion: template.version,
|
|
4760
|
+
isUserForm,
|
|
4761
|
+
isRequired,
|
|
4762
|
+
appointmentId,
|
|
4763
|
+
procedureId: procedureIdForForms,
|
|
4764
|
+
patientId,
|
|
4765
|
+
practitionerId,
|
|
4766
|
+
clinicId,
|
|
4767
|
+
createdAt: nowMillis,
|
|
4768
|
+
updatedAt: nowMillis,
|
|
4769
|
+
values: {},
|
|
4770
|
+
status: initialStatus
|
|
4771
|
+
};
|
|
4772
|
+
const docRef = this.db.collection(APPOINTMENTS_COLLECTION).doc(appointmentId).collection(formSubcollectionPath).doc(filledDocumentId);
|
|
4773
|
+
dbBatch.set(docRef, filledDocumentData);
|
|
4774
|
+
const linkedForm = {
|
|
4775
|
+
formId: filledDocumentData.id,
|
|
4776
|
+
templateId: template.id,
|
|
4777
|
+
templateVersion: template.version,
|
|
4778
|
+
title: template.title,
|
|
4779
|
+
isUserForm: filledDocumentData.isUserForm,
|
|
4780
|
+
isRequired: filledDocumentData.isRequired,
|
|
4781
|
+
status: filledDocumentData.status,
|
|
4782
|
+
path: docRef.path
|
|
4783
|
+
};
|
|
4784
|
+
initializedFormsInfo.push(linkedForm);
|
|
4785
|
+
console.log(
|
|
4786
|
+
`[DocManagerAdmin] Added FilledDocument ${filledDocumentId} (template: ${template.id}) and its LinkedFormInfo to batch for appointment ${appointmentId}.`
|
|
4787
|
+
);
|
|
4788
|
+
}
|
|
4789
|
+
return { initializedFormsInfo, pendingUserFormsIds, allLinkedTemplateIds };
|
|
4790
|
+
}
|
|
4703
4791
|
};
|
|
4704
4792
|
|
|
4705
4793
|
// src/admin/booking/booking.admin.ts
|
|
@@ -4708,8 +4796,8 @@ var BookingAdmin = class {
|
|
|
4708
4796
|
* Creates a new BookingAdmin instance
|
|
4709
4797
|
* @param firestore - Firestore instance provided by the caller
|
|
4710
4798
|
*/
|
|
4711
|
-
constructor(
|
|
4712
|
-
this.db =
|
|
4799
|
+
constructor(firestore13) {
|
|
4800
|
+
this.db = firestore13 || admin12.firestore();
|
|
4713
4801
|
this.documentManagerAdmin = new DocumentManagerAdminService(this.db);
|
|
4714
4802
|
}
|
|
4715
4803
|
/**
|
|
@@ -4726,8 +4814,8 @@ var BookingAdmin = class {
|
|
|
4726
4814
|
console.log(
|
|
4727
4815
|
`[BookingAdmin] Getting available slots for clinic ${clinicId}, practitioner ${practitionerId}, procedure ${procedureId}`
|
|
4728
4816
|
);
|
|
4729
|
-
const start = timeframe.start instanceof Date ?
|
|
4730
|
-
const end = timeframe.end instanceof Date ?
|
|
4817
|
+
const start = timeframe.start instanceof Date ? admin12.firestore.Timestamp.fromDate(timeframe.start) : timeframe.start;
|
|
4818
|
+
const end = timeframe.end instanceof Date ? admin12.firestore.Timestamp.fromDate(timeframe.end) : timeframe.end;
|
|
4731
4819
|
const clinicDoc = await this.db.collection("clinics").doc(clinicId).get();
|
|
4732
4820
|
if (!clinicDoc.exists) {
|
|
4733
4821
|
throw new Error(`Clinic ${clinicId} not found`);
|
|
@@ -4766,7 +4854,7 @@ var BookingAdmin = class {
|
|
|
4766
4854
|
const result = BookingAvailabilityCalculator.calculateSlots(request);
|
|
4767
4855
|
return {
|
|
4768
4856
|
availableSlots: result.availableSlots.map((slot) => ({
|
|
4769
|
-
start:
|
|
4857
|
+
start: admin12.firestore.Timestamp.fromMillis(slot.start.toMillis())
|
|
4770
4858
|
}))
|
|
4771
4859
|
};
|
|
4772
4860
|
} catch (error) {
|
|
@@ -4869,8 +4957,8 @@ var BookingAdmin = class {
|
|
|
4869
4957
|
`[BookingAdmin] Orchestrating appointment creation for patient ${data.patientId} by user ${authenticatedUserId}`
|
|
4870
4958
|
);
|
|
4871
4959
|
const batch = this.db.batch();
|
|
4872
|
-
const adminTsNow =
|
|
4873
|
-
const serverTimestampValue =
|
|
4960
|
+
const adminTsNow = admin12.firestore.Timestamp.now();
|
|
4961
|
+
const serverTimestampValue = admin12.firestore.FieldValue.serverTimestamp();
|
|
4874
4962
|
try {
|
|
4875
4963
|
if (!data.patientId || !data.procedureId || !data.appointmentStartTime || !data.appointmentEndTime) {
|
|
4876
4964
|
return {
|
|
@@ -4967,7 +5055,7 @@ var BookingAdmin = class {
|
|
|
4967
5055
|
fullName: `${(patientSensitiveData == null ? void 0 : patientSensitiveData.firstName) || ""} ${(patientSensitiveData == null ? void 0 : patientSensitiveData.lastName) || ""}`.trim() || patientProfileData.displayName,
|
|
4968
5056
|
email: (patientSensitiveData == null ? void 0 : patientSensitiveData.email) || "",
|
|
4969
5057
|
phone: (patientSensitiveData == null ? void 0 : patientSensitiveData.phoneNumber) || patientProfileData.phoneNumber || null,
|
|
4970
|
-
dateOfBirth: (patientSensitiveData == null ? void 0 : patientSensitiveData.dateOfBirth) || patientProfileData.dateOfBirth ||
|
|
5058
|
+
dateOfBirth: (patientSensitiveData == null ? void 0 : patientSensitiveData.dateOfBirth) || patientProfileData.dateOfBirth || admin12.firestore.Timestamp.now(),
|
|
4971
5059
|
gender: (patientSensitiveData == null ? void 0 : patientSensitiveData.gender) || "other" /* OTHER */
|
|
4972
5060
|
};
|
|
4973
5061
|
const procedureCategory = procedure.category;
|
|
@@ -5017,9 +5105,11 @@ var BookingAdmin = class {
|
|
|
5017
5105
|
if (procedure.documentationTemplates && Array.isArray(procedure.documentationTemplates)) {
|
|
5018
5106
|
pendingUserFormsIds = procedure.documentationTemplates.filter(
|
|
5019
5107
|
(template) => template.isUserForm && template.isRequired
|
|
5020
|
-
).map(
|
|
5108
|
+
).map(
|
|
5109
|
+
(template) => template.templateId
|
|
5110
|
+
);
|
|
5021
5111
|
linkedFormIds = procedure.documentationTemplates.map(
|
|
5022
|
-
(template) => template.
|
|
5112
|
+
(template) => template.templateId
|
|
5023
5113
|
);
|
|
5024
5114
|
}
|
|
5025
5115
|
const newAppointmentId = this.db.collection(APPOINTMENTS_COLLECTION).doc().id;
|
|
@@ -5107,7 +5197,7 @@ var BookingAdmin = class {
|
|
|
5107
5197
|
let pendingUserFormTemplateIds = [];
|
|
5108
5198
|
let allLinkedFormTemplateIds = [];
|
|
5109
5199
|
if (procedure.documentationTemplates && Array.isArray(procedure.documentationTemplates) && procedure.documentationTemplates.length > 0) {
|
|
5110
|
-
const formInitResult = this.documentManagerAdmin.
|
|
5200
|
+
const formInitResult = await this.documentManagerAdmin.batchInitializeAppointmentFormsFromTechnologyTemplates(
|
|
5111
5201
|
batch,
|
|
5112
5202
|
newAppointmentId,
|
|
5113
5203
|
procedure.id,
|
|
@@ -336,6 +336,72 @@ interface CertificationRequirement {
|
|
|
336
336
|
requiredSpecialties?: CertificationSpecialty[];
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Reference to a documentation template with metadata
|
|
341
|
+
* @property templateId - ID of the documentation template
|
|
342
|
+
* @property isUserForm - Whether this template is filled by users
|
|
343
|
+
* @property isRequired - Whether this template is required
|
|
344
|
+
* @property sortingOrder - The display order of this template
|
|
345
|
+
*/
|
|
346
|
+
interface TechnologyDocumentationTemplate {
|
|
347
|
+
templateId: string;
|
|
348
|
+
isUserForm: boolean;
|
|
349
|
+
isRequired: boolean;
|
|
350
|
+
sortingOrder: number;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Zahtevi koji su povezani sa tehnologijom
|
|
354
|
+
* @property pre - Lista zahteva koji se moraju ispuniti pre procedure
|
|
355
|
+
* @property post - Lista zahteva koji se moraju ispuniti posle procedure
|
|
356
|
+
*/
|
|
357
|
+
interface TechnologyRequirements {
|
|
358
|
+
pre: Requirement[];
|
|
359
|
+
post: Requirement[];
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Technology used in medical procedures
|
|
363
|
+
* Technologies are now a top-level collection that reference their full path in the hierarchy
|
|
364
|
+
* through family, category, and subcategory IDs
|
|
365
|
+
*
|
|
366
|
+
* @property id - Unique identifier of the technology
|
|
367
|
+
* @property name - Name of the technology
|
|
368
|
+
* @property description - Detailed description of the technology and its application
|
|
369
|
+
* @property family - The procedure family this technology belongs to (aesthetics/surgery)
|
|
370
|
+
* @property categoryId - ID of the category this technology belongs to
|
|
371
|
+
* @property subcategoryId - ID of the subcategory this technology belongs to
|
|
372
|
+
* @property technicalDetails - Technical specifications and details
|
|
373
|
+
* @property requirements - List of pre and post procedure requirements
|
|
374
|
+
* @property blockingConditions - List of conditions that prevent the procedure
|
|
375
|
+
* @property contraindications - List of conditions requiring special attention
|
|
376
|
+
* @property benefits - List of expected benefits from the procedure
|
|
377
|
+
* @property certificationRequirement - Required certification level and specialties
|
|
378
|
+
* @property documentationTemplates - List of documentation template references
|
|
379
|
+
* @property isActive - Whether the technology is active in the system
|
|
380
|
+
* @property createdAt - Creation date
|
|
381
|
+
* @property updatedAt - Last update date
|
|
382
|
+
*/
|
|
383
|
+
interface Technology {
|
|
384
|
+
id?: string;
|
|
385
|
+
name: string;
|
|
386
|
+
description: string;
|
|
387
|
+
family: ProcedureFamily;
|
|
388
|
+
categoryId: string;
|
|
389
|
+
subcategoryId: string;
|
|
390
|
+
technicalDetails?: string;
|
|
391
|
+
requirements: {
|
|
392
|
+
pre: Requirement[];
|
|
393
|
+
post: Requirement[];
|
|
394
|
+
};
|
|
395
|
+
blockingConditions: BlockingCondition[];
|
|
396
|
+
contraindications: Contraindication[];
|
|
397
|
+
benefits: TreatmentBenefit[];
|
|
398
|
+
certificationRequirement: CertificationRequirement;
|
|
399
|
+
documentationTemplates?: TechnologyDocumentationTemplate[];
|
|
400
|
+
isActive: boolean;
|
|
401
|
+
createdAt: Date;
|
|
402
|
+
updatedAt: Date;
|
|
403
|
+
}
|
|
404
|
+
|
|
339
405
|
/**
|
|
340
406
|
* Enum for element types in documentation templates
|
|
341
407
|
*/
|
|
@@ -547,59 +613,6 @@ interface UpdateDocumentTemplateData {
|
|
|
547
613
|
sortingOrder?: number;
|
|
548
614
|
}
|
|
549
615
|
|
|
550
|
-
/**
|
|
551
|
-
* Zahtevi koji su povezani sa tehnologijom
|
|
552
|
-
* @property pre - Lista zahteva koji se moraju ispuniti pre procedure
|
|
553
|
-
* @property post - Lista zahteva koji se moraju ispuniti posle procedure
|
|
554
|
-
*/
|
|
555
|
-
interface TechnologyRequirements {
|
|
556
|
-
pre: Requirement[];
|
|
557
|
-
post: Requirement[];
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Technology used in medical procedures
|
|
561
|
-
* Technologies are now a top-level collection that reference their full path in the hierarchy
|
|
562
|
-
* through family, category, and subcategory IDs
|
|
563
|
-
*
|
|
564
|
-
* @property id - Unique identifier of the technology
|
|
565
|
-
* @property name - Name of the technology
|
|
566
|
-
* @property description - Detailed description of the technology and its application
|
|
567
|
-
* @property family - The procedure family this technology belongs to (aesthetics/surgery)
|
|
568
|
-
* @property categoryId - ID of the category this technology belongs to
|
|
569
|
-
* @property subcategoryId - ID of the subcategory this technology belongs to
|
|
570
|
-
* @property technicalDetails - Technical specifications and details
|
|
571
|
-
* @property requirements - List of pre and post procedure requirements
|
|
572
|
-
* @property blockingConditions - List of conditions that prevent the procedure
|
|
573
|
-
* @property contraindications - List of conditions requiring special attention
|
|
574
|
-
* @property benefits - List of expected benefits from the procedure
|
|
575
|
-
* @property certificationRequirement - Required certification level and specialties
|
|
576
|
-
* @property documentationTemplates - List of documentation templates required for this technology
|
|
577
|
-
* @property isActive - Whether the technology is active in the system
|
|
578
|
-
* @property createdAt - Creation date
|
|
579
|
-
* @property updatedAt - Last update date
|
|
580
|
-
*/
|
|
581
|
-
interface Technology {
|
|
582
|
-
id?: string;
|
|
583
|
-
name: string;
|
|
584
|
-
description: string;
|
|
585
|
-
family: ProcedureFamily;
|
|
586
|
-
categoryId: string;
|
|
587
|
-
subcategoryId: string;
|
|
588
|
-
technicalDetails?: string;
|
|
589
|
-
requirements: {
|
|
590
|
-
pre: Requirement[];
|
|
591
|
-
post: Requirement[];
|
|
592
|
-
};
|
|
593
|
-
blockingConditions: BlockingCondition[];
|
|
594
|
-
contraindications: Contraindication[];
|
|
595
|
-
benefits: TreatmentBenefit[];
|
|
596
|
-
certificationRequirement: CertificationRequirement;
|
|
597
|
-
documentationTemplates?: DocumentTemplate[];
|
|
598
|
-
isActive: boolean;
|
|
599
|
-
createdAt: Date;
|
|
600
|
-
updatedAt: Date;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
616
|
/**
|
|
604
617
|
* Default vrednosti za sertifikaciju
|
|
605
618
|
* Svaka nova tehnologija će imati ove vrednosti ako se ne specificira drugačije
|
|
@@ -5058,7 +5071,7 @@ declare class TechnologyService extends BaseService {
|
|
|
5058
5071
|
post: Requirement[];
|
|
5059
5072
|
};
|
|
5060
5073
|
blockingConditions: BlockingCondition[];
|
|
5061
|
-
documentationTemplates?:
|
|
5074
|
+
documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
|
|
5062
5075
|
benefits: TreatmentBenefit[];
|
|
5063
5076
|
certificationRequirement: CertificationRequirement;
|
|
5064
5077
|
id: string;
|
|
@@ -336,6 +336,72 @@ interface CertificationRequirement {
|
|
|
336
336
|
requiredSpecialties?: CertificationSpecialty[];
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Reference to a documentation template with metadata
|
|
341
|
+
* @property templateId - ID of the documentation template
|
|
342
|
+
* @property isUserForm - Whether this template is filled by users
|
|
343
|
+
* @property isRequired - Whether this template is required
|
|
344
|
+
* @property sortingOrder - The display order of this template
|
|
345
|
+
*/
|
|
346
|
+
interface TechnologyDocumentationTemplate {
|
|
347
|
+
templateId: string;
|
|
348
|
+
isUserForm: boolean;
|
|
349
|
+
isRequired: boolean;
|
|
350
|
+
sortingOrder: number;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Zahtevi koji su povezani sa tehnologijom
|
|
354
|
+
* @property pre - Lista zahteva koji se moraju ispuniti pre procedure
|
|
355
|
+
* @property post - Lista zahteva koji se moraju ispuniti posle procedure
|
|
356
|
+
*/
|
|
357
|
+
interface TechnologyRequirements {
|
|
358
|
+
pre: Requirement[];
|
|
359
|
+
post: Requirement[];
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Technology used in medical procedures
|
|
363
|
+
* Technologies are now a top-level collection that reference their full path in the hierarchy
|
|
364
|
+
* through family, category, and subcategory IDs
|
|
365
|
+
*
|
|
366
|
+
* @property id - Unique identifier of the technology
|
|
367
|
+
* @property name - Name of the technology
|
|
368
|
+
* @property description - Detailed description of the technology and its application
|
|
369
|
+
* @property family - The procedure family this technology belongs to (aesthetics/surgery)
|
|
370
|
+
* @property categoryId - ID of the category this technology belongs to
|
|
371
|
+
* @property subcategoryId - ID of the subcategory this technology belongs to
|
|
372
|
+
* @property technicalDetails - Technical specifications and details
|
|
373
|
+
* @property requirements - List of pre and post procedure requirements
|
|
374
|
+
* @property blockingConditions - List of conditions that prevent the procedure
|
|
375
|
+
* @property contraindications - List of conditions requiring special attention
|
|
376
|
+
* @property benefits - List of expected benefits from the procedure
|
|
377
|
+
* @property certificationRequirement - Required certification level and specialties
|
|
378
|
+
* @property documentationTemplates - List of documentation template references
|
|
379
|
+
* @property isActive - Whether the technology is active in the system
|
|
380
|
+
* @property createdAt - Creation date
|
|
381
|
+
* @property updatedAt - Last update date
|
|
382
|
+
*/
|
|
383
|
+
interface Technology {
|
|
384
|
+
id?: string;
|
|
385
|
+
name: string;
|
|
386
|
+
description: string;
|
|
387
|
+
family: ProcedureFamily;
|
|
388
|
+
categoryId: string;
|
|
389
|
+
subcategoryId: string;
|
|
390
|
+
technicalDetails?: string;
|
|
391
|
+
requirements: {
|
|
392
|
+
pre: Requirement[];
|
|
393
|
+
post: Requirement[];
|
|
394
|
+
};
|
|
395
|
+
blockingConditions: BlockingCondition[];
|
|
396
|
+
contraindications: Contraindication[];
|
|
397
|
+
benefits: TreatmentBenefit[];
|
|
398
|
+
certificationRequirement: CertificationRequirement;
|
|
399
|
+
documentationTemplates?: TechnologyDocumentationTemplate[];
|
|
400
|
+
isActive: boolean;
|
|
401
|
+
createdAt: Date;
|
|
402
|
+
updatedAt: Date;
|
|
403
|
+
}
|
|
404
|
+
|
|
339
405
|
/**
|
|
340
406
|
* Enum for element types in documentation templates
|
|
341
407
|
*/
|
|
@@ -547,59 +613,6 @@ interface UpdateDocumentTemplateData {
|
|
|
547
613
|
sortingOrder?: number;
|
|
548
614
|
}
|
|
549
615
|
|
|
550
|
-
/**
|
|
551
|
-
* Zahtevi koji su povezani sa tehnologijom
|
|
552
|
-
* @property pre - Lista zahteva koji se moraju ispuniti pre procedure
|
|
553
|
-
* @property post - Lista zahteva koji se moraju ispuniti posle procedure
|
|
554
|
-
*/
|
|
555
|
-
interface TechnologyRequirements {
|
|
556
|
-
pre: Requirement[];
|
|
557
|
-
post: Requirement[];
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Technology used in medical procedures
|
|
561
|
-
* Technologies are now a top-level collection that reference their full path in the hierarchy
|
|
562
|
-
* through family, category, and subcategory IDs
|
|
563
|
-
*
|
|
564
|
-
* @property id - Unique identifier of the technology
|
|
565
|
-
* @property name - Name of the technology
|
|
566
|
-
* @property description - Detailed description of the technology and its application
|
|
567
|
-
* @property family - The procedure family this technology belongs to (aesthetics/surgery)
|
|
568
|
-
* @property categoryId - ID of the category this technology belongs to
|
|
569
|
-
* @property subcategoryId - ID of the subcategory this technology belongs to
|
|
570
|
-
* @property technicalDetails - Technical specifications and details
|
|
571
|
-
* @property requirements - List of pre and post procedure requirements
|
|
572
|
-
* @property blockingConditions - List of conditions that prevent the procedure
|
|
573
|
-
* @property contraindications - List of conditions requiring special attention
|
|
574
|
-
* @property benefits - List of expected benefits from the procedure
|
|
575
|
-
* @property certificationRequirement - Required certification level and specialties
|
|
576
|
-
* @property documentationTemplates - List of documentation templates required for this technology
|
|
577
|
-
* @property isActive - Whether the technology is active in the system
|
|
578
|
-
* @property createdAt - Creation date
|
|
579
|
-
* @property updatedAt - Last update date
|
|
580
|
-
*/
|
|
581
|
-
interface Technology {
|
|
582
|
-
id?: string;
|
|
583
|
-
name: string;
|
|
584
|
-
description: string;
|
|
585
|
-
family: ProcedureFamily;
|
|
586
|
-
categoryId: string;
|
|
587
|
-
subcategoryId: string;
|
|
588
|
-
technicalDetails?: string;
|
|
589
|
-
requirements: {
|
|
590
|
-
pre: Requirement[];
|
|
591
|
-
post: Requirement[];
|
|
592
|
-
};
|
|
593
|
-
blockingConditions: BlockingCondition[];
|
|
594
|
-
contraindications: Contraindication[];
|
|
595
|
-
benefits: TreatmentBenefit[];
|
|
596
|
-
certificationRequirement: CertificationRequirement;
|
|
597
|
-
documentationTemplates?: DocumentTemplate[];
|
|
598
|
-
isActive: boolean;
|
|
599
|
-
createdAt: Date;
|
|
600
|
-
updatedAt: Date;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
616
|
/**
|
|
604
617
|
* Default vrednosti za sertifikaciju
|
|
605
618
|
* Svaka nova tehnologija će imati ove vrednosti ako se ne specificira drugačije
|
|
@@ -5058,7 +5071,7 @@ declare class TechnologyService extends BaseService {
|
|
|
5058
5071
|
post: Requirement[];
|
|
5059
5072
|
};
|
|
5060
5073
|
blockingConditions: BlockingCondition[];
|
|
5061
|
-
documentationTemplates?:
|
|
5074
|
+
documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
|
|
5062
5075
|
benefits: TreatmentBenefit[];
|
|
5063
5076
|
certificationRequirement: CertificationRequirement;
|
|
5064
5077
|
id: string;
|
package/dist/backoffice/index.js
CHANGED
|
@@ -1615,25 +1615,30 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
1615
1615
|
* @returns The template or null if not found
|
|
1616
1616
|
*/
|
|
1617
1617
|
async getTemplateById(templateId, version) {
|
|
1618
|
-
if (version !== void 0) {
|
|
1619
|
-
try {
|
|
1620
|
-
const versionTemplate = await this.getTemplateVersion(
|
|
1621
|
-
templateId,
|
|
1622
|
-
version
|
|
1623
|
-
);
|
|
1624
|
-
if (versionTemplate) {
|
|
1625
|
-
return versionTemplate;
|
|
1626
|
-
}
|
|
1627
|
-
} catch (error) {
|
|
1628
|
-
console.error(`Error getting template version ${version}:`, error);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
1618
|
const docRef = (0, import_firestore7.doc)(this.collectionRef, templateId);
|
|
1632
1619
|
const docSnap = await (0, import_firestore7.getDoc)(docRef);
|
|
1633
1620
|
if (!docSnap.exists()) {
|
|
1634
1621
|
return null;
|
|
1635
1622
|
}
|
|
1636
|
-
|
|
1623
|
+
const currentTemplate = docSnap.data();
|
|
1624
|
+
if (version === void 0) {
|
|
1625
|
+
return currentTemplate;
|
|
1626
|
+
}
|
|
1627
|
+
if (currentTemplate.version === version) {
|
|
1628
|
+
return currentTemplate;
|
|
1629
|
+
}
|
|
1630
|
+
try {
|
|
1631
|
+
const versionTemplate = await this.getTemplateVersion(
|
|
1632
|
+
templateId,
|
|
1633
|
+
version
|
|
1634
|
+
);
|
|
1635
|
+
if (versionTemplate) {
|
|
1636
|
+
return versionTemplate;
|
|
1637
|
+
}
|
|
1638
|
+
} catch (error) {
|
|
1639
|
+
console.error(`Error getting template version ${version}:`, error);
|
|
1640
|
+
}
|
|
1641
|
+
return null;
|
|
1637
1642
|
}
|
|
1638
1643
|
/**
|
|
1639
1644
|
* Update an existing document template
|
|
@@ -1592,25 +1592,30 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
1592
1592
|
* @returns The template or null if not found
|
|
1593
1593
|
*/
|
|
1594
1594
|
async getTemplateById(templateId, version) {
|
|
1595
|
-
if (version !== void 0) {
|
|
1596
|
-
try {
|
|
1597
|
-
const versionTemplate = await this.getTemplateVersion(
|
|
1598
|
-
templateId,
|
|
1599
|
-
version
|
|
1600
|
-
);
|
|
1601
|
-
if (versionTemplate) {
|
|
1602
|
-
return versionTemplate;
|
|
1603
|
-
}
|
|
1604
|
-
} catch (error) {
|
|
1605
|
-
console.error(`Error getting template version ${version}:`, error);
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
1595
|
const docRef = doc7(this.collectionRef, templateId);
|
|
1609
1596
|
const docSnap = await getDoc7(docRef);
|
|
1610
1597
|
if (!docSnap.exists()) {
|
|
1611
1598
|
return null;
|
|
1612
1599
|
}
|
|
1613
|
-
|
|
1600
|
+
const currentTemplate = docSnap.data();
|
|
1601
|
+
if (version === void 0) {
|
|
1602
|
+
return currentTemplate;
|
|
1603
|
+
}
|
|
1604
|
+
if (currentTemplate.version === version) {
|
|
1605
|
+
return currentTemplate;
|
|
1606
|
+
}
|
|
1607
|
+
try {
|
|
1608
|
+
const versionTemplate = await this.getTemplateVersion(
|
|
1609
|
+
templateId,
|
|
1610
|
+
version
|
|
1611
|
+
);
|
|
1612
|
+
if (versionTemplate) {
|
|
1613
|
+
return versionTemplate;
|
|
1614
|
+
}
|
|
1615
|
+
} catch (error) {
|
|
1616
|
+
console.error(`Error getting template version ${version}:`, error);
|
|
1617
|
+
}
|
|
1618
|
+
return null;
|
|
1614
1619
|
}
|
|
1615
1620
|
/**
|
|
1616
1621
|
* Update an existing document template
|