@blackcode_sa/metaestetics-api 1.13.15 → 1.13.16
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 +15 -14
- package/dist/index.mjs +15 -14
- package/package.json +1 -1
- package/src/services/procedure/procedure.service.ts +45 -26
package/dist/index.js
CHANGED
|
@@ -21125,7 +21125,6 @@ var ProcedureService = class extends BaseService {
|
|
|
21125
21125
|
proceduresQuery = (0, import_firestore58.query)(proceduresCollection, (0, import_firestore58.orderBy)("name"));
|
|
21126
21126
|
}
|
|
21127
21127
|
const proceduresSnapshot = await (0, import_firestore58.getDocs)(proceduresQuery);
|
|
21128
|
-
const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
|
|
21129
21128
|
let procedures = proceduresSnapshot.docs.map((doc47) => {
|
|
21130
21129
|
const data = doc47.data();
|
|
21131
21130
|
return {
|
|
@@ -21137,9 +21136,10 @@ var ProcedureService = class extends BaseService {
|
|
|
21137
21136
|
if (excludeDraftPractitioners) {
|
|
21138
21137
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21139
21138
|
}
|
|
21139
|
+
const lastDocForPagination = pagination && pagination > 0 && proceduresSnapshot.docs.length < pagination ? null : proceduresSnapshot.docs.length > 0 ? proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1] : null;
|
|
21140
21140
|
return {
|
|
21141
21141
|
procedures,
|
|
21142
|
-
lastDoc:
|
|
21142
|
+
lastDoc: lastDocForPagination
|
|
21143
21143
|
};
|
|
21144
21144
|
} catch (error) {
|
|
21145
21145
|
console.error("[PROCEDURE_SERVICE] Error getting all procedures:", error);
|
|
@@ -21265,11 +21265,11 @@ var ProcedureService = class extends BaseService {
|
|
|
21265
21265
|
if (filters.excludeDraftPractitioners) {
|
|
21266
21266
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21267
21267
|
}
|
|
21268
|
-
|
|
21269
|
-
console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures`);
|
|
21268
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21270
21269
|
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21271
21270
|
return { procedures, lastDoc: null };
|
|
21272
21271
|
}
|
|
21272
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21273
21273
|
return { procedures, lastDoc };
|
|
21274
21274
|
} catch (error) {
|
|
21275
21275
|
console.log("[PROCEDURE_SERVICE] Strategy 1 failed:", error);
|
|
@@ -21308,11 +21308,11 @@ var ProcedureService = class extends BaseService {
|
|
|
21308
21308
|
if (filters.excludeDraftPractitioners) {
|
|
21309
21309
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21310
21310
|
}
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
if (procedures.length < (filters.pagination || 10)) {
|
|
21311
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 2 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21312
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21314
21313
|
return { procedures, lastDoc: null };
|
|
21315
21314
|
}
|
|
21315
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21316
21316
|
return { procedures, lastDoc };
|
|
21317
21317
|
} catch (error) {
|
|
21318
21318
|
console.log("[PROCEDURE_SERVICE] Strategy 2 failed:", error);
|
|
@@ -21392,13 +21392,14 @@ var ProcedureService = class extends BaseService {
|
|
|
21392
21392
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21393
21393
|
}
|
|
21394
21394
|
console.log("[PROCEDURE_SERVICE] After applyInMemoryFilters (Strategy 3):", {
|
|
21395
|
-
procedureCount: procedures.length
|
|
21395
|
+
procedureCount: procedures.length,
|
|
21396
|
+
queryDocCount: querySnapshot.docs.length
|
|
21396
21397
|
});
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
if (procedures.length < (filters.pagination || 10)) {
|
|
21398
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 3 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21399
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21400
21400
|
return { procedures, lastDoc: null };
|
|
21401
21401
|
}
|
|
21402
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21402
21403
|
return { procedures, lastDoc };
|
|
21403
21404
|
} catch (error) {
|
|
21404
21405
|
console.log("[PROCEDURE_SERVICE] Strategy 3 failed:", error);
|
|
@@ -21425,11 +21426,11 @@ var ProcedureService = class extends BaseService {
|
|
|
21425
21426
|
if (filters.excludeDraftPractitioners) {
|
|
21426
21427
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21427
21428
|
}
|
|
21428
|
-
|
|
21429
|
-
|
|
21430
|
-
if (procedures.length < (filters.pagination || 10)) {
|
|
21429
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 4 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21430
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21431
21431
|
return { procedures, lastDoc: null };
|
|
21432
21432
|
}
|
|
21433
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21433
21434
|
return { procedures, lastDoc };
|
|
21434
21435
|
} catch (error) {
|
|
21435
21436
|
console.log("[PROCEDURE_SERVICE] Strategy 4 failed:", error);
|
package/dist/index.mjs
CHANGED
|
@@ -21361,7 +21361,6 @@ var ProcedureService = class extends BaseService {
|
|
|
21361
21361
|
proceduresQuery = query33(proceduresCollection, orderBy18("name"));
|
|
21362
21362
|
}
|
|
21363
21363
|
const proceduresSnapshot = await getDocs33(proceduresQuery);
|
|
21364
|
-
const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
|
|
21365
21364
|
let procedures = proceduresSnapshot.docs.map((doc47) => {
|
|
21366
21365
|
const data = doc47.data();
|
|
21367
21366
|
return {
|
|
@@ -21373,9 +21372,10 @@ var ProcedureService = class extends BaseService {
|
|
|
21373
21372
|
if (excludeDraftPractitioners) {
|
|
21374
21373
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21375
21374
|
}
|
|
21375
|
+
const lastDocForPagination = pagination && pagination > 0 && proceduresSnapshot.docs.length < pagination ? null : proceduresSnapshot.docs.length > 0 ? proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1] : null;
|
|
21376
21376
|
return {
|
|
21377
21377
|
procedures,
|
|
21378
|
-
lastDoc:
|
|
21378
|
+
lastDoc: lastDocForPagination
|
|
21379
21379
|
};
|
|
21380
21380
|
} catch (error) {
|
|
21381
21381
|
console.error("[PROCEDURE_SERVICE] Error getting all procedures:", error);
|
|
@@ -21501,11 +21501,11 @@ var ProcedureService = class extends BaseService {
|
|
|
21501
21501
|
if (filters.excludeDraftPractitioners) {
|
|
21502
21502
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21503
21503
|
}
|
|
21504
|
-
|
|
21505
|
-
console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures`);
|
|
21504
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21506
21505
|
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21507
21506
|
return { procedures, lastDoc: null };
|
|
21508
21507
|
}
|
|
21508
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21509
21509
|
return { procedures, lastDoc };
|
|
21510
21510
|
} catch (error) {
|
|
21511
21511
|
console.log("[PROCEDURE_SERVICE] Strategy 1 failed:", error);
|
|
@@ -21544,11 +21544,11 @@ var ProcedureService = class extends BaseService {
|
|
|
21544
21544
|
if (filters.excludeDraftPractitioners) {
|
|
21545
21545
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21546
21546
|
}
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
if (procedures.length < (filters.pagination || 10)) {
|
|
21547
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 2 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21548
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21550
21549
|
return { procedures, lastDoc: null };
|
|
21551
21550
|
}
|
|
21551
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21552
21552
|
return { procedures, lastDoc };
|
|
21553
21553
|
} catch (error) {
|
|
21554
21554
|
console.log("[PROCEDURE_SERVICE] Strategy 2 failed:", error);
|
|
@@ -21628,13 +21628,14 @@ var ProcedureService = class extends BaseService {
|
|
|
21628
21628
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21629
21629
|
}
|
|
21630
21630
|
console.log("[PROCEDURE_SERVICE] After applyInMemoryFilters (Strategy 3):", {
|
|
21631
|
-
procedureCount: procedures.length
|
|
21631
|
+
procedureCount: procedures.length,
|
|
21632
|
+
queryDocCount: querySnapshot.docs.length
|
|
21632
21633
|
});
|
|
21633
|
-
|
|
21634
|
-
|
|
21635
|
-
if (procedures.length < (filters.pagination || 10)) {
|
|
21634
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 3 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21635
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21636
21636
|
return { procedures, lastDoc: null };
|
|
21637
21637
|
}
|
|
21638
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21638
21639
|
return { procedures, lastDoc };
|
|
21639
21640
|
} catch (error) {
|
|
21640
21641
|
console.log("[PROCEDURE_SERVICE] Strategy 3 failed:", error);
|
|
@@ -21661,11 +21662,11 @@ var ProcedureService = class extends BaseService {
|
|
|
21661
21662
|
if (filters.excludeDraftPractitioners) {
|
|
21662
21663
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
21663
21664
|
}
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
if (procedures.length < (filters.pagination || 10)) {
|
|
21665
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 4 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
21666
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
21667
21667
|
return { procedures, lastDoc: null };
|
|
21668
21668
|
}
|
|
21669
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
21669
21670
|
return { procedures, lastDoc };
|
|
21670
21671
|
} catch (error) {
|
|
21671
21672
|
console.log("[PROCEDURE_SERVICE] Strategy 4 failed:", error);
|
package/package.json
CHANGED
|
@@ -1465,7 +1465,6 @@ export class ProcedureService extends BaseService {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
|
|
1467
1467
|
const proceduresSnapshot = await getDocs(proceduresQuery);
|
|
1468
|
-
const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
|
|
1469
1468
|
|
|
1470
1469
|
let procedures = proceduresSnapshot.docs.map(doc => {
|
|
1471
1470
|
const data = doc.data() as Procedure;
|
|
@@ -1480,9 +1479,17 @@ export class ProcedureService extends BaseService {
|
|
|
1480
1479
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
1481
1480
|
}
|
|
1482
1481
|
|
|
1482
|
+
// Fix lastDoc - if we got fewer documents from Firestore than requested, no more pages
|
|
1483
|
+
const lastDocForPagination =
|
|
1484
|
+
pagination && pagination > 0 && proceduresSnapshot.docs.length < pagination
|
|
1485
|
+
? null
|
|
1486
|
+
: proceduresSnapshot.docs.length > 0
|
|
1487
|
+
? proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1]
|
|
1488
|
+
: null;
|
|
1489
|
+
|
|
1483
1490
|
return {
|
|
1484
1491
|
procedures,
|
|
1485
|
-
lastDoc:
|
|
1492
|
+
lastDoc: lastDocForPagination,
|
|
1486
1493
|
};
|
|
1487
1494
|
} catch (error) {
|
|
1488
1495
|
console.error('[PROCEDURE_SERVICE] Error getting all procedures:', error);
|
|
@@ -1657,17 +1664,20 @@ export class ProcedureService extends BaseService {
|
|
|
1657
1664
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
1658
1665
|
}
|
|
1659
1666
|
|
|
1660
|
-
|
|
1661
|
-
querySnapshot.docs.length > 0
|
|
1662
|
-
? querySnapshot.docs[querySnapshot.docs.length - 1]
|
|
1663
|
-
: null;
|
|
1667
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
1664
1668
|
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
// Fix Load More - ako je broj rezultata manji od pagination, nema više
|
|
1669
|
+
// Fix Load More - if we got fewer documents from Firestore than requested, no more pages
|
|
1668
1670
|
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
1669
1671
|
return { procedures, lastDoc: null };
|
|
1670
1672
|
}
|
|
1673
|
+
|
|
1674
|
+
// If we filtered out some procedures but got full query results, use last doc for pagination
|
|
1675
|
+
// This allows fetching more pages to get enough filtered results
|
|
1676
|
+
const lastDoc =
|
|
1677
|
+
querySnapshot.docs.length > 0
|
|
1678
|
+
? querySnapshot.docs[querySnapshot.docs.length - 1]
|
|
1679
|
+
: null;
|
|
1680
|
+
|
|
1671
1681
|
return { procedures, lastDoc };
|
|
1672
1682
|
} catch (error) {
|
|
1673
1683
|
console.log('[PROCEDURE_SERVICE] Strategy 1 failed:', error);
|
|
@@ -1719,17 +1729,19 @@ export class ProcedureService extends BaseService {
|
|
|
1719
1729
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
1720
1730
|
}
|
|
1721
1731
|
|
|
1732
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 2 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
1733
|
+
|
|
1734
|
+
// Fix Load More - if we got fewer documents from Firestore than requested, no more pages
|
|
1735
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
1736
|
+
return { procedures, lastDoc: null };
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
// If we filtered out some procedures but got full query results, use last doc for pagination
|
|
1722
1740
|
const lastDoc =
|
|
1723
1741
|
querySnapshot.docs.length > 0
|
|
1724
1742
|
? querySnapshot.docs[querySnapshot.docs.length - 1]
|
|
1725
1743
|
: null;
|
|
1726
|
-
|
|
1727
|
-
console.log(`[PROCEDURE_SERVICE] Strategy 2 success: ${procedures.length} procedures`);
|
|
1728
|
-
|
|
1729
|
-
// Fix Load More - ako je broj rezultata manji od pagination, nema više
|
|
1730
|
-
if (procedures.length < (filters.pagination || 10)) {
|
|
1731
|
-
return { procedures, lastDoc: null };
|
|
1732
|
-
}
|
|
1744
|
+
|
|
1733
1745
|
return { procedures, lastDoc };
|
|
1734
1746
|
} catch (error) {
|
|
1735
1747
|
console.log('[PROCEDURE_SERVICE] Strategy 2 failed:', error);
|
|
@@ -1836,16 +1848,20 @@ export class ProcedureService extends BaseService {
|
|
|
1836
1848
|
|
|
1837
1849
|
console.log('[PROCEDURE_SERVICE] After applyInMemoryFilters (Strategy 3):', {
|
|
1838
1850
|
procedureCount: procedures.length,
|
|
1851
|
+
queryDocCount: querySnapshot.docs.length,
|
|
1839
1852
|
});
|
|
1840
1853
|
|
|
1841
|
-
|
|
1842
|
-
querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
1843
|
-
console.log(`[PROCEDURE_SERVICE] Strategy 3 success: ${procedures.length} procedures`);
|
|
1854
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 3 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
1844
1855
|
|
|
1845
|
-
// Fix Load More -
|
|
1846
|
-
if (
|
|
1856
|
+
// Fix Load More - if we got fewer documents from Firestore than requested, no more pages
|
|
1857
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
1847
1858
|
return { procedures, lastDoc: null };
|
|
1848
1859
|
}
|
|
1860
|
+
|
|
1861
|
+
// If we filtered out some procedures but got full query results, use last doc for pagination
|
|
1862
|
+
const lastDoc =
|
|
1863
|
+
querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
1864
|
+
|
|
1849
1865
|
return { procedures, lastDoc };
|
|
1850
1866
|
} catch (error) {
|
|
1851
1867
|
console.log('[PROCEDURE_SERVICE] Strategy 3 failed:', error);
|
|
@@ -1880,14 +1896,17 @@ export class ProcedureService extends BaseService {
|
|
|
1880
1896
|
procedures = await this.filterDraftPractitionerProcedures(procedures);
|
|
1881
1897
|
}
|
|
1882
1898
|
|
|
1883
|
-
|
|
1884
|
-
querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
1885
|
-
console.log(`[PROCEDURE_SERVICE] Strategy 4 success: ${procedures.length} procedures`);
|
|
1899
|
+
console.log(`[PROCEDURE_SERVICE] Strategy 4 success: ${procedures.length} procedures (${querySnapshot.docs.length} from query)`);
|
|
1886
1900
|
|
|
1887
|
-
// Fix Load More -
|
|
1888
|
-
if (
|
|
1901
|
+
// Fix Load More - if we got fewer documents from Firestore than requested, no more pages
|
|
1902
|
+
if (querySnapshot.docs.length < (filters.pagination || 10)) {
|
|
1889
1903
|
return { procedures, lastDoc: null };
|
|
1890
1904
|
}
|
|
1905
|
+
|
|
1906
|
+
// If we filtered out some procedures but got full query results, use last doc for pagination
|
|
1907
|
+
const lastDoc =
|
|
1908
|
+
querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
1909
|
+
|
|
1891
1910
|
return { procedures, lastDoc };
|
|
1892
1911
|
} catch (error) {
|
|
1893
1912
|
console.log('[PROCEDURE_SERVICE] Strategy 4 failed:', error);
|