@blackcode_sa/metaestetics-api 1.14.23 → 1.14.26
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 +9 -4
- package/dist/backoffice/index.d.ts +9 -4
- package/dist/backoffice/index.js +18 -8
- package/dist/backoffice/index.mjs +18 -8
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +18 -8
- package/dist/index.mjs +18 -8
- package/package.json +4 -1
- package/src/backoffice/services/brand.service.ts +21 -4
- package/src/backoffice/types/brand.types.ts +2 -0
|
@@ -14,6 +14,7 @@ import { z } from 'zod';
|
|
|
14
14
|
* @property manufacturer - Naziv proizvođača
|
|
15
15
|
* @property description - Detaljan opis brenda i njegovih proizvoda
|
|
16
16
|
* @property website - Web stranica brenda
|
|
17
|
+
* @property category - Kategorija brenda (npr. "laser", "peeling", "injectables") - za filtriranje
|
|
17
18
|
* @property isActive - Da li je brend aktivan u sistemu
|
|
18
19
|
* @property createdAt - Datum kreiranja
|
|
19
20
|
* @property updatedAt - Datum poslednjeg ažuriranja
|
|
@@ -28,6 +29,7 @@ interface Brand {
|
|
|
28
29
|
isActive: boolean;
|
|
29
30
|
website?: string;
|
|
30
31
|
description?: string;
|
|
32
|
+
category?: string;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Kolekcija u Firestore bazi gde se čuvaju brendovi
|
|
@@ -65,23 +67,26 @@ declare class BrandService extends BaseService {
|
|
|
65
67
|
isActive: boolean;
|
|
66
68
|
website?: string | undefined;
|
|
67
69
|
description?: string | undefined;
|
|
70
|
+
category?: string | undefined;
|
|
68
71
|
id: string;
|
|
69
72
|
}>;
|
|
70
73
|
/**
|
|
71
|
-
* Gets a paginated list of active brands, optionally filtered by name.
|
|
74
|
+
* Gets a paginated list of active brands, optionally filtered by name and category.
|
|
72
75
|
* @param rowsPerPage - The number of brands to fetch.
|
|
73
76
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
74
77
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
78
|
+
* @param category - An optional category to filter brands by.
|
|
75
79
|
*/
|
|
76
|
-
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
|
|
80
|
+
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any, category?: string): Promise<{
|
|
77
81
|
brands: Brand[];
|
|
78
82
|
lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
|
|
79
83
|
}>;
|
|
80
84
|
/**
|
|
81
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
85
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
82
86
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
87
|
+
* @param category - An optional category to filter brands by.
|
|
83
88
|
*/
|
|
84
|
-
getBrandsCount(searchTerm?: string): Promise<number>;
|
|
89
|
+
getBrandsCount(searchTerm?: string, category?: string): Promise<number>;
|
|
85
90
|
/**
|
|
86
91
|
* Gets all active brands for filter dropdowns (not paginated).
|
|
87
92
|
*/
|
|
@@ -14,6 +14,7 @@ import { z } from 'zod';
|
|
|
14
14
|
* @property manufacturer - Naziv proizvođača
|
|
15
15
|
* @property description - Detaljan opis brenda i njegovih proizvoda
|
|
16
16
|
* @property website - Web stranica brenda
|
|
17
|
+
* @property category - Kategorija brenda (npr. "laser", "peeling", "injectables") - za filtriranje
|
|
17
18
|
* @property isActive - Da li je brend aktivan u sistemu
|
|
18
19
|
* @property createdAt - Datum kreiranja
|
|
19
20
|
* @property updatedAt - Datum poslednjeg ažuriranja
|
|
@@ -28,6 +29,7 @@ interface Brand {
|
|
|
28
29
|
isActive: boolean;
|
|
29
30
|
website?: string;
|
|
30
31
|
description?: string;
|
|
32
|
+
category?: string;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Kolekcija u Firestore bazi gde se čuvaju brendovi
|
|
@@ -65,23 +67,26 @@ declare class BrandService extends BaseService {
|
|
|
65
67
|
isActive: boolean;
|
|
66
68
|
website?: string | undefined;
|
|
67
69
|
description?: string | undefined;
|
|
70
|
+
category?: string | undefined;
|
|
68
71
|
id: string;
|
|
69
72
|
}>;
|
|
70
73
|
/**
|
|
71
|
-
* Gets a paginated list of active brands, optionally filtered by name.
|
|
74
|
+
* Gets a paginated list of active brands, optionally filtered by name and category.
|
|
72
75
|
* @param rowsPerPage - The number of brands to fetch.
|
|
73
76
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
74
77
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
78
|
+
* @param category - An optional category to filter brands by.
|
|
75
79
|
*/
|
|
76
|
-
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
|
|
80
|
+
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any, category?: string): Promise<{
|
|
77
81
|
brands: Brand[];
|
|
78
82
|
lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
|
|
79
83
|
}>;
|
|
80
84
|
/**
|
|
81
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
85
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
82
86
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
87
|
+
* @param category - An optional category to filter brands by.
|
|
83
88
|
*/
|
|
84
|
-
getBrandsCount(searchTerm?: string): Promise<number>;
|
|
89
|
+
getBrandsCount(searchTerm?: string, category?: string): Promise<number>;
|
|
85
90
|
/**
|
|
86
91
|
* Gets all active brands for filter dropdowns (not paginated).
|
|
87
92
|
*/
|
package/dist/backoffice/index.js
CHANGED
|
@@ -162,12 +162,13 @@ 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 and category.
|
|
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.
|
|
169
170
|
*/
|
|
170
|
-
async getAll(rowsPerPage, searchTerm, lastVisible) {
|
|
171
|
+
async getAll(rowsPerPage, searchTerm, lastVisible, category) {
|
|
171
172
|
const constraints = [
|
|
172
173
|
(0, import_firestore.where)("isActive", "==", true),
|
|
173
174
|
(0, import_firestore.orderBy)("name_lowercase")
|
|
@@ -179,6 +180,9 @@ var BrandService = class extends BaseService {
|
|
|
179
180
|
(0, import_firestore.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
180
181
|
);
|
|
181
182
|
}
|
|
183
|
+
if (category) {
|
|
184
|
+
constraints.push((0, import_firestore.where)("category", "==", category));
|
|
185
|
+
}
|
|
182
186
|
if (lastVisible) {
|
|
183
187
|
constraints.push((0, import_firestore.startAfter)(lastVisible));
|
|
184
188
|
}
|
|
@@ -195,10 +199,11 @@ var BrandService = class extends BaseService {
|
|
|
195
199
|
return { brands, lastVisible: newLastVisible };
|
|
196
200
|
}
|
|
197
201
|
/**
|
|
198
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
202
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
199
203
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
204
|
+
* @param category - An optional category to filter brands by.
|
|
200
205
|
*/
|
|
201
|
-
async getBrandsCount(searchTerm) {
|
|
206
|
+
async getBrandsCount(searchTerm, category) {
|
|
202
207
|
const constraints = [(0, import_firestore.where)("isActive", "==", true)];
|
|
203
208
|
if (searchTerm) {
|
|
204
209
|
const lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
@@ -207,6 +212,9 @@ var BrandService = class extends BaseService {
|
|
|
207
212
|
(0, import_firestore.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
208
213
|
);
|
|
209
214
|
}
|
|
215
|
+
if (category) {
|
|
216
|
+
constraints.push((0, import_firestore.where)("category", "==", category));
|
|
217
|
+
}
|
|
210
218
|
const q = (0, import_firestore.query)(this.getBrandsRef(), ...constraints);
|
|
211
219
|
const snapshot = await (0, import_firestore.getCountFromServer)(q);
|
|
212
220
|
return snapshot.data().count;
|
|
@@ -276,6 +284,7 @@ var BrandService = class extends BaseService {
|
|
|
276
284
|
"id",
|
|
277
285
|
"name",
|
|
278
286
|
"manufacturer",
|
|
287
|
+
"category",
|
|
279
288
|
"website",
|
|
280
289
|
"description",
|
|
281
290
|
"isActive"
|
|
@@ -306,14 +315,15 @@ var BrandService = class extends BaseService {
|
|
|
306
315
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
307
316
|
}
|
|
308
317
|
brandToCsvRow(brand) {
|
|
309
|
-
var _a, _b, _c, _d, _e, _f;
|
|
318
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
310
319
|
const values = [
|
|
311
320
|
(_a = brand.id) != null ? _a : "",
|
|
312
321
|
(_b = brand.name) != null ? _b : "",
|
|
313
322
|
(_c = brand.manufacturer) != null ? _c : "",
|
|
314
|
-
(_d = brand.
|
|
315
|
-
(_e = brand.
|
|
316
|
-
|
|
323
|
+
(_d = brand.category) != null ? _d : "",
|
|
324
|
+
(_e = brand.website) != null ? _e : "",
|
|
325
|
+
(_f = brand.description) != null ? _f : "",
|
|
326
|
+
String((_g = brand.isActive) != null ? _g : "")
|
|
317
327
|
];
|
|
318
328
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
319
329
|
}
|
|
@@ -68,12 +68,13 @@ 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 and category.
|
|
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.
|
|
75
76
|
*/
|
|
76
|
-
async getAll(rowsPerPage, searchTerm, lastVisible) {
|
|
77
|
+
async getAll(rowsPerPage, searchTerm, lastVisible, category) {
|
|
77
78
|
const constraints = [
|
|
78
79
|
where("isActive", "==", true),
|
|
79
80
|
orderBy("name_lowercase")
|
|
@@ -85,6 +86,9 @@ var BrandService = class extends BaseService {
|
|
|
85
86
|
where("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
86
87
|
);
|
|
87
88
|
}
|
|
89
|
+
if (category) {
|
|
90
|
+
constraints.push(where("category", "==", category));
|
|
91
|
+
}
|
|
88
92
|
if (lastVisible) {
|
|
89
93
|
constraints.push(startAfter(lastVisible));
|
|
90
94
|
}
|
|
@@ -101,10 +105,11 @@ var BrandService = class extends BaseService {
|
|
|
101
105
|
return { brands, lastVisible: newLastVisible };
|
|
102
106
|
}
|
|
103
107
|
/**
|
|
104
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
108
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
105
109
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
110
|
+
* @param category - An optional category to filter brands by.
|
|
106
111
|
*/
|
|
107
|
-
async getBrandsCount(searchTerm) {
|
|
112
|
+
async getBrandsCount(searchTerm, category) {
|
|
108
113
|
const constraints = [where("isActive", "==", true)];
|
|
109
114
|
if (searchTerm) {
|
|
110
115
|
const lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
@@ -113,6 +118,9 @@ var BrandService = class extends BaseService {
|
|
|
113
118
|
where("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
114
119
|
);
|
|
115
120
|
}
|
|
121
|
+
if (category) {
|
|
122
|
+
constraints.push(where("category", "==", category));
|
|
123
|
+
}
|
|
116
124
|
const q = query(this.getBrandsRef(), ...constraints);
|
|
117
125
|
const snapshot = await getCountFromServer(q);
|
|
118
126
|
return snapshot.data().count;
|
|
@@ -182,6 +190,7 @@ var BrandService = class extends BaseService {
|
|
|
182
190
|
"id",
|
|
183
191
|
"name",
|
|
184
192
|
"manufacturer",
|
|
193
|
+
"category",
|
|
185
194
|
"website",
|
|
186
195
|
"description",
|
|
187
196
|
"isActive"
|
|
@@ -212,14 +221,15 @@ var BrandService = class extends BaseService {
|
|
|
212
221
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
213
222
|
}
|
|
214
223
|
brandToCsvRow(brand) {
|
|
215
|
-
var _a, _b, _c, _d, _e, _f;
|
|
224
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
216
225
|
const values = [
|
|
217
226
|
(_a = brand.id) != null ? _a : "",
|
|
218
227
|
(_b = brand.name) != null ? _b : "",
|
|
219
228
|
(_c = brand.manufacturer) != null ? _c : "",
|
|
220
|
-
(_d = brand.
|
|
221
|
-
(_e = brand.
|
|
222
|
-
|
|
229
|
+
(_d = brand.category) != null ? _d : "",
|
|
230
|
+
(_e = brand.website) != null ? _e : "",
|
|
231
|
+
(_f = brand.description) != null ? _f : "",
|
|
232
|
+
String((_g = brand.isActive) != null ? _g : "")
|
|
223
233
|
];
|
|
224
234
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
225
235
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -200,6 +200,7 @@ 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
|
|
203
204
|
* @property isActive - Da li je brend aktivan u sistemu
|
|
204
205
|
* @property createdAt - Datum kreiranja
|
|
205
206
|
* @property updatedAt - Datum poslednjeg ažuriranja
|
|
@@ -214,6 +215,7 @@ interface Brand {
|
|
|
214
215
|
isActive: boolean;
|
|
215
216
|
website?: string;
|
|
216
217
|
description?: string;
|
|
218
|
+
category?: string;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
/**
|
|
@@ -1164,23 +1166,26 @@ declare class BrandService extends BaseService {
|
|
|
1164
1166
|
name_lowercase: string;
|
|
1165
1167
|
manufacturer: string;
|
|
1166
1168
|
website?: string | undefined;
|
|
1169
|
+
category?: string | undefined;
|
|
1167
1170
|
id: string;
|
|
1168
1171
|
}>;
|
|
1169
1172
|
/**
|
|
1170
|
-
* Gets a paginated list of active brands, optionally filtered by name.
|
|
1173
|
+
* Gets a paginated list of active brands, optionally filtered by name and category.
|
|
1171
1174
|
* @param rowsPerPage - The number of brands to fetch.
|
|
1172
1175
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1173
1176
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
1177
|
+
* @param category - An optional category to filter brands by.
|
|
1174
1178
|
*/
|
|
1175
|
-
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
|
|
1179
|
+
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any, category?: string): Promise<{
|
|
1176
1180
|
brands: Brand[];
|
|
1177
1181
|
lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
|
|
1178
1182
|
}>;
|
|
1179
1183
|
/**
|
|
1180
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
1184
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
1181
1185
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1186
|
+
* @param category - An optional category to filter brands by.
|
|
1182
1187
|
*/
|
|
1183
|
-
getBrandsCount(searchTerm?: string): Promise<number>;
|
|
1188
|
+
getBrandsCount(searchTerm?: string, category?: string): Promise<number>;
|
|
1184
1189
|
/**
|
|
1185
1190
|
* Gets all active brands for filter dropdowns (not paginated).
|
|
1186
1191
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -200,6 +200,7 @@ 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
|
|
203
204
|
* @property isActive - Da li je brend aktivan u sistemu
|
|
204
205
|
* @property createdAt - Datum kreiranja
|
|
205
206
|
* @property updatedAt - Datum poslednjeg ažuriranja
|
|
@@ -214,6 +215,7 @@ interface Brand {
|
|
|
214
215
|
isActive: boolean;
|
|
215
216
|
website?: string;
|
|
216
217
|
description?: string;
|
|
218
|
+
category?: string;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
/**
|
|
@@ -1164,23 +1166,26 @@ declare class BrandService extends BaseService {
|
|
|
1164
1166
|
name_lowercase: string;
|
|
1165
1167
|
manufacturer: string;
|
|
1166
1168
|
website?: string | undefined;
|
|
1169
|
+
category?: string | undefined;
|
|
1167
1170
|
id: string;
|
|
1168
1171
|
}>;
|
|
1169
1172
|
/**
|
|
1170
|
-
* Gets a paginated list of active brands, optionally filtered by name.
|
|
1173
|
+
* Gets a paginated list of active brands, optionally filtered by name and category.
|
|
1171
1174
|
* @param rowsPerPage - The number of brands to fetch.
|
|
1172
1175
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1173
1176
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
1177
|
+
* @param category - An optional category to filter brands by.
|
|
1174
1178
|
*/
|
|
1175
|
-
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
|
|
1179
|
+
getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any, category?: string): Promise<{
|
|
1176
1180
|
brands: Brand[];
|
|
1177
1181
|
lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
|
|
1178
1182
|
}>;
|
|
1179
1183
|
/**
|
|
1180
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
1184
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
1181
1185
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
1186
|
+
* @param category - An optional category to filter brands by.
|
|
1182
1187
|
*/
|
|
1183
|
-
getBrandsCount(searchTerm?: string): Promise<number>;
|
|
1188
|
+
getBrandsCount(searchTerm?: string, category?: string): Promise<number>;
|
|
1184
1189
|
/**
|
|
1185
1190
|
* Gets all active brands for filter dropdowns (not paginated).
|
|
1186
1191
|
*/
|
package/dist/index.js
CHANGED
|
@@ -23276,12 +23276,13 @@ var BrandService = class extends BaseService {
|
|
|
23276
23276
|
return { id: docRef.id, ...newBrand };
|
|
23277
23277
|
}
|
|
23278
23278
|
/**
|
|
23279
|
-
* Gets a paginated list of active brands, optionally filtered by name.
|
|
23279
|
+
* Gets a paginated list of active brands, optionally filtered by name and category.
|
|
23280
23280
|
* @param rowsPerPage - The number of brands to fetch.
|
|
23281
23281
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
23282
23282
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
23283
|
+
* @param category - An optional category to filter brands by.
|
|
23283
23284
|
*/
|
|
23284
|
-
async getAll(rowsPerPage, searchTerm, lastVisible) {
|
|
23285
|
+
async getAll(rowsPerPage, searchTerm, lastVisible, category) {
|
|
23285
23286
|
const constraints = [
|
|
23286
23287
|
(0, import_firestore61.where)("isActive", "==", true),
|
|
23287
23288
|
(0, import_firestore61.orderBy)("name_lowercase")
|
|
@@ -23293,6 +23294,9 @@ var BrandService = class extends BaseService {
|
|
|
23293
23294
|
(0, import_firestore61.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
23294
23295
|
);
|
|
23295
23296
|
}
|
|
23297
|
+
if (category) {
|
|
23298
|
+
constraints.push((0, import_firestore61.where)("category", "==", category));
|
|
23299
|
+
}
|
|
23296
23300
|
if (lastVisible) {
|
|
23297
23301
|
constraints.push((0, import_firestore61.startAfter)(lastVisible));
|
|
23298
23302
|
}
|
|
@@ -23309,10 +23313,11 @@ var BrandService = class extends BaseService {
|
|
|
23309
23313
|
return { brands, lastVisible: newLastVisible };
|
|
23310
23314
|
}
|
|
23311
23315
|
/**
|
|
23312
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
23316
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
23313
23317
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
23318
|
+
* @param category - An optional category to filter brands by.
|
|
23314
23319
|
*/
|
|
23315
|
-
async getBrandsCount(searchTerm) {
|
|
23320
|
+
async getBrandsCount(searchTerm, category) {
|
|
23316
23321
|
const constraints = [(0, import_firestore61.where)("isActive", "==", true)];
|
|
23317
23322
|
if (searchTerm) {
|
|
23318
23323
|
const lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
@@ -23321,6 +23326,9 @@ var BrandService = class extends BaseService {
|
|
|
23321
23326
|
(0, import_firestore61.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
23322
23327
|
);
|
|
23323
23328
|
}
|
|
23329
|
+
if (category) {
|
|
23330
|
+
constraints.push((0, import_firestore61.where)("category", "==", category));
|
|
23331
|
+
}
|
|
23324
23332
|
const q = (0, import_firestore61.query)(this.getBrandsRef(), ...constraints);
|
|
23325
23333
|
const snapshot = await (0, import_firestore61.getCountFromServer)(q);
|
|
23326
23334
|
return snapshot.data().count;
|
|
@@ -23390,6 +23398,7 @@ var BrandService = class extends BaseService {
|
|
|
23390
23398
|
"id",
|
|
23391
23399
|
"name",
|
|
23392
23400
|
"manufacturer",
|
|
23401
|
+
"category",
|
|
23393
23402
|
"website",
|
|
23394
23403
|
"description",
|
|
23395
23404
|
"isActive"
|
|
@@ -23420,14 +23429,15 @@ var BrandService = class extends BaseService {
|
|
|
23420
23429
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
23421
23430
|
}
|
|
23422
23431
|
brandToCsvRow(brand) {
|
|
23423
|
-
var _a, _b, _c, _d, _e, _f;
|
|
23432
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
23424
23433
|
const values = [
|
|
23425
23434
|
(_a = brand.id) != null ? _a : "",
|
|
23426
23435
|
(_b = brand.name) != null ? _b : "",
|
|
23427
23436
|
(_c = brand.manufacturer) != null ? _c : "",
|
|
23428
|
-
(_d = brand.
|
|
23429
|
-
(_e = brand.
|
|
23430
|
-
|
|
23437
|
+
(_d = brand.category) != null ? _d : "",
|
|
23438
|
+
(_e = brand.website) != null ? _e : "",
|
|
23439
|
+
(_f = brand.description) != null ? _f : "",
|
|
23440
|
+
String((_g = brand.isActive) != null ? _g : "")
|
|
23431
23441
|
];
|
|
23432
23442
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
23433
23443
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -23535,12 +23535,13 @@ var BrandService = class extends BaseService {
|
|
|
23535
23535
|
return { id: docRef.id, ...newBrand };
|
|
23536
23536
|
}
|
|
23537
23537
|
/**
|
|
23538
|
-
* Gets a paginated list of active brands, optionally filtered by name.
|
|
23538
|
+
* Gets a paginated list of active brands, optionally filtered by name and category.
|
|
23539
23539
|
* @param rowsPerPage - The number of brands to fetch.
|
|
23540
23540
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
23541
23541
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
23542
|
+
* @param category - An optional category to filter brands by.
|
|
23542
23543
|
*/
|
|
23543
|
-
async getAll(rowsPerPage, searchTerm, lastVisible) {
|
|
23544
|
+
async getAll(rowsPerPage, searchTerm, lastVisible, category) {
|
|
23544
23545
|
const constraints = [
|
|
23545
23546
|
where35("isActive", "==", true),
|
|
23546
23547
|
orderBy19("name_lowercase")
|
|
@@ -23552,6 +23553,9 @@ var BrandService = class extends BaseService {
|
|
|
23552
23553
|
where35("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
23553
23554
|
);
|
|
23554
23555
|
}
|
|
23556
|
+
if (category) {
|
|
23557
|
+
constraints.push(where35("category", "==", category));
|
|
23558
|
+
}
|
|
23555
23559
|
if (lastVisible) {
|
|
23556
23560
|
constraints.push(startAfter15(lastVisible));
|
|
23557
23561
|
}
|
|
@@ -23568,10 +23572,11 @@ var BrandService = class extends BaseService {
|
|
|
23568
23572
|
return { brands, lastVisible: newLastVisible };
|
|
23569
23573
|
}
|
|
23570
23574
|
/**
|
|
23571
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
23575
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
23572
23576
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
23577
|
+
* @param category - An optional category to filter brands by.
|
|
23573
23578
|
*/
|
|
23574
|
-
async getBrandsCount(searchTerm) {
|
|
23579
|
+
async getBrandsCount(searchTerm, category) {
|
|
23575
23580
|
const constraints = [where35("isActive", "==", true)];
|
|
23576
23581
|
if (searchTerm) {
|
|
23577
23582
|
const lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
@@ -23580,6 +23585,9 @@ var BrandService = class extends BaseService {
|
|
|
23580
23585
|
where35("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
|
|
23581
23586
|
);
|
|
23582
23587
|
}
|
|
23588
|
+
if (category) {
|
|
23589
|
+
constraints.push(where35("category", "==", category));
|
|
23590
|
+
}
|
|
23583
23591
|
const q = query35(this.getBrandsRef(), ...constraints);
|
|
23584
23592
|
const snapshot = await getCountFromServer3(q);
|
|
23585
23593
|
return snapshot.data().count;
|
|
@@ -23649,6 +23657,7 @@ var BrandService = class extends BaseService {
|
|
|
23649
23657
|
"id",
|
|
23650
23658
|
"name",
|
|
23651
23659
|
"manufacturer",
|
|
23660
|
+
"category",
|
|
23652
23661
|
"website",
|
|
23653
23662
|
"description",
|
|
23654
23663
|
"isActive"
|
|
@@ -23679,14 +23688,15 @@ var BrandService = class extends BaseService {
|
|
|
23679
23688
|
return includeBom ? "\uFEFF" + csvBody : csvBody;
|
|
23680
23689
|
}
|
|
23681
23690
|
brandToCsvRow(brand) {
|
|
23682
|
-
var _a, _b, _c, _d, _e, _f;
|
|
23691
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
23683
23692
|
const values = [
|
|
23684
23693
|
(_a = brand.id) != null ? _a : "",
|
|
23685
23694
|
(_b = brand.name) != null ? _b : "",
|
|
23686
23695
|
(_c = brand.manufacturer) != null ? _c : "",
|
|
23687
|
-
(_d = brand.
|
|
23688
|
-
(_e = brand.
|
|
23689
|
-
|
|
23696
|
+
(_d = brand.category) != null ? _d : "",
|
|
23697
|
+
(_e = brand.website) != null ? _e : "",
|
|
23698
|
+
(_f = brand.description) != null ? _f : "",
|
|
23699
|
+
String((_g = brand.isActive) != null ? _g : "")
|
|
23690
23700
|
];
|
|
23691
23701
|
return values.map((v) => this.formatCsvValue(v)).join(",");
|
|
23692
23702
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackcode_sa/metaestetics-api",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.26",
|
|
5
5
|
"description": "Firebase authentication service with anonymous upgrade support",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -117,5 +117,8 @@
|
|
|
117
117
|
"setupFilesAfterEnv": [
|
|
118
118
|
"<rootDir>/jest.setup.ts"
|
|
119
119
|
]
|
|
120
|
+
},
|
|
121
|
+
"overrides": {
|
|
122
|
+
"node-forge": ">=1.3.2"
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -46,12 +46,18 @@ export class BrandService extends BaseService {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* Gets a paginated list of active brands, optionally filtered by name.
|
|
49
|
+
* Gets a paginated list of active brands, optionally filtered by name and category.
|
|
50
50
|
* @param rowsPerPage - The number of brands to fetch.
|
|
51
51
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
52
52
|
* @param lastVisible - An optional document snapshot to use as a cursor for pagination.
|
|
53
|
+
* @param category - An optional category to filter brands by.
|
|
53
54
|
*/
|
|
54
|
-
async getAll(
|
|
55
|
+
async getAll(
|
|
56
|
+
rowsPerPage: number,
|
|
57
|
+
searchTerm?: string,
|
|
58
|
+
lastVisible?: any,
|
|
59
|
+
category?: string
|
|
60
|
+
) {
|
|
55
61
|
const constraints: QueryConstraint[] = [
|
|
56
62
|
where("isActive", "==", true),
|
|
57
63
|
orderBy("name_lowercase"),
|
|
@@ -65,6 +71,10 @@ export class BrandService extends BaseService {
|
|
|
65
71
|
);
|
|
66
72
|
}
|
|
67
73
|
|
|
74
|
+
if (category) {
|
|
75
|
+
constraints.push(where("category", "==", category));
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
if (lastVisible) {
|
|
69
79
|
constraints.push(startAfter(lastVisible));
|
|
70
80
|
}
|
|
@@ -87,10 +97,11 @@ export class BrandService extends BaseService {
|
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
/**
|
|
90
|
-
* Gets the total count of active brands, optionally filtered by name.
|
|
100
|
+
* Gets the total count of active brands, optionally filtered by name and category.
|
|
91
101
|
* @param searchTerm - An optional string to filter brand names by (starts-with search).
|
|
102
|
+
* @param category - An optional category to filter brands by.
|
|
92
103
|
*/
|
|
93
|
-
async getBrandsCount(searchTerm?: string) {
|
|
104
|
+
async getBrandsCount(searchTerm?: string, category?: string) {
|
|
94
105
|
const constraints: QueryConstraint[] = [where("isActive", "==", true)];
|
|
95
106
|
|
|
96
107
|
if (searchTerm) {
|
|
@@ -101,6 +112,10 @@ export class BrandService extends BaseService {
|
|
|
101
112
|
);
|
|
102
113
|
}
|
|
103
114
|
|
|
115
|
+
if (category) {
|
|
116
|
+
constraints.push(where("category", "==", category));
|
|
117
|
+
}
|
|
118
|
+
|
|
104
119
|
const q = query(this.getBrandsRef(), ...constraints);
|
|
105
120
|
const snapshot = await getCountFromServer(q);
|
|
106
121
|
return snapshot.data().count;
|
|
@@ -184,6 +199,7 @@ export class BrandService extends BaseService {
|
|
|
184
199
|
"id",
|
|
185
200
|
"name",
|
|
186
201
|
"manufacturer",
|
|
202
|
+
"category",
|
|
187
203
|
"website",
|
|
188
204
|
"description",
|
|
189
205
|
"isActive",
|
|
@@ -230,6 +246,7 @@ export class BrandService extends BaseService {
|
|
|
230
246
|
brand.id ?? "",
|
|
231
247
|
brand.name ?? "",
|
|
232
248
|
brand.manufacturer ?? "",
|
|
249
|
+
brand.category ?? "",
|
|
233
250
|
brand.website ?? "",
|
|
234
251
|
brand.description ?? "",
|
|
235
252
|
String(brand.isActive ?? ""),
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @property manufacturer - Naziv proizvođača
|
|
8
8
|
* @property description - Detaljan opis brenda i njegovih proizvoda
|
|
9
9
|
* @property website - Web stranica brenda
|
|
10
|
+
* @property category - Kategorija brenda (npr. "laser", "peeling", "injectables") - za filtriranje
|
|
10
11
|
* @property isActive - Da li je brend aktivan u sistemu
|
|
11
12
|
* @property createdAt - Datum kreiranja
|
|
12
13
|
* @property updatedAt - Datum poslednjeg ažuriranja
|
|
@@ -21,6 +22,7 @@ export interface Brand {
|
|
|
21
22
|
isActive: boolean;
|
|
22
23
|
website?: string;
|
|
23
24
|
description?: string;
|
|
25
|
+
category?: string;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|