@blackcode_sa/metaestetics-api 1.7.15 → 1.7.17
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 +13 -4
- package/dist/admin/index.d.ts +13 -4
- package/dist/admin/index.js +5 -9
- package/dist/admin/index.mjs +5 -9
- package/dist/backoffice/index.js +54 -49
- package/dist/backoffice/index.mjs +76 -53
- package/dist/index.d.mts +55 -2
- package/dist/index.d.ts +55 -2
- package/dist/index.js +155 -0
- package/dist/index.mjs +155 -0
- package/package.json +1 -1
- package/src/admin/booking/booking.admin.ts +8 -20
- package/src/index.ts +1 -0
- package/src/services/documentation-templates/filled-document.service.ts +220 -0
- package/src/types/documentation-templates/index.ts +13 -1
package/dist/index.d.mts
CHANGED
|
@@ -2093,7 +2093,7 @@ interface FilledDocument {
|
|
|
2093
2093
|
createdAt: number;
|
|
2094
2094
|
updatedAt: number;
|
|
2095
2095
|
values: {
|
|
2096
|
-
[elementId: string]: any;
|
|
2096
|
+
[elementId: string]: any | FilledDocumentFileValue;
|
|
2097
2097
|
};
|
|
2098
2098
|
status: FilledDocumentStatus;
|
|
2099
2099
|
}
|
|
@@ -2108,6 +2108,17 @@ declare enum FilledDocumentStatus {
|
|
|
2108
2108
|
SIGNED = "signed",// Only used for user forms
|
|
2109
2109
|
REJECTED = "rejected"
|
|
2110
2110
|
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Interface for file upload results to be stored in filled document values
|
|
2113
|
+
*/
|
|
2114
|
+
interface FilledDocumentFileValue {
|
|
2115
|
+
mediaId: string;
|
|
2116
|
+
url: string;
|
|
2117
|
+
name: string;
|
|
2118
|
+
contentType: string;
|
|
2119
|
+
size: number;
|
|
2120
|
+
uploadedAt: number;
|
|
2121
|
+
}
|
|
2111
2122
|
|
|
2112
2123
|
/**
|
|
2113
2124
|
* Brend proizvoda ili opreme
|
|
@@ -6675,6 +6686,7 @@ declare class DocumentationTemplateService extends BaseService {
|
|
|
6675
6686
|
*/
|
|
6676
6687
|
declare class FilledDocumentService extends BaseService {
|
|
6677
6688
|
private readonly templateService;
|
|
6689
|
+
private readonly mediaService;
|
|
6678
6690
|
constructor(...args: ConstructorParameters<typeof BaseService>);
|
|
6679
6691
|
private getFormSubcollectionPath;
|
|
6680
6692
|
/**
|
|
@@ -6791,6 +6803,47 @@ declare class FilledDocumentService extends BaseService {
|
|
|
6791
6803
|
documents: FilledDocument[];
|
|
6792
6804
|
lastDoc: QueryDocumentSnapshot<FilledDocument> | null;
|
|
6793
6805
|
}>;
|
|
6806
|
+
/**
|
|
6807
|
+
* Upload a file and associate it with a filled document field.
|
|
6808
|
+
* @param appointmentId - ID of the appointment.
|
|
6809
|
+
* @param formId - ID of the filled document.
|
|
6810
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6811
|
+
* @param file - The file to upload.
|
|
6812
|
+
* @param fieldId - The ID of the field in the document to associate with this file.
|
|
6813
|
+
* @param accessLevel - Access level for the file, defaults to PRIVATE.
|
|
6814
|
+
* @returns The updated filled document with file information.
|
|
6815
|
+
*/
|
|
6816
|
+
uploadFileForFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, file: File | Blob, fieldId: string, accessLevel?: MediaAccessLevel): Promise<FilledDocument>;
|
|
6817
|
+
/**
|
|
6818
|
+
* Upload a signature image for a filled document field.
|
|
6819
|
+
* This is a specialized version of uploadFileForFilledDocument specifically for signatures.
|
|
6820
|
+
* @param appointmentId - ID of the appointment.
|
|
6821
|
+
* @param formId - ID of the filled document.
|
|
6822
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6823
|
+
* @param signatureBlob - The signature image as a Blob.
|
|
6824
|
+
* @param fieldId - The ID of the signature field in the document.
|
|
6825
|
+
* @returns The updated filled document with signature information.
|
|
6826
|
+
*/
|
|
6827
|
+
uploadSignatureForFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, signatureBlob: Blob, fieldId: string): Promise<FilledDocument>;
|
|
6828
|
+
/**
|
|
6829
|
+
* Remove a file from a filled document field.
|
|
6830
|
+
* This will both update the document and delete the media file.
|
|
6831
|
+
* @param appointmentId - ID of the appointment.
|
|
6832
|
+
* @param formId - ID of the filled document.
|
|
6833
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6834
|
+
* @param fieldId - The ID of the field containing the file.
|
|
6835
|
+
* @returns The updated filled document with the file removed.
|
|
6836
|
+
*/
|
|
6837
|
+
removeFileFromFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, fieldId: string): Promise<FilledDocument>;
|
|
6838
|
+
/**
|
|
6839
|
+
* Get the download URL for a file in a filled document.
|
|
6840
|
+
* @param appointmentId - ID of the appointment.
|
|
6841
|
+
* @param formId - ID of the filled document.
|
|
6842
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6843
|
+
* @param fieldId - The ID of the field containing the file.
|
|
6844
|
+
* @returns The download URL for the file, or null if not found.
|
|
6845
|
+
*/
|
|
6846
|
+
getFileUrlFromFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, fieldId: string): Promise<string | null>;
|
|
6794
6847
|
}
|
|
6795
6848
|
|
|
6796
6849
|
/**
|
|
@@ -19523,4 +19576,4 @@ declare const createReviewSchema: z.ZodEffects<z.ZodObject<{
|
|
|
19523
19576
|
} | undefined;
|
|
19524
19577
|
}>;
|
|
19525
19578
|
|
|
19526
|
-
export { APPOINTMENTS_COLLECTION, 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 Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseDocumentElement, type BaseNotification, type BinaryChoiceElement, 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, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, 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, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, type HeadingElement, HeadingLevel, Language, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MedicationAllergySubtype, type MultipleChoiceElement, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, USER_FORMS_SUBCOLLECTION, type UpdateAllergyData, type UpdateAppointmentData, 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, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
|
|
19579
|
+
export { APPOINTMENTS_COLLECTION, 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 Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseDocumentElement, type BaseNotification, type BinaryChoiceElement, 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, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, 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, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, type HeadingElement, HeadingLevel, Language, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MedicationAllergySubtype, type MultipleChoiceElement, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, USER_FORMS_SUBCOLLECTION, type UpdateAllergyData, type UpdateAppointmentData, 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, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -2093,7 +2093,7 @@ interface FilledDocument {
|
|
|
2093
2093
|
createdAt: number;
|
|
2094
2094
|
updatedAt: number;
|
|
2095
2095
|
values: {
|
|
2096
|
-
[elementId: string]: any;
|
|
2096
|
+
[elementId: string]: any | FilledDocumentFileValue;
|
|
2097
2097
|
};
|
|
2098
2098
|
status: FilledDocumentStatus;
|
|
2099
2099
|
}
|
|
@@ -2108,6 +2108,17 @@ declare enum FilledDocumentStatus {
|
|
|
2108
2108
|
SIGNED = "signed",// Only used for user forms
|
|
2109
2109
|
REJECTED = "rejected"
|
|
2110
2110
|
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Interface for file upload results to be stored in filled document values
|
|
2113
|
+
*/
|
|
2114
|
+
interface FilledDocumentFileValue {
|
|
2115
|
+
mediaId: string;
|
|
2116
|
+
url: string;
|
|
2117
|
+
name: string;
|
|
2118
|
+
contentType: string;
|
|
2119
|
+
size: number;
|
|
2120
|
+
uploadedAt: number;
|
|
2121
|
+
}
|
|
2111
2122
|
|
|
2112
2123
|
/**
|
|
2113
2124
|
* Brend proizvoda ili opreme
|
|
@@ -6675,6 +6686,7 @@ declare class DocumentationTemplateService extends BaseService {
|
|
|
6675
6686
|
*/
|
|
6676
6687
|
declare class FilledDocumentService extends BaseService {
|
|
6677
6688
|
private readonly templateService;
|
|
6689
|
+
private readonly mediaService;
|
|
6678
6690
|
constructor(...args: ConstructorParameters<typeof BaseService>);
|
|
6679
6691
|
private getFormSubcollectionPath;
|
|
6680
6692
|
/**
|
|
@@ -6791,6 +6803,47 @@ declare class FilledDocumentService extends BaseService {
|
|
|
6791
6803
|
documents: FilledDocument[];
|
|
6792
6804
|
lastDoc: QueryDocumentSnapshot<FilledDocument> | null;
|
|
6793
6805
|
}>;
|
|
6806
|
+
/**
|
|
6807
|
+
* Upload a file and associate it with a filled document field.
|
|
6808
|
+
* @param appointmentId - ID of the appointment.
|
|
6809
|
+
* @param formId - ID of the filled document.
|
|
6810
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6811
|
+
* @param file - The file to upload.
|
|
6812
|
+
* @param fieldId - The ID of the field in the document to associate with this file.
|
|
6813
|
+
* @param accessLevel - Access level for the file, defaults to PRIVATE.
|
|
6814
|
+
* @returns The updated filled document with file information.
|
|
6815
|
+
*/
|
|
6816
|
+
uploadFileForFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, file: File | Blob, fieldId: string, accessLevel?: MediaAccessLevel): Promise<FilledDocument>;
|
|
6817
|
+
/**
|
|
6818
|
+
* Upload a signature image for a filled document field.
|
|
6819
|
+
* This is a specialized version of uploadFileForFilledDocument specifically for signatures.
|
|
6820
|
+
* @param appointmentId - ID of the appointment.
|
|
6821
|
+
* @param formId - ID of the filled document.
|
|
6822
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6823
|
+
* @param signatureBlob - The signature image as a Blob.
|
|
6824
|
+
* @param fieldId - The ID of the signature field in the document.
|
|
6825
|
+
* @returns The updated filled document with signature information.
|
|
6826
|
+
*/
|
|
6827
|
+
uploadSignatureForFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, signatureBlob: Blob, fieldId: string): Promise<FilledDocument>;
|
|
6828
|
+
/**
|
|
6829
|
+
* Remove a file from a filled document field.
|
|
6830
|
+
* This will both update the document and delete the media file.
|
|
6831
|
+
* @param appointmentId - ID of the appointment.
|
|
6832
|
+
* @param formId - ID of the filled document.
|
|
6833
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6834
|
+
* @param fieldId - The ID of the field containing the file.
|
|
6835
|
+
* @returns The updated filled document with the file removed.
|
|
6836
|
+
*/
|
|
6837
|
+
removeFileFromFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, fieldId: string): Promise<FilledDocument>;
|
|
6838
|
+
/**
|
|
6839
|
+
* Get the download URL for a file in a filled document.
|
|
6840
|
+
* @param appointmentId - ID of the appointment.
|
|
6841
|
+
* @param formId - ID of the filled document.
|
|
6842
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
6843
|
+
* @param fieldId - The ID of the field containing the file.
|
|
6844
|
+
* @returns The download URL for the file, or null if not found.
|
|
6845
|
+
*/
|
|
6846
|
+
getFileUrlFromFilledDocument(appointmentId: string, formId: string, isUserForm: boolean, fieldId: string): Promise<string | null>;
|
|
6794
6847
|
}
|
|
6795
6848
|
|
|
6796
6849
|
/**
|
|
@@ -19523,4 +19576,4 @@ declare const createReviewSchema: z.ZodEffects<z.ZodObject<{
|
|
|
19523
19576
|
} | undefined;
|
|
19524
19577
|
}>;
|
|
19525
19578
|
|
|
19526
|
-
export { APPOINTMENTS_COLLECTION, 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 Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseDocumentElement, type BaseNotification, type BinaryChoiceElement, 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, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, 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, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, type HeadingElement, HeadingLevel, Language, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MedicationAllergySubtype, type MultipleChoiceElement, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, USER_FORMS_SUBCOLLECTION, type UpdateAllergyData, type UpdateAppointmentData, 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, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
|
|
19579
|
+
export { APPOINTMENTS_COLLECTION, 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 Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseDocumentElement, type BaseNotification, type BinaryChoiceElement, 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, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, 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, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, type HeadingElement, HeadingLevel, Language, type ListElement, ListType, type LocationData, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MedicationAllergySubtype, type MultipleChoiceElement, type Notification, NotificationService, NotificationStatus, NotificationType, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, USER_FORMS_SUBCOLLECTION, type UpdateAllergyData, type UpdateAppointmentData, 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, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
|
package/dist/index.js
CHANGED
|
@@ -9363,6 +9363,7 @@ var FilledDocumentService = class extends BaseService {
|
|
|
9363
9363
|
constructor(...args) {
|
|
9364
9364
|
super(...args);
|
|
9365
9365
|
this.templateService = new DocumentationTemplateService(...args);
|
|
9366
|
+
this.mediaService = new MediaService(...args);
|
|
9366
9367
|
}
|
|
9367
9368
|
getFormSubcollectionPath(isUserForm) {
|
|
9368
9369
|
return isUserForm ? USER_FORMS_SUBCOLLECTION : DOCTOR_FORMS_SUBCOLLECTION;
|
|
@@ -9625,6 +9626,160 @@ var FilledDocumentService = class extends BaseService {
|
|
|
9625
9626
|
);
|
|
9626
9627
|
return { documents: [], lastDoc: null };
|
|
9627
9628
|
}
|
|
9629
|
+
/**
|
|
9630
|
+
* Upload a file and associate it with a filled document field.
|
|
9631
|
+
* @param appointmentId - ID of the appointment.
|
|
9632
|
+
* @param formId - ID of the filled document.
|
|
9633
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9634
|
+
* @param file - The file to upload.
|
|
9635
|
+
* @param fieldId - The ID of the field in the document to associate with this file.
|
|
9636
|
+
* @param accessLevel - Access level for the file, defaults to PRIVATE.
|
|
9637
|
+
* @returns The updated filled document with file information.
|
|
9638
|
+
*/
|
|
9639
|
+
async uploadFileForFilledDocument(appointmentId, formId, isUserForm, file, fieldId, accessLevel = "private" /* PRIVATE */) {
|
|
9640
|
+
console.log(
|
|
9641
|
+
`[FilledDocumentService] Uploading file for field ${fieldId} in form ${formId}`
|
|
9642
|
+
);
|
|
9643
|
+
const existingDoc = await this.getFilledDocumentFromAppointmentById(
|
|
9644
|
+
appointmentId,
|
|
9645
|
+
formId,
|
|
9646
|
+
isUserForm
|
|
9647
|
+
);
|
|
9648
|
+
if (!existingDoc) {
|
|
9649
|
+
throw new Error(
|
|
9650
|
+
`Filled document with ID ${formId} not found in appointment ${appointmentId}`
|
|
9651
|
+
);
|
|
9652
|
+
}
|
|
9653
|
+
const ownerId = existingDoc.patientId;
|
|
9654
|
+
const collectionName = isUserForm ? "patient_forms_files" : "doctor_forms_files";
|
|
9655
|
+
const mediaMetadata = await this.mediaService.uploadMedia(
|
|
9656
|
+
file,
|
|
9657
|
+
ownerId,
|
|
9658
|
+
accessLevel,
|
|
9659
|
+
collectionName,
|
|
9660
|
+
file instanceof File ? file.name : `${fieldId}_file`
|
|
9661
|
+
);
|
|
9662
|
+
const fileValue = {
|
|
9663
|
+
mediaId: mediaMetadata.id,
|
|
9664
|
+
url: mediaMetadata.url,
|
|
9665
|
+
name: mediaMetadata.name,
|
|
9666
|
+
contentType: mediaMetadata.contentType,
|
|
9667
|
+
size: mediaMetadata.size,
|
|
9668
|
+
uploadedAt: Date.now()
|
|
9669
|
+
};
|
|
9670
|
+
const values = {
|
|
9671
|
+
[fieldId]: fileValue
|
|
9672
|
+
};
|
|
9673
|
+
return this.updateFilledDocumentInAppointment(
|
|
9674
|
+
appointmentId,
|
|
9675
|
+
formId,
|
|
9676
|
+
isUserForm,
|
|
9677
|
+
values
|
|
9678
|
+
);
|
|
9679
|
+
}
|
|
9680
|
+
/**
|
|
9681
|
+
* Upload a signature image for a filled document field.
|
|
9682
|
+
* This is a specialized version of uploadFileForFilledDocument specifically for signatures.
|
|
9683
|
+
* @param appointmentId - ID of the appointment.
|
|
9684
|
+
* @param formId - ID of the filled document.
|
|
9685
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9686
|
+
* @param signatureBlob - The signature image as a Blob.
|
|
9687
|
+
* @param fieldId - The ID of the signature field in the document.
|
|
9688
|
+
* @returns The updated filled document with signature information.
|
|
9689
|
+
*/
|
|
9690
|
+
async uploadSignatureForFilledDocument(appointmentId, formId, isUserForm, signatureBlob, fieldId) {
|
|
9691
|
+
console.log(
|
|
9692
|
+
`[FilledDocumentService] Uploading signature for field ${fieldId} in form ${formId}`
|
|
9693
|
+
);
|
|
9694
|
+
const signatureFile = new File(
|
|
9695
|
+
[signatureBlob],
|
|
9696
|
+
`signature_${fieldId}.png`,
|
|
9697
|
+
{
|
|
9698
|
+
type: "image/png"
|
|
9699
|
+
}
|
|
9700
|
+
);
|
|
9701
|
+
return this.uploadFileForFilledDocument(
|
|
9702
|
+
appointmentId,
|
|
9703
|
+
formId,
|
|
9704
|
+
isUserForm,
|
|
9705
|
+
signatureFile,
|
|
9706
|
+
fieldId,
|
|
9707
|
+
"confidential" /* CONFIDENTIAL */
|
|
9708
|
+
// Signatures should be confidential
|
|
9709
|
+
);
|
|
9710
|
+
}
|
|
9711
|
+
/**
|
|
9712
|
+
* Remove a file from a filled document field.
|
|
9713
|
+
* This will both update the document and delete the media file.
|
|
9714
|
+
* @param appointmentId - ID of the appointment.
|
|
9715
|
+
* @param formId - ID of the filled document.
|
|
9716
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9717
|
+
* @param fieldId - The ID of the field containing the file.
|
|
9718
|
+
* @returns The updated filled document with the file removed.
|
|
9719
|
+
*/
|
|
9720
|
+
async removeFileFromFilledDocument(appointmentId, formId, isUserForm, fieldId) {
|
|
9721
|
+
var _a;
|
|
9722
|
+
console.log(
|
|
9723
|
+
`[FilledDocumentService] Removing file from field ${fieldId} in form ${formId}`
|
|
9724
|
+
);
|
|
9725
|
+
const existingDoc = await this.getFilledDocumentFromAppointmentById(
|
|
9726
|
+
appointmentId,
|
|
9727
|
+
formId,
|
|
9728
|
+
isUserForm
|
|
9729
|
+
);
|
|
9730
|
+
if (!existingDoc) {
|
|
9731
|
+
throw new Error(
|
|
9732
|
+
`Filled document with ID ${formId} not found in appointment ${appointmentId}`
|
|
9733
|
+
);
|
|
9734
|
+
}
|
|
9735
|
+
const fileValue = (_a = existingDoc.values) == null ? void 0 : _a[fieldId];
|
|
9736
|
+
if (fileValue && fileValue.mediaId) {
|
|
9737
|
+
try {
|
|
9738
|
+
await this.mediaService.deleteMedia(fileValue.mediaId);
|
|
9739
|
+
} catch (error) {
|
|
9740
|
+
console.error(
|
|
9741
|
+
`[FilledDocumentService] Error deleting media ${fileValue.mediaId}:`,
|
|
9742
|
+
error
|
|
9743
|
+
);
|
|
9744
|
+
}
|
|
9745
|
+
}
|
|
9746
|
+
const values = {
|
|
9747
|
+
[fieldId]: null
|
|
9748
|
+
};
|
|
9749
|
+
return this.updateFilledDocumentInAppointment(
|
|
9750
|
+
appointmentId,
|
|
9751
|
+
formId,
|
|
9752
|
+
isUserForm,
|
|
9753
|
+
values
|
|
9754
|
+
);
|
|
9755
|
+
}
|
|
9756
|
+
/**
|
|
9757
|
+
* Get the download URL for a file in a filled document.
|
|
9758
|
+
* @param appointmentId - ID of the appointment.
|
|
9759
|
+
* @param formId - ID of the filled document.
|
|
9760
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9761
|
+
* @param fieldId - The ID of the field containing the file.
|
|
9762
|
+
* @returns The download URL for the file, or null if not found.
|
|
9763
|
+
*/
|
|
9764
|
+
async getFileUrlFromFilledDocument(appointmentId, formId, isUserForm, fieldId) {
|
|
9765
|
+
var _a;
|
|
9766
|
+
console.log(
|
|
9767
|
+
`[FilledDocumentService] Getting file URL for field ${fieldId} in form ${formId}`
|
|
9768
|
+
);
|
|
9769
|
+
const doc34 = await this.getFilledDocumentFromAppointmentById(
|
|
9770
|
+
appointmentId,
|
|
9771
|
+
formId,
|
|
9772
|
+
isUserForm
|
|
9773
|
+
);
|
|
9774
|
+
if (!doc34) {
|
|
9775
|
+
return null;
|
|
9776
|
+
}
|
|
9777
|
+
const fileValue = (_a = doc34.values) == null ? void 0 : _a[fieldId];
|
|
9778
|
+
if (fileValue && fileValue.url) {
|
|
9779
|
+
return fileValue.url;
|
|
9780
|
+
}
|
|
9781
|
+
return null;
|
|
9782
|
+
}
|
|
9628
9783
|
};
|
|
9629
9784
|
|
|
9630
9785
|
// src/services/calendar/calendar-refactored.service.ts
|
package/dist/index.mjs
CHANGED
|
@@ -9376,6 +9376,7 @@ var FilledDocumentService = class extends BaseService {
|
|
|
9376
9376
|
constructor(...args) {
|
|
9377
9377
|
super(...args);
|
|
9378
9378
|
this.templateService = new DocumentationTemplateService(...args);
|
|
9379
|
+
this.mediaService = new MediaService(...args);
|
|
9379
9380
|
}
|
|
9380
9381
|
getFormSubcollectionPath(isUserForm) {
|
|
9381
9382
|
return isUserForm ? USER_FORMS_SUBCOLLECTION : DOCTOR_FORMS_SUBCOLLECTION;
|
|
@@ -9638,6 +9639,160 @@ var FilledDocumentService = class extends BaseService {
|
|
|
9638
9639
|
);
|
|
9639
9640
|
return { documents: [], lastDoc: null };
|
|
9640
9641
|
}
|
|
9642
|
+
/**
|
|
9643
|
+
* Upload a file and associate it with a filled document field.
|
|
9644
|
+
* @param appointmentId - ID of the appointment.
|
|
9645
|
+
* @param formId - ID of the filled document.
|
|
9646
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9647
|
+
* @param file - The file to upload.
|
|
9648
|
+
* @param fieldId - The ID of the field in the document to associate with this file.
|
|
9649
|
+
* @param accessLevel - Access level for the file, defaults to PRIVATE.
|
|
9650
|
+
* @returns The updated filled document with file information.
|
|
9651
|
+
*/
|
|
9652
|
+
async uploadFileForFilledDocument(appointmentId, formId, isUserForm, file, fieldId, accessLevel = "private" /* PRIVATE */) {
|
|
9653
|
+
console.log(
|
|
9654
|
+
`[FilledDocumentService] Uploading file for field ${fieldId} in form ${formId}`
|
|
9655
|
+
);
|
|
9656
|
+
const existingDoc = await this.getFilledDocumentFromAppointmentById(
|
|
9657
|
+
appointmentId,
|
|
9658
|
+
formId,
|
|
9659
|
+
isUserForm
|
|
9660
|
+
);
|
|
9661
|
+
if (!existingDoc) {
|
|
9662
|
+
throw new Error(
|
|
9663
|
+
`Filled document with ID ${formId} not found in appointment ${appointmentId}`
|
|
9664
|
+
);
|
|
9665
|
+
}
|
|
9666
|
+
const ownerId = existingDoc.patientId;
|
|
9667
|
+
const collectionName = isUserForm ? "patient_forms_files" : "doctor_forms_files";
|
|
9668
|
+
const mediaMetadata = await this.mediaService.uploadMedia(
|
|
9669
|
+
file,
|
|
9670
|
+
ownerId,
|
|
9671
|
+
accessLevel,
|
|
9672
|
+
collectionName,
|
|
9673
|
+
file instanceof File ? file.name : `${fieldId}_file`
|
|
9674
|
+
);
|
|
9675
|
+
const fileValue = {
|
|
9676
|
+
mediaId: mediaMetadata.id,
|
|
9677
|
+
url: mediaMetadata.url,
|
|
9678
|
+
name: mediaMetadata.name,
|
|
9679
|
+
contentType: mediaMetadata.contentType,
|
|
9680
|
+
size: mediaMetadata.size,
|
|
9681
|
+
uploadedAt: Date.now()
|
|
9682
|
+
};
|
|
9683
|
+
const values = {
|
|
9684
|
+
[fieldId]: fileValue
|
|
9685
|
+
};
|
|
9686
|
+
return this.updateFilledDocumentInAppointment(
|
|
9687
|
+
appointmentId,
|
|
9688
|
+
formId,
|
|
9689
|
+
isUserForm,
|
|
9690
|
+
values
|
|
9691
|
+
);
|
|
9692
|
+
}
|
|
9693
|
+
/**
|
|
9694
|
+
* Upload a signature image for a filled document field.
|
|
9695
|
+
* This is a specialized version of uploadFileForFilledDocument specifically for signatures.
|
|
9696
|
+
* @param appointmentId - ID of the appointment.
|
|
9697
|
+
* @param formId - ID of the filled document.
|
|
9698
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9699
|
+
* @param signatureBlob - The signature image as a Blob.
|
|
9700
|
+
* @param fieldId - The ID of the signature field in the document.
|
|
9701
|
+
* @returns The updated filled document with signature information.
|
|
9702
|
+
*/
|
|
9703
|
+
async uploadSignatureForFilledDocument(appointmentId, formId, isUserForm, signatureBlob, fieldId) {
|
|
9704
|
+
console.log(
|
|
9705
|
+
`[FilledDocumentService] Uploading signature for field ${fieldId} in form ${formId}`
|
|
9706
|
+
);
|
|
9707
|
+
const signatureFile = new File(
|
|
9708
|
+
[signatureBlob],
|
|
9709
|
+
`signature_${fieldId}.png`,
|
|
9710
|
+
{
|
|
9711
|
+
type: "image/png"
|
|
9712
|
+
}
|
|
9713
|
+
);
|
|
9714
|
+
return this.uploadFileForFilledDocument(
|
|
9715
|
+
appointmentId,
|
|
9716
|
+
formId,
|
|
9717
|
+
isUserForm,
|
|
9718
|
+
signatureFile,
|
|
9719
|
+
fieldId,
|
|
9720
|
+
"confidential" /* CONFIDENTIAL */
|
|
9721
|
+
// Signatures should be confidential
|
|
9722
|
+
);
|
|
9723
|
+
}
|
|
9724
|
+
/**
|
|
9725
|
+
* Remove a file from a filled document field.
|
|
9726
|
+
* This will both update the document and delete the media file.
|
|
9727
|
+
* @param appointmentId - ID of the appointment.
|
|
9728
|
+
* @param formId - ID of the filled document.
|
|
9729
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9730
|
+
* @param fieldId - The ID of the field containing the file.
|
|
9731
|
+
* @returns The updated filled document with the file removed.
|
|
9732
|
+
*/
|
|
9733
|
+
async removeFileFromFilledDocument(appointmentId, formId, isUserForm, fieldId) {
|
|
9734
|
+
var _a;
|
|
9735
|
+
console.log(
|
|
9736
|
+
`[FilledDocumentService] Removing file from field ${fieldId} in form ${formId}`
|
|
9737
|
+
);
|
|
9738
|
+
const existingDoc = await this.getFilledDocumentFromAppointmentById(
|
|
9739
|
+
appointmentId,
|
|
9740
|
+
formId,
|
|
9741
|
+
isUserForm
|
|
9742
|
+
);
|
|
9743
|
+
if (!existingDoc) {
|
|
9744
|
+
throw new Error(
|
|
9745
|
+
`Filled document with ID ${formId} not found in appointment ${appointmentId}`
|
|
9746
|
+
);
|
|
9747
|
+
}
|
|
9748
|
+
const fileValue = (_a = existingDoc.values) == null ? void 0 : _a[fieldId];
|
|
9749
|
+
if (fileValue && fileValue.mediaId) {
|
|
9750
|
+
try {
|
|
9751
|
+
await this.mediaService.deleteMedia(fileValue.mediaId);
|
|
9752
|
+
} catch (error) {
|
|
9753
|
+
console.error(
|
|
9754
|
+
`[FilledDocumentService] Error deleting media ${fileValue.mediaId}:`,
|
|
9755
|
+
error
|
|
9756
|
+
);
|
|
9757
|
+
}
|
|
9758
|
+
}
|
|
9759
|
+
const values = {
|
|
9760
|
+
[fieldId]: null
|
|
9761
|
+
};
|
|
9762
|
+
return this.updateFilledDocumentInAppointment(
|
|
9763
|
+
appointmentId,
|
|
9764
|
+
formId,
|
|
9765
|
+
isUserForm,
|
|
9766
|
+
values
|
|
9767
|
+
);
|
|
9768
|
+
}
|
|
9769
|
+
/**
|
|
9770
|
+
* Get the download URL for a file in a filled document.
|
|
9771
|
+
* @param appointmentId - ID of the appointment.
|
|
9772
|
+
* @param formId - ID of the filled document.
|
|
9773
|
+
* @param isUserForm - Boolean indicating if it's a user form or doctor form.
|
|
9774
|
+
* @param fieldId - The ID of the field containing the file.
|
|
9775
|
+
* @returns The download URL for the file, or null if not found.
|
|
9776
|
+
*/
|
|
9777
|
+
async getFileUrlFromFilledDocument(appointmentId, formId, isUserForm, fieldId) {
|
|
9778
|
+
var _a;
|
|
9779
|
+
console.log(
|
|
9780
|
+
`[FilledDocumentService] Getting file URL for field ${fieldId} in form ${formId}`
|
|
9781
|
+
);
|
|
9782
|
+
const doc34 = await this.getFilledDocumentFromAppointmentById(
|
|
9783
|
+
appointmentId,
|
|
9784
|
+
formId,
|
|
9785
|
+
isUserForm
|
|
9786
|
+
);
|
|
9787
|
+
if (!doc34) {
|
|
9788
|
+
return null;
|
|
9789
|
+
}
|
|
9790
|
+
const fileValue = (_a = doc34.values) == null ? void 0 : _a[fieldId];
|
|
9791
|
+
if (fileValue && fileValue.url) {
|
|
9792
|
+
return fileValue.url;
|
|
9793
|
+
}
|
|
9794
|
+
return null;
|
|
9795
|
+
}
|
|
9641
9796
|
};
|
|
9642
9797
|
|
|
9643
9798
|
// src/services/calendar/calendar-refactored.service.ts
|
package/package.json
CHANGED
|
@@ -470,9 +470,7 @@ export class BookingAdmin {
|
|
|
470
470
|
success: boolean;
|
|
471
471
|
appointmentId?: string;
|
|
472
472
|
appointmentData?: Appointment;
|
|
473
|
-
|
|
474
|
-
patientCalendarEventId?: string;
|
|
475
|
-
clinicCalendarEventId?: string;
|
|
473
|
+
calendarEventId?: string;
|
|
476
474
|
error?: string;
|
|
477
475
|
}> {
|
|
478
476
|
console.log(
|
|
@@ -729,13 +727,9 @@ export class BookingAdmin {
|
|
|
729
727
|
);
|
|
730
728
|
|
|
731
729
|
// Patient Calendar Event
|
|
732
|
-
|
|
733
|
-
.collection(PATIENTS_COLLECTION)
|
|
734
|
-
.doc(patientProfileData.id)
|
|
735
|
-
.collection(CALENDAR_COLLECTION)
|
|
736
|
-
.doc().id;
|
|
730
|
+
// Use same ID as practitionerCalendarEventId
|
|
737
731
|
const patientCalendarEventData: CalendarEvent = {
|
|
738
|
-
id:
|
|
732
|
+
id: practitionerCalendarEventId,
|
|
739
733
|
appointmentId: newAppointmentId,
|
|
740
734
|
clinicBranchId: clinicData.id,
|
|
741
735
|
clinicBranchInfo: clinicInfo,
|
|
@@ -758,18 +752,14 @@ export class BookingAdmin {
|
|
|
758
752
|
.collection(PATIENTS_COLLECTION)
|
|
759
753
|
.doc(patientProfileData.id)
|
|
760
754
|
.collection(CALENDAR_COLLECTION)
|
|
761
|
-
.doc(
|
|
755
|
+
.doc(practitionerCalendarEventId),
|
|
762
756
|
patientCalendarEventData
|
|
763
757
|
);
|
|
764
758
|
|
|
765
759
|
// Clinic Calendar Event
|
|
766
|
-
|
|
767
|
-
.collection(CLINICS_COLLECTION)
|
|
768
|
-
.doc(clinicData.id)
|
|
769
|
-
.collection(CALENDAR_COLLECTION)
|
|
770
|
-
.doc().id;
|
|
760
|
+
// Use same ID as practitionerCalendarEventId
|
|
771
761
|
const clinicCalendarEventData: CalendarEvent = {
|
|
772
|
-
id:
|
|
762
|
+
id: practitionerCalendarEventId,
|
|
773
763
|
appointmentId: newAppointmentId,
|
|
774
764
|
clinicBranchId: clinicData.id,
|
|
775
765
|
clinicBranchInfo: clinicInfo,
|
|
@@ -794,7 +784,7 @@ export class BookingAdmin {
|
|
|
794
784
|
.collection(CLINICS_COLLECTION)
|
|
795
785
|
.doc(clinicData.id)
|
|
796
786
|
.collection(CALENDAR_COLLECTION)
|
|
797
|
-
.doc(
|
|
787
|
+
.doc(practitionerCalendarEventId),
|
|
798
788
|
clinicCalendarEventData
|
|
799
789
|
);
|
|
800
790
|
|
|
@@ -901,9 +891,7 @@ export class BookingAdmin {
|
|
|
901
891
|
success: true,
|
|
902
892
|
appointmentId: newAppointmentId,
|
|
903
893
|
appointmentData: newAppointmentData,
|
|
904
|
-
practitionerCalendarEventId,
|
|
905
|
-
patientCalendarEventId,
|
|
906
|
-
clinicCalendarEventId,
|
|
894
|
+
calendarEventId: practitionerCalendarEventId,
|
|
907
895
|
};
|
|
908
896
|
} catch (error) {
|
|
909
897
|
console.error(
|