@blackcode_sa/metaestetics-api 1.12.2 → 1.12.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.
- package/dist/backoffice/index.d.mts +64 -14
- package/dist/backoffice/index.d.ts +64 -14
- package/dist/backoffice/index.js +72 -53
- package/dist/backoffice/index.mjs +72 -53
- package/dist/index.d.mts +129 -17
- package/dist/index.d.ts +129 -17
- package/dist/index.js +72 -53
- package/dist/index.mjs +72 -53
- package/package.json +1 -1
- package/src/backoffice/services/FIXES_README.md +102 -0
- package/src/backoffice/services/category.service.ts +46 -27
- package/src/backoffice/services/product.service.ts +52 -74
- package/src/backoffice/services/technology.service.ts +99 -116
- package/src/backoffice/types/category.types.ts +28 -2
- package/src/backoffice/types/product.types.ts +10 -9
- package/src/backoffice/types/technology.types.ts +31 -59
|
@@ -254,6 +254,26 @@ var CategoryService = class extends BaseService {
|
|
|
254
254
|
})
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Vraća sve kategorije za određenu familiju za potrebe filtera (bez paginacije)
|
|
259
|
+
* @param family - Familija procedura (aesthetics/surgery)
|
|
260
|
+
* @returns Lista aktivnih kategorija koje pripadaju traženoj familiji
|
|
261
|
+
*/
|
|
262
|
+
async getAllForFilterByFamily(family) {
|
|
263
|
+
const q = query2(
|
|
264
|
+
this.categoriesRef,
|
|
265
|
+
where2("family", "==", family),
|
|
266
|
+
where2("isActive", "==", true),
|
|
267
|
+
orderBy2("name")
|
|
268
|
+
);
|
|
269
|
+
const snapshot = await getDocs2(q);
|
|
270
|
+
return snapshot.docs.map(
|
|
271
|
+
(doc11) => ({
|
|
272
|
+
id: doc11.id,
|
|
273
|
+
...doc11.data()
|
|
274
|
+
})
|
|
275
|
+
);
|
|
276
|
+
}
|
|
257
277
|
/**
|
|
258
278
|
* Vraća sve kategorije sa paginacijom
|
|
259
279
|
* @param options - Pagination and filter options
|
|
@@ -1155,12 +1175,7 @@ var ProductService = class extends BaseService {
|
|
|
1155
1175
|
* @returns Firestore collection reference
|
|
1156
1176
|
*/
|
|
1157
1177
|
getProductsRef(technologyId) {
|
|
1158
|
-
return collection6(
|
|
1159
|
-
this.db,
|
|
1160
|
-
TECHNOLOGIES_COLLECTION,
|
|
1161
|
-
technologyId,
|
|
1162
|
-
PRODUCTS_COLLECTION
|
|
1163
|
-
);
|
|
1178
|
+
return collection6(this.db, TECHNOLOGIES_COLLECTION, technologyId, PRODUCTS_COLLECTION);
|
|
1164
1179
|
}
|
|
1165
1180
|
/**
|
|
1166
1181
|
* Creates a new product under technology
|
|
@@ -1175,10 +1190,7 @@ var ProductService = class extends BaseService {
|
|
|
1175
1190
|
updatedAt: now,
|
|
1176
1191
|
isActive: true
|
|
1177
1192
|
};
|
|
1178
|
-
const productRef = await addDoc3(
|
|
1179
|
-
this.getProductsRef(technologyId),
|
|
1180
|
-
newProduct
|
|
1181
|
-
);
|
|
1193
|
+
const productRef = await addDoc3(this.getProductsRef(technologyId), newProduct);
|
|
1182
1194
|
return { id: productRef.id, ...newProduct };
|
|
1183
1195
|
}
|
|
1184
1196
|
/**
|
|
@@ -1186,17 +1198,8 @@ var ProductService = class extends BaseService {
|
|
|
1186
1198
|
* This uses a collectionGroup query to search across all technologies.
|
|
1187
1199
|
*/
|
|
1188
1200
|
async getAll(options) {
|
|
1189
|
-
const {
|
|
1190
|
-
|
|
1191
|
-
lastVisible,
|
|
1192
|
-
categoryId,
|
|
1193
|
-
subcategoryId,
|
|
1194
|
-
technologyId
|
|
1195
|
-
} = options;
|
|
1196
|
-
const constraints = [
|
|
1197
|
-
where6("isActive", "==", true),
|
|
1198
|
-
orderBy6("name")
|
|
1199
|
-
];
|
|
1201
|
+
const { rowsPerPage, lastVisible, categoryId, subcategoryId, technologyId } = options;
|
|
1202
|
+
const constraints = [where6("isActive", "==", true), orderBy6("name")];
|
|
1200
1203
|
if (categoryId) {
|
|
1201
1204
|
constraints.push(where6("categoryId", "==", categoryId));
|
|
1202
1205
|
}
|
|
@@ -1210,10 +1213,7 @@ var ProductService = class extends BaseService {
|
|
|
1210
1213
|
constraints.push(startAfter5(lastVisible));
|
|
1211
1214
|
}
|
|
1212
1215
|
constraints.push(limit6(rowsPerPage));
|
|
1213
|
-
const q = query6(
|
|
1214
|
-
collectionGroup(this.db, PRODUCTS_COLLECTION),
|
|
1215
|
-
...constraints
|
|
1216
|
-
);
|
|
1216
|
+
const q = query6(collectionGroup(this.db, PRODUCTS_COLLECTION), ...constraints);
|
|
1217
1217
|
const snapshot = await getDocs6(q);
|
|
1218
1218
|
const products = snapshot.docs.map(
|
|
1219
1219
|
(doc11) => ({
|
|
@@ -1239,10 +1239,7 @@ var ProductService = class extends BaseService {
|
|
|
1239
1239
|
if (technologyId) {
|
|
1240
1240
|
constraints.push(where6("technologyId", "==", technologyId));
|
|
1241
1241
|
}
|
|
1242
|
-
const q = query6(
|
|
1243
|
-
collectionGroup(this.db, PRODUCTS_COLLECTION),
|
|
1244
|
-
...constraints
|
|
1245
|
-
);
|
|
1242
|
+
const q = query6(collectionGroup(this.db, PRODUCTS_COLLECTION), ...constraints);
|
|
1246
1243
|
const snapshot = await getCountFromServer4(q);
|
|
1247
1244
|
return snapshot.data().count;
|
|
1248
1245
|
}
|
|
@@ -1251,10 +1248,7 @@ var ProductService = class extends BaseService {
|
|
|
1251
1248
|
* This uses a single collectionGroup query for efficiency.
|
|
1252
1249
|
*/
|
|
1253
1250
|
async getProductCounts() {
|
|
1254
|
-
const q = query6(
|
|
1255
|
-
collectionGroup(this.db, PRODUCTS_COLLECTION),
|
|
1256
|
-
where6("isActive", "==", true)
|
|
1257
|
-
);
|
|
1251
|
+
const q = query6(collectionGroup(this.db, PRODUCTS_COLLECTION), where6("isActive", "==", true));
|
|
1258
1252
|
const snapshot = await getDocs6(q);
|
|
1259
1253
|
const counts = {
|
|
1260
1254
|
byCategory: {},
|
|
@@ -1279,6 +1273,23 @@ var ProductService = class extends BaseService {
|
|
|
1279
1273
|
});
|
|
1280
1274
|
return counts;
|
|
1281
1275
|
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Gets all products for a specific technology (non-paginated, for filters/dropdowns)
|
|
1278
|
+
*/
|
|
1279
|
+
async getAllByTechnology(technologyId) {
|
|
1280
|
+
const q = query6(
|
|
1281
|
+
this.getProductsRef(technologyId),
|
|
1282
|
+
where6("isActive", "==", true),
|
|
1283
|
+
orderBy6("name")
|
|
1284
|
+
);
|
|
1285
|
+
const snapshot = await getDocs6(q);
|
|
1286
|
+
return snapshot.docs.map(
|
|
1287
|
+
(doc11) => ({
|
|
1288
|
+
id: doc11.id,
|
|
1289
|
+
...doc11.data()
|
|
1290
|
+
})
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1282
1293
|
/**
|
|
1283
1294
|
* Gets all products for a brand by filtering through all technologies
|
|
1284
1295
|
*/
|
|
@@ -2064,7 +2075,9 @@ var TechnologyService = class extends BaseService {
|
|
|
2064
2075
|
if (!technology) {
|
|
2065
2076
|
throw new Error(`Technology with id ${technologyId} not found`);
|
|
2066
2077
|
}
|
|
2067
|
-
const updatedContraindications = (technology.contraindications || []).filter(
|
|
2078
|
+
const updatedContraindications = (technology.contraindications || []).filter(
|
|
2079
|
+
(c) => c.id !== contraindication.id
|
|
2080
|
+
);
|
|
2068
2081
|
await updateDoc9(docRef, {
|
|
2069
2082
|
contraindications: updatedContraindications,
|
|
2070
2083
|
updatedAt: /* @__PURE__ */ new Date()
|
|
@@ -2085,9 +2098,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2085
2098
|
throw new Error(`Technology with id ${technologyId} not found`);
|
|
2086
2099
|
}
|
|
2087
2100
|
const contraindications = technology.contraindications || [];
|
|
2088
|
-
const index = contraindications.findIndex(
|
|
2089
|
-
(c) => c.id === contraindication.id
|
|
2090
|
-
);
|
|
2101
|
+
const index = contraindications.findIndex((c) => c.id === contraindication.id);
|
|
2091
2102
|
if (index === -1) {
|
|
2092
2103
|
console.warn(
|
|
2093
2104
|
`Contraindication with id ${contraindication.id} not found for technology ${technologyId}. No update performed.`
|
|
@@ -2136,9 +2147,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2136
2147
|
if (!technology) {
|
|
2137
2148
|
throw new Error(`Technology with id ${technologyId} not found`);
|
|
2138
2149
|
}
|
|
2139
|
-
const updatedBenefits = (technology.benefits || []).filter(
|
|
2140
|
-
(b) => b.id !== benefit.id
|
|
2141
|
-
);
|
|
2150
|
+
const updatedBenefits = (technology.benefits || []).filter((b) => b.id !== benefit.id);
|
|
2142
2151
|
await updateDoc9(docRef, {
|
|
2143
2152
|
benefits: updatedBenefits,
|
|
2144
2153
|
updatedAt: /* @__PURE__ */ new Date()
|
|
@@ -2244,9 +2253,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2244
2253
|
* );
|
|
2245
2254
|
*/
|
|
2246
2255
|
validateCertification(requiredCertification, practitionerCertification) {
|
|
2247
|
-
const doctorLevel = Object.values(CertificationLevel).indexOf(
|
|
2248
|
-
practitionerCertification.level
|
|
2249
|
-
);
|
|
2256
|
+
const doctorLevel = Object.values(CertificationLevel).indexOf(practitionerCertification.level);
|
|
2250
2257
|
const requiredLevel = Object.values(CertificationLevel).indexOf(
|
|
2251
2258
|
requiredCertification.minimumLevel
|
|
2252
2259
|
);
|
|
@@ -2287,18 +2294,11 @@ var TechnologyService = class extends BaseService {
|
|
|
2287
2294
|
async getAllowedTechnologies(practitioner) {
|
|
2288
2295
|
const allTechnologies = await this.getAll();
|
|
2289
2296
|
const allowedTechnologies = allTechnologies.technologies.filter(
|
|
2290
|
-
(technology) => this.validateCertification(
|
|
2291
|
-
technology.certificationRequirement,
|
|
2292
|
-
practitioner.certification
|
|
2293
|
-
)
|
|
2297
|
+
(technology) => this.validateCertification(technology.certificationRequirement, practitioner.certification)
|
|
2294
2298
|
);
|
|
2295
2299
|
const families = [...new Set(allowedTechnologies.map((t) => t.family))];
|
|
2296
|
-
const categories = [
|
|
2297
|
-
|
|
2298
|
-
];
|
|
2299
|
-
const subcategories = [
|
|
2300
|
-
...new Set(allowedTechnologies.map((t) => t.subcategoryId))
|
|
2301
|
-
];
|
|
2300
|
+
const categories = [...new Set(allowedTechnologies.map((t) => t.categoryId))];
|
|
2301
|
+
const subcategories = [...new Set(allowedTechnologies.map((t) => t.subcategoryId))];
|
|
2302
2302
|
return {
|
|
2303
2303
|
technologies: allowedTechnologies,
|
|
2304
2304
|
families,
|
|
@@ -2306,6 +2306,25 @@ var TechnologyService = class extends BaseService {
|
|
|
2306
2306
|
subcategories
|
|
2307
2307
|
};
|
|
2308
2308
|
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Gets all active technologies for a subcategory for filter dropdowns (by subcategory only).
|
|
2311
|
+
* @param subcategoryId - The ID of the subcategory.
|
|
2312
|
+
*/
|
|
2313
|
+
async getAllForFilterBySubcategory(subcategoryId) {
|
|
2314
|
+
const q = query9(
|
|
2315
|
+
collection9(this.db, TECHNOLOGIES_COLLECTION),
|
|
2316
|
+
where9("isActive", "==", true),
|
|
2317
|
+
where9("subcategoryId", "==", subcategoryId),
|
|
2318
|
+
orderBy8("name")
|
|
2319
|
+
);
|
|
2320
|
+
const snapshot = await getDocs9(q);
|
|
2321
|
+
return snapshot.docs.map(
|
|
2322
|
+
(doc11) => ({
|
|
2323
|
+
id: doc11.id,
|
|
2324
|
+
...doc11.data()
|
|
2325
|
+
})
|
|
2326
|
+
);
|
|
2327
|
+
}
|
|
2309
2328
|
/**
|
|
2310
2329
|
* Gets all active technologies for a subcategory for filter dropdowns.
|
|
2311
2330
|
* @param categoryId - The ID of the parent category.
|
package/dist/index.d.mts
CHANGED
|
@@ -254,6 +254,35 @@ interface Category {
|
|
|
254
254
|
/** Flag koji označava da li je kategorija aktivna */
|
|
255
255
|
isActive: boolean;
|
|
256
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Interface for the CategoryService class
|
|
259
|
+
*/
|
|
260
|
+
interface ICategoryService {
|
|
261
|
+
create(category: Omit<Category, 'id' | 'createdAt' | 'updatedAt'>): Promise<Category>;
|
|
262
|
+
getCategoryCounts(active?: boolean): Promise<Record<string, number>>;
|
|
263
|
+
getAllForFilter(): Promise<Category[]>;
|
|
264
|
+
getAllForFilterByFamily(family: ProcedureFamily): Promise<Category[]>;
|
|
265
|
+
getAll(options?: {
|
|
266
|
+
active?: boolean;
|
|
267
|
+
limit?: number;
|
|
268
|
+
lastVisible?: any;
|
|
269
|
+
}): Promise<{
|
|
270
|
+
categories: Category[];
|
|
271
|
+
lastVisible: any;
|
|
272
|
+
}>;
|
|
273
|
+
getAllByFamily(family: ProcedureFamily, options?: {
|
|
274
|
+
active?: boolean;
|
|
275
|
+
limit?: number;
|
|
276
|
+
lastVisible?: any;
|
|
277
|
+
}): Promise<{
|
|
278
|
+
categories: Category[];
|
|
279
|
+
lastVisible: any;
|
|
280
|
+
}>;
|
|
281
|
+
update(id: string, category: Partial<Omit<Category, 'id' | 'createdAt'>>): Promise<Category | null>;
|
|
282
|
+
delete(id: string): Promise<void>;
|
|
283
|
+
reactivate(id: string): Promise<void>;
|
|
284
|
+
getById(id: string): Promise<Category | null>;
|
|
285
|
+
}
|
|
257
286
|
|
|
258
287
|
/**
|
|
259
288
|
* Types for the Medical Documentation Templating System
|
|
@@ -575,7 +604,7 @@ interface IProductService {
|
|
|
575
604
|
* @param brandId - ID of the brand that manufactures this product
|
|
576
605
|
* @param product - Product data
|
|
577
606
|
*/
|
|
578
|
-
create(technologyId: string, brandId: string, product: Omit<Product,
|
|
607
|
+
create(technologyId: string, brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'technologyId'>): Promise<Product>;
|
|
579
608
|
/**
|
|
580
609
|
* Gets a paginated list of all products, with optional filters.
|
|
581
610
|
*/
|
|
@@ -605,6 +634,11 @@ interface IProductService {
|
|
|
605
634
|
bySubcategory: Record<string, number>;
|
|
606
635
|
byTechnology: Record<string, number>;
|
|
607
636
|
}>;
|
|
637
|
+
/**
|
|
638
|
+
* Gets all products for a specific technology (non-paginated, for filters/dropdowns)
|
|
639
|
+
* @param technologyId - ID of the technology
|
|
640
|
+
*/
|
|
641
|
+
getAllByTechnology(technologyId: string): Promise<Product[]>;
|
|
608
642
|
/**
|
|
609
643
|
* Gets all products for a brand
|
|
610
644
|
* @param brandId - ID of the brand
|
|
@@ -616,7 +650,7 @@ interface IProductService {
|
|
|
616
650
|
* @param productId - ID of the product to update
|
|
617
651
|
* @param product - Updated product data
|
|
618
652
|
*/
|
|
619
|
-
update(technologyId: string, productId: string, product: Partial<Omit<Product,
|
|
653
|
+
update(technologyId: string, productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId' | 'technologyId'>>): Promise<Product | null>;
|
|
620
654
|
/**
|
|
621
655
|
* Deletes a product (soft delete)
|
|
622
656
|
* @param technologyId - ID of the technology
|
|
@@ -830,6 +864,69 @@ interface Technology {
|
|
|
830
864
|
createdAt: Date;
|
|
831
865
|
updatedAt: Date;
|
|
832
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Interface for the TechnologyService class
|
|
869
|
+
*/
|
|
870
|
+
interface ITechnologyService {
|
|
871
|
+
create(technology: Omit<Technology, 'id' | 'createdAt' | 'updatedAt'>): Promise<Technology>;
|
|
872
|
+
getTechnologyCounts(active?: boolean): Promise<Record<string, number>>;
|
|
873
|
+
getTechnologyCountsByCategory(active?: boolean): Promise<Record<string, number>>;
|
|
874
|
+
getAll(options?: {
|
|
875
|
+
active?: boolean;
|
|
876
|
+
limit?: number;
|
|
877
|
+
lastVisible?: any;
|
|
878
|
+
}): Promise<{
|
|
879
|
+
technologies: Technology[];
|
|
880
|
+
lastVisible: any;
|
|
881
|
+
}>;
|
|
882
|
+
getAllByCategoryId(categoryId: string, options?: {
|
|
883
|
+
active?: boolean;
|
|
884
|
+
limit?: number;
|
|
885
|
+
lastVisible?: any;
|
|
886
|
+
}): Promise<{
|
|
887
|
+
technologies: Technology[];
|
|
888
|
+
lastVisible: any;
|
|
889
|
+
}>;
|
|
890
|
+
getAllBySubcategoryId(subcategoryId: string, options?: {
|
|
891
|
+
active?: boolean;
|
|
892
|
+
limit?: number;
|
|
893
|
+
lastVisible?: any;
|
|
894
|
+
}): Promise<{
|
|
895
|
+
technologies: Technology[];
|
|
896
|
+
lastVisible: any;
|
|
897
|
+
}>;
|
|
898
|
+
update(id: string, technology: Partial<Omit<Technology, 'id' | 'createdAt'>>): Promise<Technology | null>;
|
|
899
|
+
delete(id: string): Promise<void>;
|
|
900
|
+
reactivate(id: string): Promise<void>;
|
|
901
|
+
getById(id: string): Promise<Technology | null>;
|
|
902
|
+
addRequirement(technologyId: string, requirement: Requirement): Promise<Technology | null>;
|
|
903
|
+
removeRequirement(technologyId: string, requirement: Requirement): Promise<Technology | null>;
|
|
904
|
+
getRequirements(technologyId: string, type?: 'pre' | 'post'): Promise<Requirement[]>;
|
|
905
|
+
updateRequirement(technologyId: string, oldRequirement: Requirement, newRequirement: Requirement): Promise<Technology | null>;
|
|
906
|
+
addBlockingCondition(technologyId: string, condition: BlockingCondition): Promise<Technology | null>;
|
|
907
|
+
removeBlockingCondition(technologyId: string, condition: BlockingCondition): Promise<Technology | null>;
|
|
908
|
+
addContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
|
|
909
|
+
removeContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
|
|
910
|
+
updateContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
|
|
911
|
+
addBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
|
|
912
|
+
removeBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
|
|
913
|
+
updateBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
|
|
914
|
+
getBlockingConditions(technologyId: string): Promise<BlockingCondition[]>;
|
|
915
|
+
getContraindications(technologyId: string): Promise<ContraindicationDynamic[]>;
|
|
916
|
+
getBenefits(technologyId: string): Promise<TreatmentBenefitDynamic[]>;
|
|
917
|
+
updateCertificationRequirement(technologyId: string, certificationRequirement: CertificationRequirement): Promise<Technology | null>;
|
|
918
|
+
getCertificationRequirement(technologyId: string): Promise<CertificationRequirement | null>;
|
|
919
|
+
validateCertification(requiredCertification: CertificationRequirement, practitionerCertification: any): boolean;
|
|
920
|
+
getAllowedTechnologies(practitioner: any): Promise<{
|
|
921
|
+
technologies: Technology[];
|
|
922
|
+
families: ProcedureFamily[];
|
|
923
|
+
categories: string[];
|
|
924
|
+
subcategories: string[];
|
|
925
|
+
}>;
|
|
926
|
+
getAllForFilterBySubcategory(subcategoryId: string): Promise<Technology[]>;
|
|
927
|
+
getAllForFilterBySubcategoryId(categoryId: string, subcategoryId: string): Promise<Technology[]>;
|
|
928
|
+
getAllForFilter(): Promise<Technology[]>;
|
|
929
|
+
}
|
|
833
930
|
|
|
834
931
|
/**
|
|
835
932
|
* @deprecated
|
|
@@ -964,8 +1061,8 @@ declare class BrandService extends BaseService {
|
|
|
964
1061
|
createdAt: Date;
|
|
965
1062
|
updatedAt: Date;
|
|
966
1063
|
name: string;
|
|
967
|
-
isActive: boolean;
|
|
968
1064
|
description?: string | undefined;
|
|
1065
|
+
isActive: boolean;
|
|
969
1066
|
name_lowercase: string;
|
|
970
1067
|
manufacturer: string;
|
|
971
1068
|
website?: string | undefined;
|
|
@@ -1017,7 +1114,7 @@ declare class BrandService extends BaseService {
|
|
|
1017
1114
|
* family: ProcedureFamily.AESTHETICS
|
|
1018
1115
|
* });
|
|
1019
1116
|
*/
|
|
1020
|
-
declare class CategoryService extends BaseService {
|
|
1117
|
+
declare class CategoryService extends BaseService implements ICategoryService {
|
|
1021
1118
|
/**
|
|
1022
1119
|
* Referenca na Firestore kolekciju kategorija
|
|
1023
1120
|
*/
|
|
@@ -1027,13 +1124,13 @@ declare class CategoryService extends BaseService {
|
|
|
1027
1124
|
* @param category - Podaci za novu kategoriju
|
|
1028
1125
|
* @returns Kreirana kategorija sa generisanim ID-em
|
|
1029
1126
|
*/
|
|
1030
|
-
create(category: Omit<Category,
|
|
1127
|
+
create(category: Omit<Category, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
|
|
1031
1128
|
createdAt: Date;
|
|
1032
1129
|
updatedAt: Date;
|
|
1033
1130
|
name: string;
|
|
1034
|
-
isActive: boolean;
|
|
1035
1131
|
description: string;
|
|
1036
1132
|
family: ProcedureFamily;
|
|
1133
|
+
isActive: boolean;
|
|
1037
1134
|
id: string;
|
|
1038
1135
|
}>;
|
|
1039
1136
|
/**
|
|
@@ -1047,6 +1144,12 @@ declare class CategoryService extends BaseService {
|
|
|
1047
1144
|
* @returns Lista svih aktivnih kategorija
|
|
1048
1145
|
*/
|
|
1049
1146
|
getAllForFilter(): Promise<Category[]>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Vraća sve kategorije za određenu familiju za potrebe filtera (bez paginacije)
|
|
1149
|
+
* @param family - Familija procedura (aesthetics/surgery)
|
|
1150
|
+
* @returns Lista aktivnih kategorija koje pripadaju traženoj familiji
|
|
1151
|
+
*/
|
|
1152
|
+
getAllForFilterByFamily(family: ProcedureFamily): Promise<Category[]>;
|
|
1050
1153
|
/**
|
|
1051
1154
|
* Vraća sve kategorije sa paginacijom
|
|
1052
1155
|
* @param options - Pagination and filter options
|
|
@@ -1080,7 +1183,7 @@ declare class CategoryService extends BaseService {
|
|
|
1080
1183
|
* @param category - Novi podaci za kategoriju
|
|
1081
1184
|
* @returns Ažurirana kategorija
|
|
1082
1185
|
*/
|
|
1083
|
-
update(id: string, category: Partial<Omit<Category,
|
|
1186
|
+
update(id: string, category: Partial<Omit<Category, 'id' | 'createdAt'>>): Promise<Category | null>;
|
|
1084
1187
|
/**
|
|
1085
1188
|
* Soft delete kategorije (postavlja isActive na false)
|
|
1086
1189
|
* @param id - ID kategorije koja se briše
|
|
@@ -1381,7 +1484,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1381
1484
|
/**
|
|
1382
1485
|
* Creates a new product under technology
|
|
1383
1486
|
*/
|
|
1384
|
-
create(technologyId: string, brandId: string, product: Omit<Product,
|
|
1487
|
+
create(technologyId: string, brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'technologyId'>): Promise<Product>;
|
|
1385
1488
|
/**
|
|
1386
1489
|
* Gets a paginated list of all products, with optional filters.
|
|
1387
1490
|
* This uses a collectionGroup query to search across all technologies.
|
|
@@ -1413,6 +1516,10 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1413
1516
|
bySubcategory: Record<string, number>;
|
|
1414
1517
|
byTechnology: Record<string, number>;
|
|
1415
1518
|
}>;
|
|
1519
|
+
/**
|
|
1520
|
+
* Gets all products for a specific technology (non-paginated, for filters/dropdowns)
|
|
1521
|
+
*/
|
|
1522
|
+
getAllByTechnology(technologyId: string): Promise<Product[]>;
|
|
1416
1523
|
/**
|
|
1417
1524
|
* Gets all products for a brand by filtering through all technologies
|
|
1418
1525
|
*/
|
|
@@ -1420,7 +1527,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1420
1527
|
/**
|
|
1421
1528
|
* Updates a product
|
|
1422
1529
|
*/
|
|
1423
|
-
update(technologyId: string, productId: string, product: Partial<Omit<Product,
|
|
1530
|
+
update(technologyId: string, productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId' | 'technologyId'>>): Promise<Product | null>;
|
|
1424
1531
|
/**
|
|
1425
1532
|
* Soft deletes a product
|
|
1426
1533
|
*/
|
|
@@ -1460,9 +1567,9 @@ declare class SubcategoryService extends BaseService {
|
|
|
1460
1567
|
createdAt: Date;
|
|
1461
1568
|
updatedAt: Date;
|
|
1462
1569
|
name: string;
|
|
1463
|
-
categoryId: string;
|
|
1464
|
-
isActive: boolean;
|
|
1465
1570
|
description?: string | undefined;
|
|
1571
|
+
isActive: boolean;
|
|
1572
|
+
categoryId: string;
|
|
1466
1573
|
id: string;
|
|
1467
1574
|
}>;
|
|
1468
1575
|
/**
|
|
@@ -1845,7 +1952,7 @@ interface CreatePractitionerTokenData {
|
|
|
1845
1952
|
/**
|
|
1846
1953
|
* Service for managing technologies.
|
|
1847
1954
|
*/
|
|
1848
|
-
declare class TechnologyService extends BaseService {
|
|
1955
|
+
declare class TechnologyService extends BaseService implements ITechnologyService {
|
|
1849
1956
|
/**
|
|
1850
1957
|
* Reference to the Firestore collection of technologies.
|
|
1851
1958
|
*/
|
|
@@ -1855,17 +1962,17 @@ declare class TechnologyService extends BaseService {
|
|
|
1855
1962
|
* @param technology - Data for the new technology.
|
|
1856
1963
|
* @returns The created technology with its generated ID.
|
|
1857
1964
|
*/
|
|
1858
|
-
create(technology: Omit<Technology,
|
|
1965
|
+
create(technology: Omit<Technology, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
|
|
1859
1966
|
createdAt: Date;
|
|
1860
1967
|
updatedAt: Date;
|
|
1861
1968
|
name: string;
|
|
1969
|
+
description: string;
|
|
1970
|
+
family: ProcedureFamily;
|
|
1971
|
+
isActive: boolean;
|
|
1862
1972
|
categoryId: string;
|
|
1863
1973
|
subcategoryId: string;
|
|
1864
|
-
isActive: boolean;
|
|
1865
|
-
description: string;
|
|
1866
1974
|
technicalDetails?: string | undefined;
|
|
1867
1975
|
contraindications: ContraindicationDynamic[];
|
|
1868
|
-
family: ProcedureFamily;
|
|
1869
1976
|
requirements: {
|
|
1870
1977
|
pre: Requirement[];
|
|
1871
1978
|
post: Requirement[];
|
|
@@ -1935,7 +2042,7 @@ declare class TechnologyService extends BaseService {
|
|
|
1935
2042
|
* @param technology - New data for the technology.
|
|
1936
2043
|
* @returns The updated technology.
|
|
1937
2044
|
*/
|
|
1938
|
-
update(id: string, technology: Partial<Omit<Technology,
|
|
2045
|
+
update(id: string, technology: Partial<Omit<Technology, 'id' | 'createdAt'>>): Promise<Technology | null>;
|
|
1939
2046
|
/**
|
|
1940
2047
|
* Soft deletes a technology.
|
|
1941
2048
|
* @param id - The ID of the technology to delete.
|
|
@@ -2119,6 +2226,11 @@ declare class TechnologyService extends BaseService {
|
|
|
2119
2226
|
categories: string[];
|
|
2120
2227
|
subcategories: string[];
|
|
2121
2228
|
}>;
|
|
2229
|
+
/**
|
|
2230
|
+
* Gets all active technologies for a subcategory for filter dropdowns (by subcategory only).
|
|
2231
|
+
* @param subcategoryId - The ID of the subcategory.
|
|
2232
|
+
*/
|
|
2233
|
+
getAllForFilterBySubcategory(subcategoryId: string): Promise<Technology[]>;
|
|
2122
2234
|
/**
|
|
2123
2235
|
* Gets all active technologies for a subcategory for filter dropdowns.
|
|
2124
2236
|
* @param categoryId - The ID of the parent category.
|