@iservice365/module-hygiene 1.5.1 → 1.6.0
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +30 -27
- package/dist/index.js +31 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -147,6 +147,7 @@ function useAreaRepo() {
|
|
|
147
147
|
page = 1,
|
|
148
148
|
limit = 10,
|
|
149
149
|
search = "",
|
|
150
|
+
type = "all",
|
|
150
151
|
site
|
|
151
152
|
}) {
|
|
152
153
|
page = page > 0 ? page - 1 : 0;
|
|
@@ -164,6 +165,10 @@ function useAreaRepo() {
|
|
|
164
165
|
} catch (error) {
|
|
165
166
|
throw new BadRequestError2("Invalid site ID format.");
|
|
166
167
|
}
|
|
168
|
+
if (type && type !== "all") {
|
|
169
|
+
query.type = type;
|
|
170
|
+
cacheOptions.type = type;
|
|
171
|
+
}
|
|
167
172
|
if (search) {
|
|
168
173
|
query.$or = [{ name: { $regex: search, $options: "i" } }];
|
|
169
174
|
cacheOptions.search = search;
|
|
@@ -656,6 +661,7 @@ function useAreaController() {
|
|
|
656
661
|
page: Joi2.number().min(1).optional().allow("", null),
|
|
657
662
|
limit: Joi2.number().min(1).optional().allow("", null),
|
|
658
663
|
search: Joi2.string().optional().allow("", null),
|
|
664
|
+
type: Joi2.string().valid("all", ...allowedTypes).optional().allow("", null),
|
|
659
665
|
site: Joi2.string().hex().required()
|
|
660
666
|
});
|
|
661
667
|
const { error } = validation.validate(query);
|
|
@@ -667,12 +673,14 @@ function useAreaController() {
|
|
|
667
673
|
const page = parseInt(req.query.page) ?? 1;
|
|
668
674
|
const limit = parseInt(req.query.limit) ?? 10;
|
|
669
675
|
const search = req.query.search ?? "";
|
|
676
|
+
const type = req.query.type ?? "all";
|
|
670
677
|
const site = req.params.site ?? "";
|
|
671
678
|
try {
|
|
672
679
|
const data = await _getAreas({
|
|
673
680
|
page,
|
|
674
681
|
limit,
|
|
675
682
|
search,
|
|
683
|
+
type,
|
|
676
684
|
site
|
|
677
685
|
});
|
|
678
686
|
res.json(data);
|
|
@@ -1433,7 +1441,8 @@ function useParentChecklistRepo() {
|
|
|
1433
1441
|
search = "",
|
|
1434
1442
|
site,
|
|
1435
1443
|
startDate = "",
|
|
1436
|
-
endDate = ""
|
|
1444
|
+
endDate = "",
|
|
1445
|
+
status = "all"
|
|
1437
1446
|
}) {
|
|
1438
1447
|
page = page > 0 ? page - 1 : 0;
|
|
1439
1448
|
const query = {};
|
|
@@ -1466,6 +1475,10 @@ function useParentChecklistRepo() {
|
|
|
1466
1475
|
query.createdAt = { $lte: new Date(endDate) };
|
|
1467
1476
|
cacheOptions.endDate = new Date(endDate).toISOString().split("T")[0];
|
|
1468
1477
|
}
|
|
1478
|
+
if (status && status !== "all") {
|
|
1479
|
+
query.status = status;
|
|
1480
|
+
cacheOptions.status = status;
|
|
1481
|
+
}
|
|
1469
1482
|
const cacheKey = makeCacheKey3(namespace_collection, cacheOptions);
|
|
1470
1483
|
const cachedData = await getCache(cacheKey);
|
|
1471
1484
|
if (cachedData) {
|
|
@@ -1622,7 +1635,8 @@ function useParentChecklistController() {
|
|
|
1622
1635
|
search: Joi6.string().optional().allow("", null),
|
|
1623
1636
|
site: Joi6.string().hex().required(),
|
|
1624
1637
|
startDate: Joi6.alternatives().try(Joi6.date(), Joi6.string()).optional().allow("", null),
|
|
1625
|
-
endDate: Joi6.alternatives().try(Joi6.date(), Joi6.string()).optional().allow("", null)
|
|
1638
|
+
endDate: Joi6.alternatives().try(Joi6.date(), Joi6.string()).optional().allow("", null),
|
|
1639
|
+
status: Joi6.string().valid(...allowedStatus, "all").optional().allow("", null)
|
|
1626
1640
|
});
|
|
1627
1641
|
const { error } = validation.validate(query);
|
|
1628
1642
|
if (error) {
|
|
@@ -1636,6 +1650,7 @@ function useParentChecklistController() {
|
|
|
1636
1650
|
const site = req.params.site ?? "";
|
|
1637
1651
|
const startDate = req.query.startDate ?? "";
|
|
1638
1652
|
const endDate = req.query.endDate ?? "";
|
|
1653
|
+
const status = req.query.status ?? "all";
|
|
1639
1654
|
try {
|
|
1640
1655
|
const data = await _getAllParentChecklist({
|
|
1641
1656
|
page,
|
|
@@ -1643,7 +1658,8 @@ function useParentChecklistController() {
|
|
|
1643
1658
|
search,
|
|
1644
1659
|
site,
|
|
1645
1660
|
startDate,
|
|
1646
|
-
endDate
|
|
1661
|
+
endDate,
|
|
1662
|
+
status
|
|
1647
1663
|
});
|
|
1648
1664
|
res.json(data);
|
|
1649
1665
|
return;
|
|
@@ -1822,7 +1838,8 @@ function useAreaChecklistRepo() {
|
|
|
1822
1838
|
page = 1,
|
|
1823
1839
|
limit = 10,
|
|
1824
1840
|
search = "",
|
|
1825
|
-
type,
|
|
1841
|
+
type = "all",
|
|
1842
|
+
status = "all",
|
|
1826
1843
|
schedule
|
|
1827
1844
|
}, session) {
|
|
1828
1845
|
page = page > 0 ? page - 1 : 0;
|
|
@@ -1837,10 +1854,14 @@ function useAreaChecklistRepo() {
|
|
|
1837
1854
|
} catch (error) {
|
|
1838
1855
|
throw new BadRequestError13("Invalid parent checklist ID format.");
|
|
1839
1856
|
}
|
|
1840
|
-
if (type) {
|
|
1857
|
+
if (type && type !== "all") {
|
|
1841
1858
|
query.type = type;
|
|
1842
1859
|
cacheOptions.type = type;
|
|
1843
1860
|
}
|
|
1861
|
+
if (status && status !== "all") {
|
|
1862
|
+
query.status = status;
|
|
1863
|
+
cacheOptions.status = status;
|
|
1864
|
+
}
|
|
1844
1865
|
if (search) {
|
|
1845
1866
|
query.$text = { $search: search };
|
|
1846
1867
|
cacheOptions.search = search;
|
|
@@ -2607,7 +2628,8 @@ function useAreaChecklistController() {
|
|
|
2607
2628
|
page: Joi8.number().min(1).optional().allow("", null),
|
|
2608
2629
|
limit: Joi8.number().min(1).optional().allow("", null),
|
|
2609
2630
|
search: Joi8.string().optional().allow("", null),
|
|
2610
|
-
type: Joi8.string().optional().allow("",
|
|
2631
|
+
type: Joi8.string().valid(...allowedTypes, "all").optional().allow("", null),
|
|
2632
|
+
status: Joi8.string().valid(...allowedStatus, "all").optional().allow("", null),
|
|
2611
2633
|
schedule: Joi8.string().hex().required()
|
|
2612
2634
|
});
|
|
2613
2635
|
const { error } = validation.validate(query);
|
|
@@ -2619,7 +2641,8 @@ function useAreaChecklistController() {
|
|
|
2619
2641
|
const page = parseInt(req.query.page) ?? 1;
|
|
2620
2642
|
const limit = parseInt(req.query.limit) ?? 10;
|
|
2621
2643
|
const search = req.query.search ?? "";
|
|
2622
|
-
const type = req.query.type ?? "";
|
|
2644
|
+
const type = req.query.type ?? "all";
|
|
2645
|
+
const status = req.query.status ?? "all";
|
|
2623
2646
|
const schedule = req.params.schedule ?? "";
|
|
2624
2647
|
try {
|
|
2625
2648
|
const data = await _getAllAreaChecklist({
|
|
@@ -2627,6 +2650,7 @@ function useAreaChecklistController() {
|
|
|
2627
2650
|
limit,
|
|
2628
2651
|
search,
|
|
2629
2652
|
type,
|
|
2653
|
+
status,
|
|
2630
2654
|
schedule
|
|
2631
2655
|
});
|
|
2632
2656
|
res.json(data);
|