@blackcode_sa/metaestetics-api 1.8.17 → 1.8.18
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/index.js +21 -0
- package/dist/index.mjs +21 -0
- package/package.json +1 -1
- package/src/services/practitioner/practitioner.service.ts +31 -0
package/dist/index.js
CHANGED
|
@@ -6964,6 +6964,27 @@ var PractitionerService = class extends BaseService {
|
|
|
6964
6964
|
} catch (error) {
|
|
6965
6965
|
console.log("[PRACTITIONER_SERVICE] Strategy 3 failed:", error);
|
|
6966
6966
|
}
|
|
6967
|
+
try {
|
|
6968
|
+
console.log("[PRACTITIONER_SERVICE] Strategy 4: Client-side filtering fallback");
|
|
6969
|
+
const constraints = [
|
|
6970
|
+
(0, import_firestore21.where)("isActive", "==", true),
|
|
6971
|
+
(0, import_firestore21.where)("status", "==", "active" /* ACTIVE */),
|
|
6972
|
+
(0, import_firestore21.orderBy)("createdAt", "desc"),
|
|
6973
|
+
(0, import_firestore21.limit)(filters.pagination || 10)
|
|
6974
|
+
];
|
|
6975
|
+
const q = (0, import_firestore21.query)((0, import_firestore21.collection)(this.db, PRACTITIONERS_COLLECTION), ...constraints);
|
|
6976
|
+
const querySnapshot = await (0, import_firestore21.getDocs)(q);
|
|
6977
|
+
let practitioners = querySnapshot.docs.map((doc37) => ({ ...doc37.data(), id: doc37.id }));
|
|
6978
|
+
practitioners = this.applyInMemoryFilters(practitioners, filters);
|
|
6979
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
6980
|
+
console.log(`[PRACTITIONER_SERVICE] Strategy 4 success: ${practitioners.length} practitioners`);
|
|
6981
|
+
if (practitioners.length < (filters.pagination || 10)) {
|
|
6982
|
+
return { practitioners, lastDoc: null };
|
|
6983
|
+
}
|
|
6984
|
+
return { practitioners, lastDoc };
|
|
6985
|
+
} catch (error) {
|
|
6986
|
+
console.log("[PRACTITIONER_SERVICE] Strategy 4 failed:", error);
|
|
6987
|
+
}
|
|
6967
6988
|
console.log("[PRACTITIONER_SERVICE] All strategies failed, returning empty result");
|
|
6968
6989
|
return { practitioners: [], lastDoc: null };
|
|
6969
6990
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -7010,6 +7010,27 @@ var PractitionerService = class extends BaseService {
|
|
|
7010
7010
|
} catch (error) {
|
|
7011
7011
|
console.log("[PRACTITIONER_SERVICE] Strategy 3 failed:", error);
|
|
7012
7012
|
}
|
|
7013
|
+
try {
|
|
7014
|
+
console.log("[PRACTITIONER_SERVICE] Strategy 4: Client-side filtering fallback");
|
|
7015
|
+
const constraints = [
|
|
7016
|
+
where10("isActive", "==", true),
|
|
7017
|
+
where10("status", "==", "active" /* ACTIVE */),
|
|
7018
|
+
orderBy4("createdAt", "desc"),
|
|
7019
|
+
limit7(filters.pagination || 10)
|
|
7020
|
+
];
|
|
7021
|
+
const q = query10(collection10(this.db, PRACTITIONERS_COLLECTION), ...constraints);
|
|
7022
|
+
const querySnapshot = await getDocs10(q);
|
|
7023
|
+
let practitioners = querySnapshot.docs.map((doc37) => ({ ...doc37.data(), id: doc37.id }));
|
|
7024
|
+
practitioners = this.applyInMemoryFilters(practitioners, filters);
|
|
7025
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
7026
|
+
console.log(`[PRACTITIONER_SERVICE] Strategy 4 success: ${practitioners.length} practitioners`);
|
|
7027
|
+
if (practitioners.length < (filters.pagination || 10)) {
|
|
7028
|
+
return { practitioners, lastDoc: null };
|
|
7029
|
+
}
|
|
7030
|
+
return { practitioners, lastDoc };
|
|
7031
|
+
} catch (error) {
|
|
7032
|
+
console.log("[PRACTITIONER_SERVICE] Strategy 4 failed:", error);
|
|
7033
|
+
}
|
|
7013
7034
|
console.log("[PRACTITIONER_SERVICE] All strategies failed, returning empty result");
|
|
7014
7035
|
return { practitioners: [], lastDoc: null };
|
|
7015
7036
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1215,6 +1215,37 @@ export class PractitionerService extends BaseService {
|
|
|
1215
1215
|
console.log("[PRACTITIONER_SERVICE] Strategy 3 failed:", error);
|
|
1216
1216
|
}
|
|
1217
1217
|
|
|
1218
|
+
// Strategy 4: Client-side filtering fallback (kao u procedure/clinic services)
|
|
1219
|
+
try {
|
|
1220
|
+
console.log("[PRACTITIONER_SERVICE] Strategy 4: Client-side filtering fallback");
|
|
1221
|
+
|
|
1222
|
+
const constraints: any[] = [
|
|
1223
|
+
where("isActive", "==", true),
|
|
1224
|
+
where("status", "==", PractitionerStatus.ACTIVE),
|
|
1225
|
+
orderBy("createdAt", "desc"),
|
|
1226
|
+
limit(filters.pagination || 10)
|
|
1227
|
+
];
|
|
1228
|
+
|
|
1229
|
+
const q = query(collection(this.db, PRACTITIONERS_COLLECTION), ...constraints);
|
|
1230
|
+
const querySnapshot = await getDocs(q);
|
|
1231
|
+
let practitioners = querySnapshot.docs.map(doc => ({ ...doc.data(), id: doc.id } as Practitioner));
|
|
1232
|
+
|
|
1233
|
+
// Apply all client-side filters using centralized function
|
|
1234
|
+
practitioners = this.applyInMemoryFilters(practitioners, filters);
|
|
1235
|
+
|
|
1236
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
1237
|
+
console.log(`[PRACTITIONER_SERVICE] Strategy 4 success: ${practitioners.length} practitioners`);
|
|
1238
|
+
|
|
1239
|
+
// Fix Load More - ako je broj rezultata manji od pagination, nema više
|
|
1240
|
+
if (practitioners.length < (filters.pagination || 10)) {
|
|
1241
|
+
return { practitioners, lastDoc: null };
|
|
1242
|
+
}
|
|
1243
|
+
return { practitioners, lastDoc };
|
|
1244
|
+
|
|
1245
|
+
} catch (error) {
|
|
1246
|
+
console.log("[PRACTITIONER_SERVICE] Strategy 4 failed:", error);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1218
1249
|
// All strategies failed
|
|
1219
1250
|
console.log("[PRACTITIONER_SERVICE] All strategies failed, returning empty result");
|
|
1220
1251
|
return { practitioners: [], lastDoc: null };
|