@blackcode_sa/metaestetics-api 1.14.34 → 1.14.37
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 +9 -18
- package/dist/admin/index.d.ts +9 -18
- package/dist/backoffice/index.d.mts +41 -54
- package/dist/backoffice/index.d.ts +41 -54
- package/dist/backoffice/index.js +23 -38
- package/dist/backoffice/index.mjs +23 -38
- package/dist/index.d.mts +21 -34
- package/dist/index.d.ts +21 -34
- package/dist/index.js +23 -38
- package/dist/index.mjs +23 -38
- package/package.json +1 -1
- package/src/backoffice/services/brand.service.ts +4 -17
- package/src/backoffice/services/product.service.ts +12 -17
- package/src/backoffice/services/technology.service.ts +3 -1
- package/src/backoffice/types/brand.types.ts +0 -2
- package/src/backoffice/types/product.types.ts +18 -28
package/dist/backoffice/index.js
CHANGED
|
@@ -162,13 +162,12 @@ var BrandService = class extends BaseService {
|
|
|
162
162
|
return { id: docRef.id, ...newBrand };
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
* Gets a paginated list of active brands, optionally filtered by name
|
|
165
|
+
* Gets a paginated list of active brands, optionally filtered by name.
|
|
166
166
|
* @param rowsPerPage - The number of brands to fetch.
|
|
167
167
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
168
168
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
169
|
-
* @param category - An optional category to filter brands by.
|
|
170
169
|
*/
|
|
171
|
-
async getAll(rowsPerPage, searchTerm, lastVisible
|
|
170
|
+
async getAll(rowsPerPage, searchTerm, lastVisible) {
|
|
172
171
|
const constraints = [
|
|
173
172
|
(0, import_firestore.where)("isActive", "==", true),
|
|
174
173
|
(0, import_firestore.orderBy)("name_lowercase")
|
|
@@ -180,9 +179,6 @@ var BrandService = class extends BaseService {
|
|
|
180
179
|
(0, import_firestore.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
181
180
|
);
|
|
182
181
|
}
|
|
183
|
-
if (category) {
|
|
184
|
-
constraints.push((0, import_firestore.where)("category", "==", category));
|
|
185
|
-
}
|
|
186
182
|
if (lastVisible) {
|
|
187
183
|
constraints.push((0, import_firestore.startAfter)(lastVisible));
|
|
188
184
|
}
|
|
@@ -199,11 +195,10 @@ var BrandService = class extends BaseService {
|
|
|
199
195
|
return { brands, lastVisible: newLastVisible };
|
|
200
196
|
}
|
|
201
197
|
/**
|
|
202
|
-
* Gets the total count of active brands, optionally filtered by name
|
|
198
|
+
* Gets the total count of active brands, optionally filtered by name.
|
|
203
199
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
204
|
-
* @param category - An optional category to filter brands by.
|
|
205
200
|
*/
|
|
206
|
-
async getBrandsCount(searchTerm
|
|
201
|
+
async getBrandsCount(searchTerm) {
|
|
207
202
|
const constraints = [(0, import_firestore.where)("isActive", "==", true)];
|
|
208
203
|
if (searchTerm) {
|
|
209
204
|
const lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
@@ -212,9 +207,6 @@ var BrandService = class extends BaseService {
|
|
|
212
207
|
(0, import_firestore.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
213
208
|
);
|
|
214
209
|
}
|
|
215
|
-
if (category) {
|
|
216
|
-
constraints.push((0, import_firestore.where)("category", "==", category));
|
|
217
|
-
}
|
|
218
210
|
const q = (0, import_firestore.query)(this.getBrandsRef(), ...constraints);
|
|
219
211
|
const snapshot = await (0, import_firestore.getCountFromServer)(q);
|
|
220
212
|
return snapshot.data().count;
|
|
@@ -284,7 +276,6 @@ var BrandService = class extends BaseService {
|
|
|
284
276
|
"id",
|
|
285
277
|
"name",
|
|
286
278
|
"manufacturer",
|
|
287
|
-
"category",
|
|
288
279
|
"website",
|
|
289
280
|
"description",
|
|
290
281
|
"isActive"
|
|
@@ -315,15 +306,14 @@ var BrandService = class extends BaseService {
|
|
|
315
306
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
316
307
|
}
|
|
317
308
|
brandToCsvRow(brand) {
|
|
318
|
-
var _a, _b, _c, _d, _e, _f
|
|
309
|
+
var _a, _b, _c, _d, _e, _f;
|
|
319
310
|
const values = [
|
|
320
311
|
(_a = brand.id) != null ? _a : "",
|
|
321
312
|
(_b = brand.name) != null ? _b : "",
|
|
322
313
|
(_c = brand.manufacturer) != null ? _c : "",
|
|
323
|
-
(_d = brand.
|
|
324
|
-
(_e = brand.
|
|
325
|
-
(_f = brand.
|
|
326
|
-
String((_g = brand.isActive) != null ? _g : "")
|
|
314
|
+
(_d = brand.website) != null ? _d : "",
|
|
315
|
+
(_e = brand.description) != null ? _e : "",
|
|
316
|
+
String((_f = brand.isActive) != null ? _f : "")
|
|
327
317
|
];
|
|
328
318
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
329
319
|
}
|
|
@@ -1871,11 +1861,10 @@ var ProductService = class extends BaseService {
|
|
|
1871
1861
|
/**
|
|
1872
1862
|
* Creates a new product in the top-level collection
|
|
1873
1863
|
*/
|
|
1874
|
-
async createTopLevel(
|
|
1864
|
+
async createTopLevel(product, technologyIds = []) {
|
|
1875
1865
|
const now = /* @__PURE__ */ new Date();
|
|
1876
1866
|
const newProduct = {
|
|
1877
1867
|
...product,
|
|
1878
|
-
brandId,
|
|
1879
1868
|
assignedTechnologyIds: technologyIds,
|
|
1880
1869
|
createdAt: now,
|
|
1881
1870
|
updatedAt: now,
|
|
@@ -1888,11 +1877,14 @@ var ProductService = class extends BaseService {
|
|
|
1888
1877
|
* Gets all products from the top-level collection
|
|
1889
1878
|
*/
|
|
1890
1879
|
async getAllTopLevel(options) {
|
|
1891
|
-
const { rowsPerPage, lastVisible, brandId } = options;
|
|
1880
|
+
const { rowsPerPage, lastVisible, brandId, category } = options;
|
|
1892
1881
|
const constraints = [(0, import_firestore8.where)("isActive", "==", true), (0, import_firestore8.orderBy)("name")];
|
|
1893
1882
|
if (brandId) {
|
|
1894
1883
|
constraints.push((0, import_firestore8.where)("brandId", "==", brandId));
|
|
1895
1884
|
}
|
|
1885
|
+
if (category) {
|
|
1886
|
+
constraints.push((0, import_firestore8.where)("category", "==", category));
|
|
1887
|
+
}
|
|
1896
1888
|
if (lastVisible) {
|
|
1897
1889
|
constraints.push((0, import_firestore8.startAfter)(lastVisible));
|
|
1898
1890
|
}
|
|
@@ -2033,14 +2025,10 @@ var ProductService = class extends BaseService {
|
|
|
2033
2025
|
"name",
|
|
2034
2026
|
"brandId",
|
|
2035
2027
|
"brandName",
|
|
2028
|
+
"category",
|
|
2036
2029
|
"assignedTechnologyIds",
|
|
2037
2030
|
"description",
|
|
2038
|
-
"
|
|
2039
|
-
"dosage",
|
|
2040
|
-
"composition",
|
|
2041
|
-
"indications",
|
|
2042
|
-
"contraindications",
|
|
2043
|
-
"warnings",
|
|
2031
|
+
"metadata",
|
|
2044
2032
|
"isActive"
|
|
2045
2033
|
];
|
|
2046
2034
|
const rows = [];
|
|
@@ -2069,21 +2057,17 @@ var ProductService = class extends BaseService {
|
|
|
2069
2057
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
2070
2058
|
}
|
|
2071
2059
|
productToCsvRow(product) {
|
|
2072
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i
|
|
2060
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2073
2061
|
const values = [
|
|
2074
2062
|
(_a = product.id) != null ? _a : "",
|
|
2075
2063
|
(_b = product.name) != null ? _b : "",
|
|
2076
2064
|
(_c = product.brandId) != null ? _c : "",
|
|
2077
2065
|
(_d = product.brandName) != null ? _d : "",
|
|
2078
|
-
(
|
|
2079
|
-
(_g = product.
|
|
2080
|
-
(_h = product.
|
|
2081
|
-
|
|
2082
|
-
(
|
|
2083
|
-
(_l = (_k = product.indications) == null ? void 0 : _k.join(";")) != null ? _l : "",
|
|
2084
|
-
(_n = (_m = product.contraindications) == null ? void 0 : _m.map((c) => c.name).join(";")) != null ? _n : "",
|
|
2085
|
-
(_p = (_o = product.warnings) == null ? void 0 : _o.join(";")) != null ? _p : "",
|
|
2086
|
-
String((_q = product.isActive) != null ? _q : "")
|
|
2066
|
+
(_e = product.category) != null ? _e : "",
|
|
2067
|
+
(_g = (_f = product.assignedTechnologyIds) == null ? void 0 : _f.join(";")) != null ? _g : "",
|
|
2068
|
+
(_h = product.description) != null ? _h : "",
|
|
2069
|
+
product.metadata ? JSON.stringify(product.metadata) : "",
|
|
2070
|
+
String((_i = product.isActive) != null ? _i : "")
|
|
2087
2071
|
];
|
|
2088
2072
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
2089
2073
|
}
|
|
@@ -3415,7 +3399,8 @@ var TechnologyService = class extends BaseService {
|
|
|
3415
3399
|
const products = await this.getAssignedProducts(technologyId);
|
|
3416
3400
|
const byBrand = {};
|
|
3417
3401
|
products.forEach((product) => {
|
|
3418
|
-
|
|
3402
|
+
const brandName = product.brandName || "Unknown";
|
|
3403
|
+
byBrand[brandName] = (byBrand[brandName] || 0) + 1;
|
|
3419
3404
|
});
|
|
3420
3405
|
return {
|
|
3421
3406
|
totalAssigned: products.length,
|
|
@@ -68,13 +68,12 @@ var BrandService = class extends BaseService {
|
|
|
68
68
|
return { id: docRef.id, ...newBrand };
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
* Gets a paginated list of active brands, optionally filtered by name
|
|
71
|
+
* Gets a paginated list of active brands, optionally filtered by name.
|
|
72
72
|
* @param rowsPerPage - The number of brands to fetch.
|
|
73
73
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
74
74
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
75
|
-
* @param category - An optional category to filter brands by.
|
|
76
75
|
*/
|
|
77
|
-
async getAll(rowsPerPage, searchTerm, lastVisible
|
|
76
|
+
async getAll(rowsPerPage, searchTerm, lastVisible) {
|
|
78
77
|
const constraints = [
|
|
79
78
|
where("isActive", "==", true),
|
|
80
79
|
orderBy("name_lowercase")
|
|
@@ -86,9 +85,6 @@ var BrandService = class extends BaseService {
|
|
|
86
85
|
where("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
87
86
|
);
|
|
88
87
|
}
|
|
89
|
-
if (category) {
|
|
90
|
-
constraints.push(where("category", "==", category));
|
|
91
|
-
}
|
|
92
88
|
if (lastVisible) {
|
|
93
89
|
constraints.push(startAfter(lastVisible));
|
|
94
90
|
}
|
|
@@ -105,11 +101,10 @@ var BrandService = class extends BaseService {
|
|
|
105
101
|
return { brands, lastVisible: newLastVisible };
|
|
106
102
|
}
|
|
107
103
|
/**
|
|
108
|
-
* Gets the total count of active brands, optionally filtered by name
|
|
104
|
+
* Gets the total count of active brands, optionally filtered by name.
|
|
109
105
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
110
|
-
* @param category - An optional category to filter brands by.
|
|
111
106
|
*/
|
|
112
|
-
async getBrandsCount(searchTerm
|
|
107
|
+
async getBrandsCount(searchTerm) {
|
|
113
108
|
const constraints = [where("isActive", "==", true)];
|
|
114
109
|
if (searchTerm) {
|
|
115
110
|
const lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
@@ -118,9 +113,6 @@ var BrandService = class extends BaseService {
|
|
|
118
113
|
where("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
119
114
|
);
|
|
120
115
|
}
|
|
121
|
-
if (category) {
|
|
122
|
-
constraints.push(where("category", "==", category));
|
|
123
|
-
}
|
|
124
116
|
const q = query(this.getBrandsRef(), ...constraints);
|
|
125
117
|
const snapshot = await getCountFromServer(q);
|
|
126
118
|
return snapshot.data().count;
|
|
@@ -190,7 +182,6 @@ var BrandService = class extends BaseService {
|
|
|
190
182
|
"id",
|
|
191
183
|
"name",
|
|
192
184
|
"manufacturer",
|
|
193
|
-
"category",
|
|
194
185
|
"website",
|
|
195
186
|
"description",
|
|
196
187
|
"isActive"
|
|
@@ -221,15 +212,14 @@ var BrandService = class extends BaseService {
|
|
|
221
212
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
222
213
|
}
|
|
223
214
|
brandToCsvRow(brand) {
|
|
224
|
-
var _a, _b, _c, _d, _e, _f
|
|
215
|
+
var _a, _b, _c, _d, _e, _f;
|
|
225
216
|
const values = [
|
|
226
217
|
(_a = brand.id) != null ? _a : "",
|
|
227
218
|
(_b = brand.name) != null ? _b : "",
|
|
228
219
|
(_c = brand.manufacturer) != null ? _c : "",
|
|
229
|
-
(_d = brand.
|
|
230
|
-
(_e = brand.
|
|
231
|
-
(_f = brand.
|
|
232
|
-
String((_g = brand.isActive) != null ? _g : "")
|
|
220
|
+
(_d = brand.website) != null ? _d : "",
|
|
221
|
+
(_e = brand.description) != null ? _e : "",
|
|
222
|
+
String((_f = brand.isActive) != null ? _f : "")
|
|
233
223
|
];
|
|
234
224
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
235
225
|
}
|
|
@@ -1847,11 +1837,10 @@ var ProductService = class extends BaseService {
|
|
|
1847
1837
|
/**
|
|
1848
1838
|
* Creates a new product in the top-level collection
|
|
1849
1839
|
*/
|
|
1850
|
-
async createTopLevel(
|
|
1840
|
+
async createTopLevel(product, technologyIds = []) {
|
|
1851
1841
|
const now = /* @__PURE__ */ new Date();
|
|
1852
1842
|
const newProduct = {
|
|
1853
1843
|
...product,
|
|
1854
|
-
brandId,
|
|
1855
1844
|
assignedTechnologyIds: technologyIds,
|
|
1856
1845
|
createdAt: now,
|
|
1857
1846
|
updatedAt: now,
|
|
@@ -1864,11 +1853,14 @@ var ProductService = class extends BaseService {
|
|
|
1864
1853
|
* Gets all products from the top-level collection
|
|
1865
1854
|
*/
|
|
1866
1855
|
async getAllTopLevel(options) {
|
|
1867
|
-
const { rowsPerPage, lastVisible, brandId } = options;
|
|
1856
|
+
const { rowsPerPage, lastVisible, brandId, category } = options;
|
|
1868
1857
|
const constraints = [where6("isActive", "==", true), orderBy6("name")];
|
|
1869
1858
|
if (brandId) {
|
|
1870
1859
|
constraints.push(where6("brandId", "==", brandId));
|
|
1871
1860
|
}
|
|
1861
|
+
if (category) {
|
|
1862
|
+
constraints.push(where6("category", "==", category));
|
|
1863
|
+
}
|
|
1872
1864
|
if (lastVisible) {
|
|
1873
1865
|
constraints.push(startAfter5(lastVisible));
|
|
1874
1866
|
}
|
|
@@ -2009,14 +2001,10 @@ var ProductService = class extends BaseService {
|
|
|
2009
2001
|
"name",
|
|
2010
2002
|
"brandId",
|
|
2011
2003
|
"brandName",
|
|
2004
|
+
"category",
|
|
2012
2005
|
"assignedTechnologyIds",
|
|
2013
2006
|
"description",
|
|
2014
|
-
"
|
|
2015
|
-
"dosage",
|
|
2016
|
-
"composition",
|
|
2017
|
-
"indications",
|
|
2018
|
-
"contraindications",
|
|
2019
|
-
"warnings",
|
|
2007
|
+
"metadata",
|
|
2020
2008
|
"isActive"
|
|
2021
2009
|
];
|
|
2022
2010
|
const rows = [];
|
|
@@ -2045,21 +2033,17 @@ var ProductService = class extends BaseService {
|
|
|
2045
2033
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
2046
2034
|
}
|
|
2047
2035
|
productToCsvRow(product) {
|
|
2048
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i
|
|
2036
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2049
2037
|
const values = [
|
|
2050
2038
|
(_a = product.id) != null ? _a : "",
|
|
2051
2039
|
(_b = product.name) != null ? _b : "",
|
|
2052
2040
|
(_c = product.brandId) != null ? _c : "",
|
|
2053
2041
|
(_d = product.brandName) != null ? _d : "",
|
|
2054
|
-
(
|
|
2055
|
-
(_g = product.
|
|
2056
|
-
(_h = product.
|
|
2057
|
-
|
|
2058
|
-
(
|
|
2059
|
-
(_l = (_k = product.indications) == null ? void 0 : _k.join(";")) != null ? _l : "",
|
|
2060
|
-
(_n = (_m = product.contraindications) == null ? void 0 : _m.map((c) => c.name).join(";")) != null ? _n : "",
|
|
2061
|
-
(_p = (_o = product.warnings) == null ? void 0 : _o.join(";")) != null ? _p : "",
|
|
2062
|
-
String((_q = product.isActive) != null ? _q : "")
|
|
2042
|
+
(_e = product.category) != null ? _e : "",
|
|
2043
|
+
(_g = (_f = product.assignedTechnologyIds) == null ? void 0 : _f.join(";")) != null ? _g : "",
|
|
2044
|
+
(_h = product.description) != null ? _h : "",
|
|
2045
|
+
product.metadata ? JSON.stringify(product.metadata) : "",
|
|
2046
|
+
String((_i = product.isActive) != null ? _i : "")
|
|
2063
2047
|
];
|
|
2064
2048
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
2065
2049
|
}
|
|
@@ -3431,7 +3415,8 @@ var TechnologyService = class extends BaseService {
|
|
|
3431
3415
|
const products = await this.getAssignedProducts(technologyId);
|
|
3432
3416
|
const byBrand = {};
|
|
3433
3417
|
products.forEach((product) => {
|
|
3434
|
-
|
|
3418
|
+
const brandName = product.brandName || "Unknown";
|
|
3419
|
+
byBrand[brandName] = (byBrand[brandName] || 0) + 1;
|
|
3435
3420
|
});
|
|
3436
3421
|
return {
|
|
3437
3422
|
totalAssigned: products.length,
|
package/dist/index.d.mts
CHANGED
|
@@ -200,7 +200,6 @@ interface ContraindicationDynamic {
|
|
|
200
200
|
* @property manufacturer - Naziv proizvođača
|
|
201
201
|
* @property description - Detaljan opis brenda i njegovih proizvoda
|
|
202
202
|
* @property website - Web stranica brenda
|
|
203
|
-
* @property category - Kategorija brenda (npr. "laser", "peeling", "injectables") - za filtriranje
|
|
204
203
|
* @property isActive - Da li je brend aktivan u sistemu
|
|
205
204
|
* @property createdAt - Datum kreiranja
|
|
206
205
|
* @property updatedAt - Datum poslednjeg ažuriranja
|
|
@@ -215,7 +214,6 @@ interface Brand {
|
|
|
215
214
|
isActive: boolean;
|
|
216
215
|
website?: string;
|
|
217
216
|
description?: string;
|
|
218
|
-
category?: string;
|
|
219
217
|
}
|
|
220
218
|
|
|
221
219
|
/**
|
|
@@ -570,20 +568,15 @@ interface FilledDocumentFileValue {
|
|
|
570
568
|
|
|
571
569
|
/**
|
|
572
570
|
* Product used in procedures
|
|
573
|
-
*
|
|
571
|
+
* Simplified structure with only essential fields and flexible metadata
|
|
574
572
|
*
|
|
575
573
|
* @property id - Unique identifier of the product
|
|
576
574
|
* @property name - Name of the product
|
|
577
|
-
* @property brandId -
|
|
578
|
-
* @property brandName -
|
|
575
|
+
* @property brandId - Reference to the Brand document ID
|
|
576
|
+
* @property brandName - Display name of the brand (denormalized for performance)
|
|
577
|
+
* @property description - Detailed description of the product
|
|
579
578
|
* @property assignedTechnologyIds - Array of technology IDs this product is assigned to
|
|
580
|
-
* @property
|
|
581
|
-
* @property technicalDetails - Technical details and specifications
|
|
582
|
-
* @property warnings - List of warnings related to product use
|
|
583
|
-
* @property dosage - Dosage information (if applicable)
|
|
584
|
-
* @property composition - Product composition
|
|
585
|
-
* @property indications - List of indications for use
|
|
586
|
-
* @property contraindications - List of contraindications
|
|
579
|
+
* @property metadata - Flexible key-value pairs for additional product information
|
|
587
580
|
* @property isActive - Whether the product is active in the system
|
|
588
581
|
* @property createdAt - Creation date
|
|
589
582
|
* @property updatedAt - Last update date
|
|
@@ -593,17 +586,13 @@ interface Product {
|
|
|
593
586
|
name: string;
|
|
594
587
|
brandId: string;
|
|
595
588
|
brandName: string;
|
|
589
|
+
description: string;
|
|
590
|
+
category?: string;
|
|
596
591
|
assignedTechnologyIds?: string[];
|
|
592
|
+
metadata?: Record<string, string | number | boolean>;
|
|
593
|
+
isActive: boolean;
|
|
597
594
|
createdAt: Date;
|
|
598
595
|
updatedAt: Date;
|
|
599
|
-
isActive: boolean;
|
|
600
|
-
description?: string;
|
|
601
|
-
technicalDetails?: string;
|
|
602
|
-
warnings?: string[];
|
|
603
|
-
dosage?: string;
|
|
604
|
-
composition?: string;
|
|
605
|
-
indications?: string[];
|
|
606
|
-
contraindications?: ContraindicationDynamic[];
|
|
607
596
|
/** Present only in subcollections - synced from technology metadata */
|
|
608
597
|
technologyId?: string;
|
|
609
598
|
/** Present only in subcollections - synced from technology name */
|
|
@@ -622,11 +611,10 @@ interface Product {
|
|
|
622
611
|
interface IProductService {
|
|
623
612
|
/**
|
|
624
613
|
* Creates a new product in the top-level collection
|
|
625
|
-
* @param brandId - ID of the brand that manufactures this product
|
|
626
614
|
* @param product - Product data
|
|
627
615
|
* @param technologyIds - Optional array of technology IDs to assign this product to
|
|
628
616
|
*/
|
|
629
|
-
createTopLevel(
|
|
617
|
+
createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
630
618
|
/**
|
|
631
619
|
* Gets all products from the top-level collection
|
|
632
620
|
* @param options - Query options
|
|
@@ -635,6 +623,7 @@ interface IProductService {
|
|
|
635
623
|
rowsPerPage: number;
|
|
636
624
|
lastVisible?: any;
|
|
637
625
|
brandId?: string;
|
|
626
|
+
category?: string;
|
|
638
627
|
}): Promise<{
|
|
639
628
|
products: Product[];
|
|
640
629
|
lastVisible: any;
|
|
@@ -649,7 +638,7 @@ interface IProductService {
|
|
|
649
638
|
* @param productId - ID of the product to update
|
|
650
639
|
* @param product - Updated product data
|
|
651
640
|
*/
|
|
652
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'
|
|
641
|
+
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
|
|
653
642
|
/**
|
|
654
643
|
* Deletes a product from the top-level collection (soft delete)
|
|
655
644
|
* @param productId - ID of the product to delete
|
|
@@ -1166,26 +1155,23 @@ declare class BrandService extends BaseService {
|
|
|
1166
1155
|
name_lowercase: string;
|
|
1167
1156
|
manufacturer: string;
|
|
1168
1157
|
website?: string | undefined;
|
|
1169
|
-
category?: string | undefined;
|
|
1170
1158
|
id: string;
|
|
1171
1159
|
}>;
|
|
1172
1160
|
/**
|
|
1173
|
-
* Gets a paginated list of active brands, optionally filtered by name
|
|
1161
|
+
* Gets a paginated list of active brands, optionally filtered by name.
|
|
1174
1162
|
* @param rowsPerPage - The number of brands to fetch.
|
|
1175
1163
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1176
1164
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
1177
|
-
* @param category - An optional category to filter brands by.
|
|
1178
1165
|
*/
|
|
1179
|
-
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any
|
|
1166
|
+
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
|
|
1180
1167
|
brands: Brand[];
|
|
1181
1168
|
lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
|
|
1182
1169
|
}>;
|
|
1183
1170
|
/**
|
|
1184
|
-
* Gets the total count of active brands, optionally filtered by name
|
|
1171
|
+
* Gets the total count of active brands, optionally filtered by name.
|
|
1185
1172
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1186
|
-
* @param category - An optional category to filter brands by.
|
|
1187
1173
|
*/
|
|
1188
|
-
getBrandsCount(searchTerm?: string
|
|
1174
|
+
getBrandsCount(searchTerm?: string): Promise<number>;
|
|
1189
1175
|
/**
|
|
1190
1176
|
* Gets all active brands for filter dropdowns (not paginated).
|
|
1191
1177
|
*/
|
|
@@ -1692,7 +1678,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1692
1678
|
/**
|
|
1693
1679
|
* Creates a new product in the top-level collection
|
|
1694
1680
|
*/
|
|
1695
|
-
createTopLevel(
|
|
1681
|
+
createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
1696
1682
|
/**
|
|
1697
1683
|
* Gets all products from the top-level collection
|
|
1698
1684
|
*/
|
|
@@ -1700,6 +1686,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1700
1686
|
rowsPerPage: number;
|
|
1701
1687
|
lastVisible?: any;
|
|
1702
1688
|
brandId?: string;
|
|
1689
|
+
category?: string;
|
|
1703
1690
|
}): Promise<{
|
|
1704
1691
|
products: Product[];
|
|
1705
1692
|
lastVisible: any;
|
|
@@ -1711,7 +1698,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1711
1698
|
/**
|
|
1712
1699
|
* Updates a product in the top-level collection
|
|
1713
1700
|
*/
|
|
1714
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'
|
|
1701
|
+
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
|
|
1715
1702
|
/**
|
|
1716
1703
|
* Deletes a product from the top-level collection (soft delete)
|
|
1717
1704
|
*/
|
|
@@ -2221,15 +2208,15 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
|
|
|
2221
2208
|
description: string;
|
|
2222
2209
|
family: ProcedureFamily;
|
|
2223
2210
|
isActive: boolean;
|
|
2224
|
-
technicalDetails?: string | undefined;
|
|
2225
|
-
contraindications: ContraindicationDynamic[];
|
|
2226
2211
|
categoryId: string;
|
|
2227
2212
|
subcategoryId: string;
|
|
2213
|
+
technicalDetails?: string | undefined;
|
|
2228
2214
|
requirements: {
|
|
2229
2215
|
pre: Requirement[];
|
|
2230
2216
|
post: Requirement[];
|
|
2231
2217
|
};
|
|
2232
2218
|
blockingConditions: BlockingCondition[];
|
|
2219
|
+
contraindications: ContraindicationDynamic[];
|
|
2233
2220
|
benefits: TreatmentBenefitDynamic[];
|
|
2234
2221
|
certificationRequirement: CertificationRequirement;
|
|
2235
2222
|
documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -200,7 +200,6 @@ interface ContraindicationDynamic {
|
|
|
200
200
|
* @property manufacturer - Naziv proizvođača
|
|
201
201
|
* @property description - Detaljan opis brenda i njegovih proizvoda
|
|
202
202
|
* @property website - Web stranica brenda
|
|
203
|
-
* @property category - Kategorija brenda (npr. "laser", "peeling", "injectables") - za filtriranje
|
|
204
203
|
* @property isActive - Da li je brend aktivan u sistemu
|
|
205
204
|
* @property createdAt - Datum kreiranja
|
|
206
205
|
* @property updatedAt - Datum poslednjeg ažuriranja
|
|
@@ -215,7 +214,6 @@ interface Brand {
|
|
|
215
214
|
isActive: boolean;
|
|
216
215
|
website?: string;
|
|
217
216
|
description?: string;
|
|
218
|
-
category?: string;
|
|
219
217
|
}
|
|
220
218
|
|
|
221
219
|
/**
|
|
@@ -570,20 +568,15 @@ interface FilledDocumentFileValue {
|
|
|
570
568
|
|
|
571
569
|
/**
|
|
572
570
|
* Product used in procedures
|
|
573
|
-
*
|
|
571
|
+
* Simplified structure with only essential fields and flexible metadata
|
|
574
572
|
*
|
|
575
573
|
* @property id - Unique identifier of the product
|
|
576
574
|
* @property name - Name of the product
|
|
577
|
-
* @property brandId -
|
|
578
|
-
* @property brandName -
|
|
575
|
+
* @property brandId - Reference to the Brand document ID
|
|
576
|
+
* @property brandName - Display name of the brand (denormalized for performance)
|
|
577
|
+
* @property description - Detailed description of the product
|
|
579
578
|
* @property assignedTechnologyIds - Array of technology IDs this product is assigned to
|
|
580
|
-
* @property
|
|
581
|
-
* @property technicalDetails - Technical details and specifications
|
|
582
|
-
* @property warnings - List of warnings related to product use
|
|
583
|
-
* @property dosage - Dosage information (if applicable)
|
|
584
|
-
* @property composition - Product composition
|
|
585
|
-
* @property indications - List of indications for use
|
|
586
|
-
* @property contraindications - List of contraindications
|
|
579
|
+
* @property metadata - Flexible key-value pairs for additional product information
|
|
587
580
|
* @property isActive - Whether the product is active in the system
|
|
588
581
|
* @property createdAt - Creation date
|
|
589
582
|
* @property updatedAt - Last update date
|
|
@@ -593,17 +586,13 @@ interface Product {
|
|
|
593
586
|
name: string;
|
|
594
587
|
brandId: string;
|
|
595
588
|
brandName: string;
|
|
589
|
+
description: string;
|
|
590
|
+
category?: string;
|
|
596
591
|
assignedTechnologyIds?: string[];
|
|
592
|
+
metadata?: Record<string, string | number | boolean>;
|
|
593
|
+
isActive: boolean;
|
|
597
594
|
createdAt: Date;
|
|
598
595
|
updatedAt: Date;
|
|
599
|
-
isActive: boolean;
|
|
600
|
-
description?: string;
|
|
601
|
-
technicalDetails?: string;
|
|
602
|
-
warnings?: string[];
|
|
603
|
-
dosage?: string;
|
|
604
|
-
composition?: string;
|
|
605
|
-
indications?: string[];
|
|
606
|
-
contraindications?: ContraindicationDynamic[];
|
|
607
596
|
/** Present only in subcollections - synced from technology metadata */
|
|
608
597
|
technologyId?: string;
|
|
609
598
|
/** Present only in subcollections - synced from technology name */
|
|
@@ -622,11 +611,10 @@ interface Product {
|
|
|
622
611
|
interface IProductService {
|
|
623
612
|
/**
|
|
624
613
|
* Creates a new product in the top-level collection
|
|
625
|
-
* @param brandId - ID of the brand that manufactures this product
|
|
626
614
|
* @param product - Product data
|
|
627
615
|
* @param technologyIds - Optional array of technology IDs to assign this product to
|
|
628
616
|
*/
|
|
629
|
-
createTopLevel(
|
|
617
|
+
createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
630
618
|
/**
|
|
631
619
|
* Gets all products from the top-level collection
|
|
632
620
|
* @param options - Query options
|
|
@@ -635,6 +623,7 @@ interface IProductService {
|
|
|
635
623
|
rowsPerPage: number;
|
|
636
624
|
lastVisible?: any;
|
|
637
625
|
brandId?: string;
|
|
626
|
+
category?: string;
|
|
638
627
|
}): Promise<{
|
|
639
628
|
products: Product[];
|
|
640
629
|
lastVisible: any;
|
|
@@ -649,7 +638,7 @@ interface IProductService {
|
|
|
649
638
|
* @param productId - ID of the product to update
|
|
650
639
|
* @param product - Updated product data
|
|
651
640
|
*/
|
|
652
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'
|
|
641
|
+
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
|
|
653
642
|
/**
|
|
654
643
|
* Deletes a product from the top-level collection (soft delete)
|
|
655
644
|
* @param productId - ID of the product to delete
|
|
@@ -1166,26 +1155,23 @@ declare class BrandService extends BaseService {
|
|
|
1166
1155
|
name_lowercase: string;
|
|
1167
1156
|
manufacturer: string;
|
|
1168
1157
|
website?: string | undefined;
|
|
1169
|
-
category?: string | undefined;
|
|
1170
1158
|
id: string;
|
|
1171
1159
|
}>;
|
|
1172
1160
|
/**
|
|
1173
|
-
* Gets a paginated list of active brands, optionally filtered by name
|
|
1161
|
+
* Gets a paginated list of active brands, optionally filtered by name.
|
|
1174
1162
|
* @param rowsPerPage - The number of brands to fetch.
|
|
1175
1163
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1176
1164
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
1177
|
-
* @param category - An optional category to filter brands by.
|
|
1178
1165
|
*/
|
|
1179
|
-
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any
|
|
1166
|
+
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
|
|
1180
1167
|
brands: Brand[];
|
|
1181
1168
|
lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
|
|
1182
1169
|
}>;
|
|
1183
1170
|
/**
|
|
1184
|
-
* Gets the total count of active brands, optionally filtered by name
|
|
1171
|
+
* Gets the total count of active brands, optionally filtered by name.
|
|
1185
1172
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1186
|
-
* @param category - An optional category to filter brands by.
|
|
1187
1173
|
*/
|
|
1188
|
-
getBrandsCount(searchTerm?: string
|
|
1174
|
+
getBrandsCount(searchTerm?: string): Promise<number>;
|
|
1189
1175
|
/**
|
|
1190
1176
|
* Gets all active brands for filter dropdowns (not paginated).
|
|
1191
1177
|
*/
|
|
@@ -1692,7 +1678,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1692
1678
|
/**
|
|
1693
1679
|
* Creates a new product in the top-level collection
|
|
1694
1680
|
*/
|
|
1695
|
-
createTopLevel(
|
|
1681
|
+
createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
1696
1682
|
/**
|
|
1697
1683
|
* Gets all products from the top-level collection
|
|
1698
1684
|
*/
|
|
@@ -1700,6 +1686,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1700
1686
|
rowsPerPage: number;
|
|
1701
1687
|
lastVisible?: any;
|
|
1702
1688
|
brandId?: string;
|
|
1689
|
+
category?: string;
|
|
1703
1690
|
}): Promise<{
|
|
1704
1691
|
products: Product[];
|
|
1705
1692
|
lastVisible: any;
|
|
@@ -1711,7 +1698,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1711
1698
|
/**
|
|
1712
1699
|
* Updates a product in the top-level collection
|
|
1713
1700
|
*/
|
|
1714
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'
|
|
1701
|
+
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
|
|
1715
1702
|
/**
|
|
1716
1703
|
* Deletes a product from the top-level collection (soft delete)
|
|
1717
1704
|
*/
|
|
@@ -2221,15 +2208,15 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
|
|
|
2221
2208
|
description: string;
|
|
2222
2209
|
family: ProcedureFamily;
|
|
2223
2210
|
isActive: boolean;
|
|
2224
|
-
technicalDetails?: string | undefined;
|
|
2225
|
-
contraindications: ContraindicationDynamic[];
|
|
2226
2211
|
categoryId: string;
|
|
2227
2212
|
subcategoryId: string;
|
|
2213
|
+
technicalDetails?: string | undefined;
|
|
2228
2214
|
requirements: {
|
|
2229
2215
|
pre: Requirement[];
|
|
2230
2216
|
post: Requirement[];
|
|
2231
2217
|
};
|
|
2232
2218
|
blockingConditions: BlockingCondition[];
|
|
2219
|
+
contraindications: ContraindicationDynamic[];
|
|
2233
2220
|
benefits: TreatmentBenefitDynamic[];
|
|
2234
2221
|
certificationRequirement: CertificationRequirement;
|
|
2235
2222
|
documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
|