@blackcode_sa/metaestetics-api 1.5.8 → 1.5.10

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/index.d.mts CHANGED
@@ -4812,9 +4812,17 @@ interface UpdateProcedureData {
4812
4812
  duration?: number;
4813
4813
  isActive?: boolean;
4814
4814
  }
4815
+ /**
4816
+ * Collection name for procedures in Firestore
4817
+ */
4818
+ declare const PROCEDURES_COLLECTION = "procedures";
4815
4819
 
4816
4820
  declare class ProcedureService extends BaseService {
4817
- constructor(db: Firestore, auth: Auth, app: FirebaseApp);
4821
+ private categoryService;
4822
+ private subcategoryService;
4823
+ private technologyService;
4824
+ private productService;
4825
+ constructor(db: Firestore, auth: Auth, app: FirebaseApp, categoryService: CategoryService, subcategoryService: SubcategoryService, technologyService: TechnologyService, productService: ProductService);
4818
4826
  /**
4819
4827
  * Creates a new procedure
4820
4828
  * @param data - The data for creating a new procedure
@@ -4851,26 +4859,6 @@ declare class ProcedureService extends BaseService {
4851
4859
  * @param id - The ID of the procedure to deactivate
4852
4860
  */
4853
4861
  deactivateProcedure(id: string): Promise<void>;
4854
- /**
4855
- * Gets a category by ID
4856
- * @private
4857
- */
4858
- private getCategory;
4859
- /**
4860
- * Gets a subcategory by ID
4861
- * @private
4862
- */
4863
- private getSubcategory;
4864
- /**
4865
- * Gets a technology by ID
4866
- * @private
4867
- */
4868
- private getTechnology;
4869
- /**
4870
- * Gets a product by ID
4871
- * @private
4872
- */
4873
- private getProduct;
4874
4862
  }
4875
4863
 
4876
4864
  /**
@@ -15655,4 +15643,4 @@ declare enum FirebaseErrorCode {
15655
15643
  POPUP_ALREADY_OPEN = "auth/cancelled-popup-request"
15656
15644
  }
15657
15645
 
15658
- export { AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type AppointmentNotification, type AppointmentReminderNotification, AuthError, AuthService, type BaseNotification, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCUMENTATION_TEMPLATES_COLLECTION, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, HeadingLevel, Language, ListType, type LocationData, MedicationAllergySubtype, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, type PatientClinic, type PatientDoctor, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientSensitiveInfo, PatientService, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, type Requirement, type ReviewInfo, SYNCED_CALENDARS_COLLECTION, type ServiceInfo, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TimeSlot, TreatmentBenefit, USER_ERRORS, type UpdateAllergyData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicInfoSchema, clinicLocationSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerSchema, createPractitionerTokenSchema, createUserOptionsSchema, doctorInfoSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicProceduresSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, reviewInfoSchema, serviceInfoSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
15646
+ export { AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type AppointmentNotification, type AppointmentReminderNotification, AuthError, AuthService, type BaseNotification, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCUMENTATION_TEMPLATES_COLLECTION, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, HeadingLevel, Language, ListType, type LocationData, MedicationAllergySubtype, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PROCEDURES_COLLECTION, type PatientClinic, type PatientDoctor, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientSensitiveInfo, PatientService, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, type Requirement, type ReviewInfo, SYNCED_CALENDARS_COLLECTION, type ServiceInfo, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TimeSlot, TreatmentBenefit, USER_ERRORS, type UpdateAllergyData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicInfoSchema, clinicLocationSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerSchema, createPractitionerTokenSchema, createUserOptionsSchema, doctorInfoSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicProceduresSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, reviewInfoSchema, serviceInfoSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
package/dist/index.d.ts CHANGED
@@ -4812,9 +4812,17 @@ interface UpdateProcedureData {
4812
4812
  duration?: number;
4813
4813
  isActive?: boolean;
4814
4814
  }
4815
+ /**
4816
+ * Collection name for procedures in Firestore
4817
+ */
4818
+ declare const PROCEDURES_COLLECTION = "procedures";
4815
4819
 
4816
4820
  declare class ProcedureService extends BaseService {
4817
- constructor(db: Firestore, auth: Auth, app: FirebaseApp);
4821
+ private categoryService;
4822
+ private subcategoryService;
4823
+ private technologyService;
4824
+ private productService;
4825
+ constructor(db: Firestore, auth: Auth, app: FirebaseApp, categoryService: CategoryService, subcategoryService: SubcategoryService, technologyService: TechnologyService, productService: ProductService);
4818
4826
  /**
4819
4827
  * Creates a new procedure
4820
4828
  * @param data - The data for creating a new procedure
@@ -4851,26 +4859,6 @@ declare class ProcedureService extends BaseService {
4851
4859
  * @param id - The ID of the procedure to deactivate
4852
4860
  */
4853
4861
  deactivateProcedure(id: string): Promise<void>;
4854
- /**
4855
- * Gets a category by ID
4856
- * @private
4857
- */
4858
- private getCategory;
4859
- /**
4860
- * Gets a subcategory by ID
4861
- * @private
4862
- */
4863
- private getSubcategory;
4864
- /**
4865
- * Gets a technology by ID
4866
- * @private
4867
- */
4868
- private getTechnology;
4869
- /**
4870
- * Gets a product by ID
4871
- * @private
4872
- */
4873
- private getProduct;
4874
4862
  }
4875
4863
 
4876
4864
  /**
@@ -15655,4 +15643,4 @@ declare enum FirebaseErrorCode {
15655
15643
  POPUP_ALREADY_OPEN = "auth/cancelled-popup-request"
15656
15644
  }
15657
15645
 
15658
- export { AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type AppointmentNotification, type AppointmentReminderNotification, AuthError, AuthService, type BaseNotification, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCUMENTATION_TEMPLATES_COLLECTION, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, HeadingLevel, Language, ListType, type LocationData, MedicationAllergySubtype, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, type PatientClinic, type PatientDoctor, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientSensitiveInfo, PatientService, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, type Requirement, type ReviewInfo, SYNCED_CALENDARS_COLLECTION, type ServiceInfo, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TimeSlot, TreatmentBenefit, USER_ERRORS, type UpdateAllergyData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicInfoSchema, clinicLocationSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerSchema, createPractitionerTokenSchema, createUserOptionsSchema, doctorInfoSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicProceduresSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, reviewInfoSchema, serviceInfoSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
15646
+ export { AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type AppointmentNotification, type AppointmentReminderNotification, AuthError, AuthService, type BaseNotification, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCUMENTATION_TEMPLATES_COLLECTION, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, HeadingLevel, Language, ListType, type LocationData, MedicationAllergySubtype, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PROCEDURES_COLLECTION, type PatientClinic, type PatientDoctor, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientSensitiveInfo, PatientService, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, type Requirement, type ReviewInfo, SYNCED_CALENDARS_COLLECTION, type ServiceInfo, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TimeSlot, TreatmentBenefit, USER_ERRORS, type UpdateAllergyData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicInfoSchema, clinicLocationSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerSchema, createPractitionerTokenSchema, createUserOptionsSchema, doctorInfoSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicProceduresSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, reviewInfoSchema, serviceInfoSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
package/dist/index.js CHANGED
@@ -70,6 +70,7 @@ __export(index_exports, {
70
70
  PATIENT_MEDICAL_INFO_COLLECTION: () => PATIENT_MEDICAL_INFO_COLLECTION,
71
71
  PATIENT_SENSITIVE_INFO_COLLECTION: () => PATIENT_SENSITIVE_INFO_COLLECTION,
72
72
  PRACTITIONERS_COLLECTION: () => PRACTITIONERS_COLLECTION,
73
+ PROCEDURES_COLLECTION: () => PROCEDURES_COLLECTION,
73
74
  PatientService: () => PatientService,
74
75
  PracticeType: () => PracticeType,
75
76
  PractitionerService: () => PractitionerService,
@@ -6431,22 +6432,14 @@ var procedureSchema = createProcedureSchema.extend({
6431
6432
  updatedAt: import_zod16.z.date()
6432
6433
  });
6433
6434
 
6434
- // src/backoffice/types/category.types.ts
6435
- var CATEGORIES_COLLECTION = "backoffice_categories";
6436
-
6437
- // src/backoffice/types/subcategory.types.ts
6438
- var SUBCATEGORIES_COLLECTION = "subcategories";
6439
-
6440
- // src/backoffice/types/technology.types.ts
6441
- var TECHNOLOGIES_COLLECTION = "technologies";
6442
-
6443
- // src/backoffice/types/product.types.ts
6444
- var PRODUCTS_COLLECTION = "products";
6445
-
6446
6435
  // src/services/procedure/procedure.service.ts
6447
6436
  var ProcedureService = class extends BaseService {
6448
- constructor(db, auth, app) {
6437
+ constructor(db, auth, app, categoryService, subcategoryService, technologyService, productService) {
6449
6438
  super(db, auth, app);
6439
+ this.categoryService = categoryService;
6440
+ this.subcategoryService = subcategoryService;
6441
+ this.technologyService = technologyService;
6442
+ this.productService = productService;
6450
6443
  }
6451
6444
  /**
6452
6445
  * Creates a new procedure
@@ -6456,10 +6449,22 @@ var ProcedureService = class extends BaseService {
6456
6449
  async createProcedure(data) {
6457
6450
  const validatedData = createProcedureSchema.parse(data);
6458
6451
  const [category, subcategory, technology, product] = await Promise.all([
6459
- this.getCategory(validatedData.categoryId),
6460
- this.getSubcategory(validatedData.subcategoryId),
6461
- this.getTechnology(validatedData.technologyId),
6462
- this.getProduct(validatedData.productId)
6452
+ this.categoryService.getById(validatedData.categoryId),
6453
+ this.subcategoryService.getById(
6454
+ validatedData.categoryId,
6455
+ validatedData.subcategoryId
6456
+ ),
6457
+ this.technologyService.getById(
6458
+ validatedData.categoryId,
6459
+ validatedData.subcategoryId,
6460
+ validatedData.technologyId
6461
+ ),
6462
+ this.productService.getById(
6463
+ validatedData.categoryId,
6464
+ validatedData.subcategoryId,
6465
+ validatedData.technologyId,
6466
+ validatedData.productId
6467
+ )
6463
6468
  ]);
6464
6469
  if (!category || !subcategory || !technology || !product) {
6465
6470
  throw new Error("One or more required entities not found");
@@ -6565,42 +6570,6 @@ var ProcedureService = class extends BaseService {
6565
6570
  updatedAt: (0, import_firestore21.serverTimestamp)()
6566
6571
  });
6567
6572
  }
6568
- /**
6569
- * Gets a category by ID
6570
- * @private
6571
- */
6572
- async getCategory(id) {
6573
- const docRef = (0, import_firestore21.doc)(this.db, CATEGORIES_COLLECTION, id);
6574
- const docSnap = await (0, import_firestore21.getDoc)(docRef);
6575
- return docSnap.exists() ? docSnap.data() : null;
6576
- }
6577
- /**
6578
- * Gets a subcategory by ID
6579
- * @private
6580
- */
6581
- async getSubcategory(id) {
6582
- const docRef = (0, import_firestore21.doc)(this.db, SUBCATEGORIES_COLLECTION, id);
6583
- const docSnap = await (0, import_firestore21.getDoc)(docRef);
6584
- return docSnap.exists() ? docSnap.data() : null;
6585
- }
6586
- /**
6587
- * Gets a technology by ID
6588
- * @private
6589
- */
6590
- async getTechnology(id) {
6591
- const docRef = (0, import_firestore21.doc)(this.db, TECHNOLOGIES_COLLECTION, id);
6592
- const docSnap = await (0, import_firestore21.getDoc)(docRef);
6593
- return docSnap.exists() ? docSnap.data() : null;
6594
- }
6595
- /**
6596
- * Gets a product by ID
6597
- * @private
6598
- */
6599
- async getProduct(id) {
6600
- const docRef = (0, import_firestore21.doc)(this.db, PRODUCTS_COLLECTION, id);
6601
- const docSnap = await (0, import_firestore21.getDoc)(docRef);
6602
- return docSnap.exists() ? docSnap.data() : null;
6603
- }
6604
6573
  };
6605
6574
 
6606
6575
  // src/services/documentation-templates/documentation-template.service.ts
@@ -9615,6 +9584,11 @@ var BrandService = class extends BaseService {
9615
9584
 
9616
9585
  // src/backoffice/services/category.service.ts
9617
9586
  var import_firestore35 = require("firebase/firestore");
9587
+
9588
+ // src/backoffice/types/category.types.ts
9589
+ var CATEGORIES_COLLECTION = "backoffice_categories";
9590
+
9591
+ // src/backoffice/services/category.service.ts
9618
9592
  var CategoryService = class extends BaseService {
9619
9593
  /**
9620
9594
  * Referenca na Firestore kolekciju kategorija
@@ -9711,6 +9685,11 @@ var CategoryService = class extends BaseService {
9711
9685
 
9712
9686
  // src/backoffice/services/subcategory.service.ts
9713
9687
  var import_firestore36 = require("firebase/firestore");
9688
+
9689
+ // src/backoffice/types/subcategory.types.ts
9690
+ var SUBCATEGORIES_COLLECTION = "subcategories";
9691
+
9692
+ // src/backoffice/services/subcategory.service.ts
9714
9693
  var SubcategoryService = class extends BaseService {
9715
9694
  /**
9716
9695
  * Vraća referencu na Firestore kolekciju podkategorija za određenu kategoriju
@@ -9806,6 +9785,11 @@ var SubcategoryService = class extends BaseService {
9806
9785
 
9807
9786
  // src/backoffice/services/technology.service.ts
9808
9787
  var import_firestore37 = require("firebase/firestore");
9788
+
9789
+ // src/backoffice/types/technology.types.ts
9790
+ var TECHNOLOGIES_COLLECTION = "technologies";
9791
+
9792
+ // src/backoffice/services/technology.service.ts
9809
9793
  var DEFAULT_CERTIFICATION_REQUIREMENT = {
9810
9794
  minimumLevel: "aesthetician" /* AESTHETICIAN */,
9811
9795
  requiredSpecialties: []
@@ -10205,6 +10189,11 @@ var TechnologyService = class extends BaseService {
10205
10189
 
10206
10190
  // src/backoffice/services/product.service.ts
10207
10191
  var import_firestore38 = require("firebase/firestore");
10192
+
10193
+ // src/backoffice/types/product.types.ts
10194
+ var PRODUCTS_COLLECTION = "products";
10195
+
10196
+ // src/backoffice/services/product.service.ts
10208
10197
  var ProductService = class extends BaseService {
10209
10198
  getProductsRefByTechnology(categoryId, subcategoryId, technologyId) {
10210
10199
  return (0, import_firestore38.collection)(
@@ -10416,6 +10405,7 @@ var notificationSchema = import_zod19.z.discriminatedUnion("notificationType", [
10416
10405
  PATIENT_MEDICAL_INFO_COLLECTION,
10417
10406
  PATIENT_SENSITIVE_INFO_COLLECTION,
10418
10407
  PRACTITIONERS_COLLECTION,
10408
+ PROCEDURES_COLLECTION,
10419
10409
  PatientService,
10420
10410
  PracticeType,
10421
10411
  PractitionerService,
package/dist/index.mjs CHANGED
@@ -6397,22 +6397,14 @@ var procedureSchema = createProcedureSchema.extend({
6397
6397
  updatedAt: z16.date()
6398
6398
  });
6399
6399
 
6400
- // src/backoffice/types/category.types.ts
6401
- var CATEGORIES_COLLECTION = "backoffice_categories";
6402
-
6403
- // src/backoffice/types/subcategory.types.ts
6404
- var SUBCATEGORIES_COLLECTION = "subcategories";
6405
-
6406
- // src/backoffice/types/technology.types.ts
6407
- var TECHNOLOGIES_COLLECTION = "technologies";
6408
-
6409
- // src/backoffice/types/product.types.ts
6410
- var PRODUCTS_COLLECTION = "products";
6411
-
6412
6400
  // src/services/procedure/procedure.service.ts
6413
6401
  var ProcedureService = class extends BaseService {
6414
- constructor(db, auth, app) {
6402
+ constructor(db, auth, app, categoryService, subcategoryService, technologyService, productService) {
6415
6403
  super(db, auth, app);
6404
+ this.categoryService = categoryService;
6405
+ this.subcategoryService = subcategoryService;
6406
+ this.technologyService = technologyService;
6407
+ this.productService = productService;
6416
6408
  }
6417
6409
  /**
6418
6410
  * Creates a new procedure
@@ -6422,10 +6414,22 @@ var ProcedureService = class extends BaseService {
6422
6414
  async createProcedure(data) {
6423
6415
  const validatedData = createProcedureSchema.parse(data);
6424
6416
  const [category, subcategory, technology, product] = await Promise.all([
6425
- this.getCategory(validatedData.categoryId),
6426
- this.getSubcategory(validatedData.subcategoryId),
6427
- this.getTechnology(validatedData.technologyId),
6428
- this.getProduct(validatedData.productId)
6417
+ this.categoryService.getById(validatedData.categoryId),
6418
+ this.subcategoryService.getById(
6419
+ validatedData.categoryId,
6420
+ validatedData.subcategoryId
6421
+ ),
6422
+ this.technologyService.getById(
6423
+ validatedData.categoryId,
6424
+ validatedData.subcategoryId,
6425
+ validatedData.technologyId
6426
+ ),
6427
+ this.productService.getById(
6428
+ validatedData.categoryId,
6429
+ validatedData.subcategoryId,
6430
+ validatedData.technologyId,
6431
+ validatedData.productId
6432
+ )
6429
6433
  ]);
6430
6434
  if (!category || !subcategory || !technology || !product) {
6431
6435
  throw new Error("One or more required entities not found");
@@ -6531,42 +6535,6 @@ var ProcedureService = class extends BaseService {
6531
6535
  updatedAt: serverTimestamp13()
6532
6536
  });
6533
6537
  }
6534
- /**
6535
- * Gets a category by ID
6536
- * @private
6537
- */
6538
- async getCategory(id) {
6539
- const docRef = doc12(this.db, CATEGORIES_COLLECTION, id);
6540
- const docSnap = await getDoc16(docRef);
6541
- return docSnap.exists() ? docSnap.data() : null;
6542
- }
6543
- /**
6544
- * Gets a subcategory by ID
6545
- * @private
6546
- */
6547
- async getSubcategory(id) {
6548
- const docRef = doc12(this.db, SUBCATEGORIES_COLLECTION, id);
6549
- const docSnap = await getDoc16(docRef);
6550
- return docSnap.exists() ? docSnap.data() : null;
6551
- }
6552
- /**
6553
- * Gets a technology by ID
6554
- * @private
6555
- */
6556
- async getTechnology(id) {
6557
- const docRef = doc12(this.db, TECHNOLOGIES_COLLECTION, id);
6558
- const docSnap = await getDoc16(docRef);
6559
- return docSnap.exists() ? docSnap.data() : null;
6560
- }
6561
- /**
6562
- * Gets a product by ID
6563
- * @private
6564
- */
6565
- async getProduct(id) {
6566
- const docRef = doc12(this.db, PRODUCTS_COLLECTION, id);
6567
- const docSnap = await getDoc16(docRef);
6568
- return docSnap.exists() ? docSnap.data() : null;
6569
- }
6570
6538
  };
6571
6539
 
6572
6540
  // src/services/documentation-templates/documentation-template.service.ts
@@ -9681,6 +9649,11 @@ import {
9681
9649
  updateDoc as updateDoc23,
9682
9650
  where as where19
9683
9651
  } from "firebase/firestore";
9652
+
9653
+ // src/backoffice/types/category.types.ts
9654
+ var CATEGORIES_COLLECTION = "backoffice_categories";
9655
+
9656
+ // src/backoffice/services/category.service.ts
9684
9657
  var CategoryService = class extends BaseService {
9685
9658
  /**
9686
9659
  * Referenca na Firestore kolekciju kategorija
@@ -9786,6 +9759,11 @@ import {
9786
9759
  updateDoc as updateDoc24,
9787
9760
  where as where20
9788
9761
  } from "firebase/firestore";
9762
+
9763
+ // src/backoffice/types/subcategory.types.ts
9764
+ var SUBCATEGORIES_COLLECTION = "subcategories";
9765
+
9766
+ // src/backoffice/services/subcategory.service.ts
9789
9767
  var SubcategoryService = class extends BaseService {
9790
9768
  /**
9791
9769
  * Vraća referencu na Firestore kolekciju podkategorija za određenu kategoriju
@@ -9892,6 +9870,11 @@ import {
9892
9870
  arrayUnion as arrayUnion5,
9893
9871
  arrayRemove as arrayRemove3
9894
9872
  } from "firebase/firestore";
9873
+
9874
+ // src/backoffice/types/technology.types.ts
9875
+ var TECHNOLOGIES_COLLECTION = "technologies";
9876
+
9877
+ // src/backoffice/services/technology.service.ts
9895
9878
  var DEFAULT_CERTIFICATION_REQUIREMENT = {
9896
9879
  minimumLevel: "aesthetician" /* AESTHETICIAN */,
9897
9880
  requiredSpecialties: []
@@ -10301,6 +10284,11 @@ import {
10301
10284
  updateDoc as updateDoc26,
10302
10285
  where as where22
10303
10286
  } from "firebase/firestore";
10287
+
10288
+ // src/backoffice/types/product.types.ts
10289
+ var PRODUCTS_COLLECTION = "products";
10290
+
10291
+ // src/backoffice/services/product.service.ts
10304
10292
  var ProductService = class extends BaseService {
10305
10293
  getProductsRefByTechnology(categoryId, subcategoryId, technologyId) {
10306
10294
  return collection23(
@@ -10511,6 +10499,7 @@ export {
10511
10499
  PATIENT_MEDICAL_INFO_COLLECTION,
10512
10500
  PATIENT_SENSITIVE_INFO_COLLECTION,
10513
10501
  PRACTITIONERS_COLLECTION,
10502
+ PROCEDURES_COLLECTION,
10514
10503
  PatientService,
10515
10504
  PracticeType,
10516
10505
  PractitionerService,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.5.8",
4
+ "version": "1.5.10",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
package/src/index.ts CHANGED
@@ -278,3 +278,11 @@ export {
278
278
  DOCUMENTATION_TEMPLATES_COLLECTION,
279
279
  FILLED_DOCUMENTS_COLLECTION,
280
280
  } from "./types";
281
+
282
+ // Procedure types
283
+ export type {
284
+ Procedure,
285
+ CreateProcedureData,
286
+ UpdateProcedureData,
287
+ } from "./types/procedure";
288
+ export { PROCEDURES_COLLECTION } from "./types/procedure";
@@ -43,10 +43,31 @@ import {
43
43
  Product,
44
44
  PRODUCTS_COLLECTION,
45
45
  } from "../../backoffice/types/product.types";
46
+ import { CategoryService } from "../../backoffice/services/category.service";
47
+ import { SubcategoryService } from "../../backoffice/services/subcategory.service";
48
+ import { TechnologyService } from "../../backoffice/services/technology.service";
49
+ import { ProductService } from "../../backoffice/services/product.service";
46
50
 
47
51
  export class ProcedureService extends BaseService {
48
- constructor(db: Firestore, auth: Auth, app: FirebaseApp) {
52
+ private categoryService: CategoryService;
53
+ private subcategoryService: SubcategoryService;
54
+ private technologyService: TechnologyService;
55
+ private productService: ProductService;
56
+
57
+ constructor(
58
+ db: Firestore,
59
+ auth: Auth,
60
+ app: FirebaseApp,
61
+ categoryService: CategoryService,
62
+ subcategoryService: SubcategoryService,
63
+ technologyService: TechnologyService,
64
+ productService: ProductService
65
+ ) {
49
66
  super(db, auth, app);
67
+ this.categoryService = categoryService;
68
+ this.subcategoryService = subcategoryService;
69
+ this.technologyService = technologyService;
70
+ this.productService = productService;
50
71
  }
51
72
 
52
73
  /**
@@ -60,10 +81,22 @@ export class ProcedureService extends BaseService {
60
81
 
61
82
  // Get references to related entities
62
83
  const [category, subcategory, technology, product] = await Promise.all([
63
- this.getCategory(validatedData.categoryId),
64
- this.getSubcategory(validatedData.subcategoryId),
65
- this.getTechnology(validatedData.technologyId),
66
- this.getProduct(validatedData.productId),
84
+ this.categoryService.getById(validatedData.categoryId),
85
+ this.subcategoryService.getById(
86
+ validatedData.categoryId,
87
+ validatedData.subcategoryId
88
+ ),
89
+ this.technologyService.getById(
90
+ validatedData.categoryId,
91
+ validatedData.subcategoryId,
92
+ validatedData.technologyId
93
+ ),
94
+ this.productService.getById(
95
+ validatedData.categoryId,
96
+ validatedData.subcategoryId,
97
+ validatedData.technologyId,
98
+ validatedData.productId
99
+ ),
67
100
  ]);
68
101
 
69
102
  if (!category || !subcategory || !technology || !product) {
@@ -195,44 +228,4 @@ export class ProcedureService extends BaseService {
195
228
  updatedAt: serverTimestamp(),
196
229
  });
197
230
  }
198
-
199
- /**
200
- * Gets a category by ID
201
- * @private
202
- */
203
- private async getCategory(id: string): Promise<Category | null> {
204
- const docRef = doc(this.db, CATEGORIES_COLLECTION, id);
205
- const docSnap = await getDoc(docRef);
206
- return docSnap.exists() ? (docSnap.data() as Category) : null;
207
- }
208
-
209
- /**
210
- * Gets a subcategory by ID
211
- * @private
212
- */
213
- private async getSubcategory(id: string): Promise<Subcategory | null> {
214
- const docRef = doc(this.db, SUBCATEGORIES_COLLECTION, id);
215
- const docSnap = await getDoc(docRef);
216
- return docSnap.exists() ? (docSnap.data() as Subcategory) : null;
217
- }
218
-
219
- /**
220
- * Gets a technology by ID
221
- * @private
222
- */
223
- private async getTechnology(id: string): Promise<Technology | null> {
224
- const docRef = doc(this.db, TECHNOLOGIES_COLLECTION, id);
225
- const docSnap = await getDoc(docRef);
226
- return docSnap.exists() ? (docSnap.data() as Technology) : null;
227
- }
228
-
229
- /**
230
- * Gets a product by ID
231
- * @private
232
- */
233
- private async getProduct(id: string): Promise<Product | null> {
234
- const docRef = doc(this.db, PRODUCTS_COLLECTION, id);
235
- const docSnap = await getDoc(docRef);
236
- return docSnap.exists() ? (docSnap.data() as Product) : null;
237
- }
238
231
  }