@blackcode_sa/metaestetics-api 1.11.1 → 1.11.3

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.
Files changed (36) hide show
  1. package/dist/admin/index.d.mts +326 -330
  2. package/dist/admin/index.d.ts +326 -330
  3. package/dist/backoffice/index.d.mts +67 -283
  4. package/dist/backoffice/index.d.ts +67 -283
  5. package/dist/backoffice/index.js +6 -114
  6. package/dist/backoffice/index.mjs +6 -112
  7. package/dist/index.d.mts +3039 -3100
  8. package/dist/index.d.ts +3039 -3100
  9. package/dist/index.js +131 -380
  10. package/dist/index.mjs +132 -380
  11. package/package.json +1 -1
  12. package/src/backoffice/expo-safe/index.ts +0 -2
  13. package/src/backoffice/services/__tests__/brand.service.test.ts +196 -0
  14. package/src/backoffice/services/__tests__/category.service.test.ts +201 -0
  15. package/src/backoffice/services/__tests__/product.service.test.ts +358 -0
  16. package/src/backoffice/services/__tests__/requirement.service.test.ts +226 -0
  17. package/src/backoffice/services/__tests__/subcategory.service.test.ts +181 -0
  18. package/src/backoffice/services/__tests__/technology.service.test.ts +1097 -0
  19. package/src/backoffice/services/technology.service.ts +10 -122
  20. package/src/backoffice/types/index.ts +0 -1
  21. package/src/backoffice/types/product.types.ts +1 -3
  22. package/src/backoffice/types/technology.types.ts +4 -4
  23. package/src/backoffice/validations/schemas.ts +9 -35
  24. package/src/services/appointment/appointment.service.ts +5 -0
  25. package/src/services/appointment/utils/appointment.utils.ts +113 -124
  26. package/src/services/procedure/procedure.service.ts +234 -434
  27. package/src/types/appointment/index.ts +39 -43
  28. package/src/types/clinic/index.ts +6 -1
  29. package/src/types/patient/medical-info.types.ts +3 -3
  30. package/src/types/procedure/index.ts +17 -20
  31. package/src/validations/appointment.schema.ts +119 -170
  32. package/src/validations/clinic.schema.ts +6 -1
  33. package/src/validations/patient/medical-info.schema.ts +2 -7
  34. package/src/backoffice/services/README.md +0 -40
  35. package/src/backoffice/services/constants.service.ts +0 -268
  36. package/src/backoffice/types/admin-constants.types.ts +0 -69
@@ -1,58 +1,49 @@
1
- import { Timestamp, FieldValue } from "firebase/firestore";
2
- import {
3
- ClinicInfo,
4
- PractitionerProfileInfo,
5
- PatientProfileInfo,
6
- } from "../profile";
7
- import { ProcedureSummaryInfo } from "../procedure";
8
- import {
9
- Currency,
10
- type PricingMeasure,
11
- } from "../../backoffice/types/static/pricing.types";
12
- import { BlockingCondition } from "../../backoffice/types/static/blocking-condition.types";
13
- import { Requirement } from "../../backoffice/types/requirement.types";
14
- import { FilledDocumentStatus } from "../documentation-templates";
15
- import type {
16
- ContraindicationDynamic,
17
- ProcedureFamily,
18
- } from "../../backoffice";
19
- import type { MediaResource } from "../../services/media/media.service";
1
+ import { Timestamp, FieldValue } from 'firebase/firestore';
2
+ import { ClinicInfo, PractitionerProfileInfo, PatientProfileInfo } from '../profile';
3
+ import { ProcedureSummaryInfo } from '../procedure';
4
+ import { Currency, type PricingMeasure } from '../../backoffice/types/static/pricing.types';
5
+ import { BlockingCondition } from '../../backoffice/types/static/blocking-condition.types';
6
+ import { Contraindication } from '../../backoffice/types/static/contraindication.types';
7
+ import { Requirement } from '../../backoffice/types/requirement.types';
8
+ import { FilledDocumentStatus } from '../documentation-templates';
9
+ import type { ProcedureFamily } from '../../backoffice';
10
+ import type { MediaResource } from '../../services/media/media.service';
20
11
 
21
12
  /**
22
13
  * Enum defining the possible statuses of an appointment.
23
14
  */
24
15
  export enum AppointmentStatus {
25
- PENDING = "pending", // Initial state after booking, before confirmation (if applicable)
26
- CONFIRMED = "confirmed", // Confirmed by clinic/practitioner
27
- CHECKED_IN = "checked_in", // Patient has arrived
28
- IN_PROGRESS = "in_progress", // Procedure has started
29
- COMPLETED = "completed", // Procedure finished successfully
30
- CANCELED_PATIENT = "canceled_patient", // Canceled by the patient
31
- CANCELED_PATIENT_RESCHEDULED = "canceled_patient_rescheduled", // Canceled by the patient and rescheduled by the clinic
32
- CANCELED_CLINIC = "canceled_clinic", // Canceled by the clinic/practitioner
33
- NO_SHOW = "no_show", // Patient did not attend
34
- RESCHEDULED_BY_CLINIC = "rescheduled_by_clinic", // When appointment is rescheduled by the clinic, waiting for patient confirmation or cancellation (when reschedule is accepted, status goes to confirmed, if not accepted, then status goes to canceled_patient_rescheduled)
16
+ PENDING = 'pending', // Initial state after booking, before confirmation (if applicable)
17
+ CONFIRMED = 'confirmed', // Confirmed by clinic/practitioner
18
+ CHECKED_IN = 'checked_in', // Patient has arrived
19
+ IN_PROGRESS = 'in_progress', // Procedure has started
20
+ COMPLETED = 'completed', // Procedure finished successfully
21
+ CANCELED_PATIENT = 'canceled_patient', // Canceled by the patient
22
+ CANCELED_PATIENT_RESCHEDULED = 'canceled_patient_rescheduled', // Canceled by the patient and rescheduled by the clinic
23
+ CANCELED_CLINIC = 'canceled_clinic', // Canceled by the clinic/practitioner
24
+ NO_SHOW = 'no_show', // Patient did not attend
25
+ RESCHEDULED_BY_CLINIC = 'rescheduled_by_clinic', // When appointment is rescheduled by the clinic, waiting for patient confirmation or cancellation (when reschedule is accepted, status goes to confirmed, if not accepted, then status goes to canceled_patient_rescheduled)
35
26
  }
36
27
 
37
28
  /**
38
29
  * Enum defining the payment status of an appointment.
39
30
  */
40
31
  export enum PaymentStatus {
41
- UNPAID = "unpaid",
42
- PAID = "paid",
43
- PARTIALLY_PAID = "partially_paid",
44
- REFUNDED = "refunded",
45
- NOT_APPLICABLE = "not_applicable", // For free services or other scenarios
32
+ UNPAID = 'unpaid',
33
+ PAID = 'paid',
34
+ PARTIALLY_PAID = 'partially_paid',
35
+ REFUNDED = 'refunded',
36
+ NOT_APPLICABLE = 'not_applicable', // For free services or other scenarios
46
37
  }
47
38
 
48
39
  /**
49
40
  * Enum for different types of media that can be attached to an appointment.
50
41
  */
51
42
  export enum MediaType {
52
- BEFORE_PHOTO = "before_photo",
53
- AFTER_PHOTO = "after_photo",
54
- CONSENT_SCAN = "consent_scan",
55
- OTHER_DOCUMENT = "other_document",
43
+ BEFORE_PHOTO = 'before_photo',
44
+ AFTER_PHOTO = 'after_photo',
45
+ CONSENT_SCAN = 'consent_scan',
46
+ OTHER_DOCUMENT = 'other_document',
56
47
  }
57
48
 
58
49
  /**
@@ -126,7 +117,8 @@ export interface BeforeAfterPerZone {
126
117
  /** URL for after photo or null if not available */
127
118
  after: MediaResource | null;
128
119
  /** Optional note for the zone */
129
- note: string | null;
120
+ afterNote?: string | null;
121
+ beforeNote?: string | null;
130
122
  }
131
123
 
132
124
  /**
@@ -149,6 +141,8 @@ export interface BillingPerZone {
149
141
  Subtotal: number;
150
142
  /** Optional billing note */
151
143
  Note: string | null;
144
+ /** Ion/Batch number for traceability */
145
+ IonNumber: string | null;
152
146
  }
153
147
 
154
148
  /**
@@ -183,6 +177,8 @@ export interface AppointmentMetadata {
183
177
  zoneBilling: Record<string, BillingPerZone> | null;
184
178
  /** Final billing calculations for the appointment */
185
179
  finalbilling: FinalBilling | null;
180
+ /** Final note for the appointment */
181
+ finalizationNotes: string | null;
186
182
  }
187
183
 
188
184
  /**
@@ -233,7 +229,7 @@ export interface Appointment {
233
229
 
234
230
  /** Cancellation Details */
235
231
  cancellationReason?: string | null;
236
- canceledBy?: "patient" | "clinic" | "practitioner" | "system";
232
+ canceledBy?: 'patient' | 'clinic' | 'practitioner' | 'system';
237
233
 
238
234
  /** Notes */
239
235
  internalNotes?: string | null;
@@ -247,7 +243,7 @@ export interface Appointment {
247
243
 
248
244
  /** Procedure-related conditions and requirements */
249
245
  blockingConditions: BlockingCondition[];
250
- contraindications: ContraindicationDynamic[];
246
+ contraindications: Contraindication[];
251
247
  preProcedureRequirements: Requirement[];
252
248
  postProcedureRequirements: Requirement[];
253
249
 
@@ -328,7 +324,7 @@ export interface UpdateAppointmentData {
328
324
  procedureActualStartTime?: Timestamp | FieldValue | null; // NEW
329
325
  actualDurationMinutes?: number;
330
326
  cancellationReason?: string | null;
331
- canceledBy?: "patient" | "clinic" | "practitioner" | "system";
327
+ canceledBy?: 'patient' | 'clinic' | 'practitioner' | 'system';
332
328
  internalNotes?: string | null;
333
329
  patientNotes?: string | FieldValue | null; // Allow FieldValue for deleting
334
330
  paymentStatus?: PaymentStatus;
@@ -380,4 +376,4 @@ export interface SearchAppointmentsParams {
380
376
  }
381
377
 
382
378
  /** Firestore collection name */
383
- export const APPOINTMENTS_COLLECTION = "appointments";
379
+ export const APPOINTMENTS_COLLECTION = 'appointments';
@@ -1,5 +1,10 @@
1
1
  import { Timestamp, FieldValue } from "firebase/firestore";
2
-
2
+ import type { ProcedureFamily } from "../../backoffice/types/static/procedure-family.types";
3
+ import type { TreatmentBenefit } from "../../backoffice/types/static/treatment-benefit.types";
4
+ import type {
5
+ Currency,
6
+ PricingMeasure,
7
+ } from "../../backoffice/types/static/pricing.types";
3
8
  import type { ClinicInfo } from "../profile";
4
9
  import { ClinicReviewInfo } from "../reviews";
5
10
  import { ProcedureSummaryInfo } from "../procedure";
@@ -1,7 +1,7 @@
1
1
  import { Timestamp } from "firebase/firestore";
2
2
  import { BlockingCondition } from "../../backoffice/types/static/blocking-condition.types";
3
+ import { Contraindication } from "../../backoffice/types/static/contraindication.types";
3
4
  import { AllergyType, AllergySubtype } from "./allergies";
4
- import type { ContraindicationDynamic } from "../../backoffice";
5
5
 
6
6
  export const PATIENT_MEDICAL_INFO_COLLECTION = "medical_info";
7
7
 
@@ -38,7 +38,7 @@ export interface PatientMedicalInfo {
38
38
  }[];
39
39
 
40
40
  contraindications: {
41
- condition: ContraindicationDynamic;
41
+ condition: Contraindication;
42
42
  lastOccurrence: Timestamp;
43
43
  frequency: "rare" | "occasional" | "frequent";
44
44
  isActive: boolean;
@@ -113,7 +113,7 @@ export interface UpdateBlockingConditionData
113
113
 
114
114
  // Interfejsi za kontraindikacije
115
115
  export interface AddContraindicationData {
116
- condition: ContraindicationDynamic;
116
+ condition: Contraindication;
117
117
  lastOccurrence: Timestamp;
118
118
  frequency: "rare" | "occasional" | "frequent";
119
119
  isActive: boolean;
@@ -1,24 +1,25 @@
1
- import {
2
- BlockingCondition,
3
- CertificationRequirement,
4
- ProcedureFamily,
5
- } from "../../backoffice/types";
6
- import {
7
- ContraindicationDynamic,
8
- TreatmentBenefitDynamic,
9
- } from "../../backoffice/types/admin-constants.types";
10
- import { Requirement } from "../../backoffice/types/requirement.types";
1
+ import { ProcedureFamily } from "../../backoffice/types/static/procedure-family.types";
11
2
  import { Category } from "../../backoffice/types/category.types";
12
3
  import { Subcategory } from "../../backoffice/types/subcategory.types";
13
- import { Technology } from "../../backoffice/types/technology.types";
4
+ import {
5
+ Technology,
6
+ type TechnologyDocumentationTemplate,
7
+ } from "../../backoffice/types/technology.types";
14
8
  import { Product } from "../../backoffice/types/product.types";
15
- import { ClinicInfo, DoctorInfo } from "../../types/";
16
- import { ProcedureReviewInfo } from "../reviews";
17
- import { TechnologyDocumentationTemplate } from "../../backoffice/types/technology.types";
18
9
  import {
19
10
  PricingMeasure,
20
11
  Currency,
21
12
  } from "../../backoffice/types/static/pricing.types";
13
+ import { Requirement } from "../../backoffice/types/requirement.types";
14
+ import { BlockingCondition } from "../../backoffice/types/static/blocking-condition.types";
15
+ import { TreatmentBenefit } from "../../backoffice/types/static/treatment-benefit.types";
16
+ import { CertificationRequirement } from "../../backoffice/types/static/certification.types";
17
+ import { DocumentTemplate } from "../documentation-templates";
18
+ import { ClinicInfo } from "../profile";
19
+ import { DoctorInfo } from "../clinic";
20
+ import { PRACTITIONERS_COLLECTION } from "../practitioner";
21
+ import { ProcedureReviewInfo } from "../reviews";
22
+ import type { Contraindication } from "../../backoffice/types/static/contraindication.types";
22
23
  import { MediaResource } from "../../services/media/media.service";
23
24
 
24
25
  /**
@@ -57,13 +58,9 @@ export interface Procedure {
57
58
  /** Blocking conditions that prevent this procedure */
58
59
  blockingConditions: BlockingCondition[];
59
60
  /** Treatment benefits of this procedure */
60
- treatmentBenefits: TreatmentBenefitDynamic[];
61
- /** A list of just the string IDs of the treatment benefits, for efficient querying. */
62
- treatmentBenefitIds: string[];
61
+ treatmentBenefits: TreatmentBenefit[];
63
62
  /** Contraindications of this procedure */
64
- contraindications: ContraindicationDynamic[];
65
- /** A list of just the string IDs of the contraindications, for efficient querying. */
66
- contraindicationIds: string[];
63
+ contraindications: Contraindication[];
67
64
  /** Pre-procedure requirements */
68
65
  preRequirements: Requirement[];
69
66
  /** Post-procedure requirements */