@blackcode_sa/metaestetics-api 1.14.23 → 1.14.27

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.
@@ -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
  */
@@ -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.website) != null ? _d : "",
315
- (_e = brand.description) != null ? _e : "",
316
- String((_f = brand.isActive) != null ? _f : "")
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.website) != null ? _d : "",
221
- (_e = brand.description) != null ? _e : "",
222
- String((_f = brand.isActive) != null ? _f : "")
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
  */
@@ -6301,13 +6306,14 @@ declare class PatientService extends BaseService {
6301
6306
  startAfter?: string;
6302
6307
  }): Promise<PatientProfileForDoctor[]>;
6303
6308
  /**
6304
- * Gets all patients associated with a specific clinic.
6309
+ * Gets all patients associated with a specific clinic, including sensitive info.
6310
+ * This merges data from PatientProfile and PatientSensitiveInfo subcollection.
6305
6311
  *
6306
6312
  * @param {string} clinicId - ID of the clinic whose patients to retrieve
6307
6313
  * @param {Object} options - Optional parameters for pagination
6308
6314
  * @param {number} options.limit - Maximum number of profiles to return
6309
6315
  * @param {string} options.startAfter - The ID of the document to start after (for pagination)
6310
- * @returns {Promise<PatientProfile[]>} A promise resolving to an array of patient profiles
6316
+ * @returns {Promise<PatientProfile[]>} A promise resolving to an array of patient profiles with merged sensitive info
6311
6317
  */
6312
6318
  getPatientsByClinic(clinicId: string, options?: {
6313
6319
  limit?: number;
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
  */
@@ -6301,13 +6306,14 @@ declare class PatientService extends BaseService {
6301
6306
  startAfter?: string;
6302
6307
  }): Promise<PatientProfileForDoctor[]>;
6303
6308
  /**
6304
- * Gets all patients associated with a specific clinic.
6309
+ * Gets all patients associated with a specific clinic, including sensitive info.
6310
+ * This merges data from PatientProfile and PatientSensitiveInfo subcollection.
6305
6311
  *
6306
6312
  * @param {string} clinicId - ID of the clinic whose patients to retrieve
6307
6313
  * @param {Object} options - Optional parameters for pagination
6308
6314
  * @param {number} options.limit - Maximum number of profiles to return
6309
6315
  * @param {string} options.startAfter - The ID of the document to start after (for pagination)
6310
- * @returns {Promise<PatientProfile[]>} A promise resolving to an array of patient profiles
6316
+ * @returns {Promise<PatientProfile[]>} A promise resolving to an array of patient profiles with merged sensitive info
6311
6317
  */
6312
6318
  getPatientsByClinic(clinicId: string, options?: {
6313
6319
  limit?: number;