@blackcode_sa/metaestetics-api 1.5.3 → 1.5.4
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/backoffice/index.d.mts +1306 -63
- package/dist/backoffice/index.d.ts +1306 -63
- package/dist/backoffice/index.js +35 -26
- package/dist/backoffice/index.mjs +35 -26
- package/dist/index.d.mts +17 -3
- package/dist/index.d.ts +17 -3
- package/dist/index.js +77 -0
- package/dist/index.mjs +77 -0
- package/package.json +1 -1
- package/src/backoffice/services/brand.service.ts +2 -4
- package/src/backoffice/services/category.service.ts +2 -7
- package/src/backoffice/services/product.service.ts +5 -7
- package/src/backoffice/services/requirement.service.ts +6 -7
- package/src/backoffice/services/subcategory.service.ts +11 -8
- package/src/backoffice/services/technology.service.ts +6 -11
- package/src/backoffice/types/brand.types.ts +5 -0
- package/src/backoffice/types/category.types.ts +5 -0
- package/src/backoffice/types/documentation-templates.types.ts +4 -0
- package/src/backoffice/types/product.types.ts +5 -0
- package/src/backoffice/types/requirement.types.ts +5 -0
- package/src/backoffice/types/subcategory.types.ts +5 -0
- package/src/backoffice/types/technology.types.ts +10 -0
- package/src/backoffice/validations/schemas.ts +2 -0
- package/src/errors/auth.errors.ts +7 -0
- package/src/services/auth.service.ts +94 -0
- package/src/services/documentation-templates/documentation-template.service.ts +4 -1
- package/src/services/procedure/procedure.service.ts +238 -0
- package/src/types/documentation-templates/index.ts +5 -0
- package/src/types/procedure/index.ts +104 -0
- package/src/validations/procedure.schema.ts +58 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ProcedureFamily } from "../../backoffice/types/static/procedure-family.types";
|
|
2
|
+
import { Category } from "../../backoffice/types/category.types";
|
|
3
|
+
import { Subcategory } from "../../backoffice/types/subcategory.types";
|
|
4
|
+
import { Technology } from "../../backoffice/types/technology.types";
|
|
5
|
+
import { Product } from "../../backoffice/types/product.types";
|
|
6
|
+
import {
|
|
7
|
+
PricingMeasure,
|
|
8
|
+
Currency,
|
|
9
|
+
} from "../../backoffice/types/static/pricing.types";
|
|
10
|
+
import { Requirement } from "../../backoffice/types/requirement.types";
|
|
11
|
+
import { BlockingCondition } from "../../backoffice/types/static/blocking-condition.types";
|
|
12
|
+
import { TreatmentBenefit } from "../../backoffice/types/static/treatment-benefit.types";
|
|
13
|
+
import { CertificationRequirement } from "../../backoffice/types/static/certification.types";
|
|
14
|
+
import { DocumentTemplate } from "../documentation-templates";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Procedure represents a specific medical procedure that can be performed by a practitioner in a clinic
|
|
18
|
+
* It inherits properties from technology and adds clinic/practitioner specific details
|
|
19
|
+
*/
|
|
20
|
+
export interface Procedure {
|
|
21
|
+
/** Unique identifier of the procedure */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Name of the procedure */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Detailed description of the procedure */
|
|
26
|
+
description: string;
|
|
27
|
+
/** Family of procedures this belongs to (aesthetics/surgery) */
|
|
28
|
+
family: ProcedureFamily;
|
|
29
|
+
/** Category this procedure belongs to */
|
|
30
|
+
category: Category;
|
|
31
|
+
/** Subcategory this procedure belongs to */
|
|
32
|
+
subcategory: Subcategory;
|
|
33
|
+
/** Technology used in this procedure */
|
|
34
|
+
technology: Technology;
|
|
35
|
+
/** Product used in this procedure */
|
|
36
|
+
product: Product;
|
|
37
|
+
/** Price of the procedure */
|
|
38
|
+
price: number;
|
|
39
|
+
/** Currency for the price */
|
|
40
|
+
currency: Currency;
|
|
41
|
+
/** How the price is measured (per ml, per zone, etc.) */
|
|
42
|
+
pricingMeasure: PricingMeasure;
|
|
43
|
+
/** Duration of the procedure in minutes */
|
|
44
|
+
duration: number;
|
|
45
|
+
/** Blocking conditions that prevent this procedure */
|
|
46
|
+
blockingConditions: BlockingCondition[];
|
|
47
|
+
/** Treatment benefits of this procedure */
|
|
48
|
+
treatmentBenefits: TreatmentBenefit[];
|
|
49
|
+
/** Pre-procedure requirements */
|
|
50
|
+
preRequirements: Requirement[];
|
|
51
|
+
/** Post-procedure requirements */
|
|
52
|
+
postRequirements: Requirement[];
|
|
53
|
+
/** Certification requirements for performing this procedure */
|
|
54
|
+
certificationRequirement: CertificationRequirement;
|
|
55
|
+
/** Documentation templates required for this procedure */
|
|
56
|
+
documentationTemplates: DocumentTemplate[];
|
|
57
|
+
/** ID of the practitioner who performs this procedure */
|
|
58
|
+
practitionerId: string;
|
|
59
|
+
/** ID of the clinic branch where this procedure is performed */
|
|
60
|
+
clinicBranchId: string;
|
|
61
|
+
/** Whether this procedure is active */
|
|
62
|
+
isActive: boolean;
|
|
63
|
+
/** When this procedure was created */
|
|
64
|
+
createdAt: Date;
|
|
65
|
+
/** When this procedure was last updated */
|
|
66
|
+
updatedAt: Date;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Data required to create a new procedure
|
|
71
|
+
*/
|
|
72
|
+
export interface CreateProcedureData {
|
|
73
|
+
name: string;
|
|
74
|
+
description: string;
|
|
75
|
+
family: ProcedureFamily;
|
|
76
|
+
categoryId: string;
|
|
77
|
+
subcategoryId: string;
|
|
78
|
+
technologyId: string;
|
|
79
|
+
productId: string;
|
|
80
|
+
price: number;
|
|
81
|
+
currency: Currency;
|
|
82
|
+
pricingMeasure: PricingMeasure;
|
|
83
|
+
duration: number;
|
|
84
|
+
practitionerId: string;
|
|
85
|
+
clinicBranchId: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Data that can be updated for an existing procedure
|
|
90
|
+
*/
|
|
91
|
+
export interface UpdateProcedureData {
|
|
92
|
+
name?: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
price?: number;
|
|
95
|
+
currency?: Currency;
|
|
96
|
+
pricingMeasure?: PricingMeasure;
|
|
97
|
+
duration?: number;
|
|
98
|
+
isActive?: boolean;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Collection name for procedures in Firestore
|
|
103
|
+
*/
|
|
104
|
+
export const PROCEDURES_COLLECTION = "procedures";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ProcedureFamily } from "../backoffice/types/static/procedure-family.types";
|
|
3
|
+
import {
|
|
4
|
+
Currency,
|
|
5
|
+
PricingMeasure,
|
|
6
|
+
} from "../backoffice/types/static/pricing.types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Schema for creating a new procedure
|
|
10
|
+
*/
|
|
11
|
+
export const createProcedureSchema = z.object({
|
|
12
|
+
name: z.string().min(1).max(200),
|
|
13
|
+
description: z.string().min(1).max(2000),
|
|
14
|
+
family: z.nativeEnum(ProcedureFamily),
|
|
15
|
+
categoryId: z.string().min(1),
|
|
16
|
+
subcategoryId: z.string().min(1),
|
|
17
|
+
technologyId: z.string().min(1),
|
|
18
|
+
productId: z.string().min(1),
|
|
19
|
+
price: z.number().min(0),
|
|
20
|
+
currency: z.nativeEnum(Currency),
|
|
21
|
+
pricingMeasure: z.nativeEnum(PricingMeasure),
|
|
22
|
+
duration: z.number().min(1).max(480), // Max 8 hours
|
|
23
|
+
practitionerId: z.string().min(1),
|
|
24
|
+
clinicBranchId: z.string().min(1),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Schema for updating an existing procedure
|
|
29
|
+
*/
|
|
30
|
+
export const updateProcedureSchema = z.object({
|
|
31
|
+
name: z.string().min(1).max(200).optional(),
|
|
32
|
+
description: z.string().min(1).max(2000).optional(),
|
|
33
|
+
price: z.number().min(0).optional(),
|
|
34
|
+
currency: z.nativeEnum(Currency).optional(),
|
|
35
|
+
pricingMeasure: z.nativeEnum(PricingMeasure).optional(),
|
|
36
|
+
duration: z.number().min(1).max(480).optional(), // Max 8 hours
|
|
37
|
+
isActive: z.boolean().optional(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Schema for validating a complete procedure object
|
|
42
|
+
*/
|
|
43
|
+
export const procedureSchema = createProcedureSchema.extend({
|
|
44
|
+
id: z.string().min(1),
|
|
45
|
+
category: z.any(), // We'll validate the full category object separately
|
|
46
|
+
subcategory: z.any(), // We'll validate the full subcategory object separately
|
|
47
|
+
technology: z.any(), // We'll validate the full technology object separately
|
|
48
|
+
product: z.any(), // We'll validate the full product object separately
|
|
49
|
+
blockingConditions: z.array(z.any()), // We'll validate blocking conditions separately
|
|
50
|
+
treatmentBenefits: z.array(z.any()), // We'll validate treatment benefits separately
|
|
51
|
+
preRequirements: z.array(z.any()), // We'll validate requirements separately
|
|
52
|
+
postRequirements: z.array(z.any()), // We'll validate requirements separately
|
|
53
|
+
certificationRequirement: z.any(), // We'll validate certification requirement separately
|
|
54
|
+
documentationTemplates: z.array(z.any()), // We'll validate documentation templates separately
|
|
55
|
+
isActive: z.boolean(),
|
|
56
|
+
createdAt: z.date(),
|
|
57
|
+
updatedAt: z.date(),
|
|
58
|
+
});
|