@7365admin1/module-hygiene 4.16.0 → 4.17.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 +4 -8
- package/dist/index.js +8 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2744,8 +2744,7 @@ var areaChecklistSchema = Joi8.object({
|
|
|
2744
2744
|
isScheduleTask: Joi8.boolean().optional().default(false),
|
|
2745
2745
|
scheduleTaskId: Joi8.string().hex().optional().allow(null)
|
|
2746
2746
|
}).required()
|
|
2747
|
-
).optional().default([])
|
|
2748
|
-
createdBy: Joi8.string().hex().required()
|
|
2747
|
+
).optional().default([])
|
|
2749
2748
|
});
|
|
2750
2749
|
function MAreaChecklist(value) {
|
|
2751
2750
|
const { error } = areaChecklistSchema.validate(value);
|
|
@@ -2786,13 +2785,6 @@ function MAreaChecklist(value) {
|
|
|
2786
2785
|
};
|
|
2787
2786
|
});
|
|
2788
2787
|
}
|
|
2789
|
-
if (value.createdBy) {
|
|
2790
|
-
try {
|
|
2791
|
-
value.createdBy = new ObjectId8(value.createdBy);
|
|
2792
|
-
} catch (error2) {
|
|
2793
|
-
throw new BadRequestError14("Invalid createdBy ID format.");
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2796
2788
|
return {
|
|
2797
2789
|
schedule: value.schedule,
|
|
2798
2790
|
serviceType: value.serviceType,
|
|
@@ -2801,7 +2793,6 @@ function MAreaChecklist(value) {
|
|
|
2801
2793
|
type: value.type,
|
|
2802
2794
|
checklist: value.checklist || [],
|
|
2803
2795
|
status: "open",
|
|
2804
|
-
createdBy: value.createdBy,
|
|
2805
2796
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2806
2797
|
completedAt: "",
|
|
2807
2798
|
updatedAt: ""
|
|
@@ -2956,32 +2947,6 @@ function useAreaChecklistRepo() {
|
|
|
2956
2947
|
try {
|
|
2957
2948
|
const pipeline = [
|
|
2958
2949
|
{ $match: query },
|
|
2959
|
-
{
|
|
2960
|
-
$lookup: {
|
|
2961
|
-
from: "users",
|
|
2962
|
-
let: { createdById: "$createdBy" },
|
|
2963
|
-
pipeline: [
|
|
2964
|
-
{
|
|
2965
|
-
$match: {
|
|
2966
|
-
$expr: {
|
|
2967
|
-
$and: [
|
|
2968
|
-
{ $ne: ["$$createdById", ""] },
|
|
2969
|
-
{ $eq: ["$_id", "$$createdById"] }
|
|
2970
|
-
]
|
|
2971
|
-
}
|
|
2972
|
-
}
|
|
2973
|
-
},
|
|
2974
|
-
{ $project: { name: 1 } }
|
|
2975
|
-
],
|
|
2976
|
-
as: "createdByDoc"
|
|
2977
|
-
}
|
|
2978
|
-
},
|
|
2979
|
-
{
|
|
2980
|
-
$unwind: {
|
|
2981
|
-
path: "$createdByDoc",
|
|
2982
|
-
preserveNullAndEmptyArrays: true
|
|
2983
|
-
}
|
|
2984
|
-
},
|
|
2985
2950
|
{
|
|
2986
2951
|
$addFields: {
|
|
2987
2952
|
statusOrder: {
|
|
@@ -3033,8 +2998,7 @@ function useAreaChecklistRepo() {
|
|
|
3033
2998
|
},
|
|
3034
2999
|
else: 0
|
|
3035
3000
|
}
|
|
3036
|
-
}
|
|
3037
|
-
createdByName: "$createdByDoc.name"
|
|
3001
|
+
}
|
|
3038
3002
|
}
|
|
3039
3003
|
},
|
|
3040
3004
|
{ $skip: page * limit },
|
|
@@ -4088,8 +4052,7 @@ function useAreaChecklistService() {
|
|
|
4088
4052
|
unit: unit.unit.toString(),
|
|
4089
4053
|
name: unit.name
|
|
4090
4054
|
}))
|
|
4091
|
-
}))
|
|
4092
|
-
createdBy: value.createdBy
|
|
4055
|
+
}))
|
|
4093
4056
|
};
|
|
4094
4057
|
const insertedId = await _createAreaChecklist(checklistData);
|
|
4095
4058
|
totalChecklistsCreated++;
|
|
@@ -4450,16 +4413,13 @@ function useAreaChecklistController() {
|
|
|
4450
4413
|
(acc, [key, value2]) => ({ ...acc, [key]: value2 }),
|
|
4451
4414
|
{}
|
|
4452
4415
|
) : {};
|
|
4453
|
-
const createdBy = cookies["user"] || "";
|
|
4454
4416
|
const payload = {
|
|
4455
4417
|
site: req.params.site,
|
|
4456
|
-
schedule: req.params.schedule
|
|
4457
|
-
createdBy
|
|
4418
|
+
schedule: req.params.schedule
|
|
4458
4419
|
};
|
|
4459
4420
|
const validation = Joi9.object({
|
|
4460
4421
|
site: Joi9.string().hex().required(),
|
|
4461
|
-
schedule: Joi9.string().hex().required()
|
|
4462
|
-
createdBy: Joi9.string().hex().required()
|
|
4422
|
+
schedule: Joi9.string().hex().required()
|
|
4463
4423
|
});
|
|
4464
4424
|
const { error, value } = validation.validate(payload);
|
|
4465
4425
|
if (error) {
|
|
@@ -6031,8 +5991,7 @@ var scheduleTaskSchema = Joi16.object({
|
|
|
6031
5991
|
name: Joi16.string().required(),
|
|
6032
5992
|
value: Joi16.any().required()
|
|
6033
5993
|
})
|
|
6034
|
-
).required()
|
|
6035
|
-
createdBy: Joi16.string().hex().required()
|
|
5994
|
+
).required()
|
|
6036
5995
|
});
|
|
6037
5996
|
function MScheduleTask(value) {
|
|
6038
5997
|
const { error } = scheduleTaskSchema.validate(value);
|
|
@@ -6059,13 +6018,6 @@ function MScheduleTask(value) {
|
|
|
6059
6018
|
}
|
|
6060
6019
|
});
|
|
6061
6020
|
}
|
|
6062
|
-
if (value.createdBy) {
|
|
6063
|
-
try {
|
|
6064
|
-
value.createdBy = new ObjectId18(value.createdBy);
|
|
6065
|
-
} catch (error2) {
|
|
6066
|
-
throw new BadRequestError28("Invalid createdBy ID format.");
|
|
6067
|
-
}
|
|
6068
|
-
}
|
|
6069
6021
|
return {
|
|
6070
6022
|
site: value.site,
|
|
6071
6023
|
serviceType: value.serviceType,
|
|
@@ -6075,7 +6027,6 @@ function MScheduleTask(value) {
|
|
|
6075
6027
|
description: value.description,
|
|
6076
6028
|
areas: value.areas,
|
|
6077
6029
|
status: "active",
|
|
6078
|
-
createdBy: value.createdBy,
|
|
6079
6030
|
createdAt: /* @__PURE__ */ new Date(),
|
|
6080
6031
|
updatedAt: "",
|
|
6081
6032
|
deletedAt: ""
|
|
@@ -6597,8 +6548,7 @@ function useScheduleTaskService() {
|
|
|
6597
6548
|
area: areaId,
|
|
6598
6549
|
name: area.name,
|
|
6599
6550
|
type: areaDetails.type || "common",
|
|
6600
|
-
checklist: schedTaskSets
|
|
6601
|
-
createdBy: scheduleTask.createdBy
|
|
6551
|
+
checklist: schedTaskSets
|
|
6602
6552
|
};
|
|
6603
6553
|
logger32.info(
|
|
6604
6554
|
`Area ${area.name} (${areaId}): Creating new area checklist with schedule-task sets only`
|
|
@@ -6653,12 +6603,7 @@ function useScheduleTaskController() {
|
|
|
6653
6603
|
deleteScheduleTask: _deleteScheduleTask
|
|
6654
6604
|
} = useScheduleTaskRepository();
|
|
6655
6605
|
async function createScheduleTask(req, res, next) {
|
|
6656
|
-
const
|
|
6657
|
-
(acc, [key, value]) => ({ ...acc, [key]: value }),
|
|
6658
|
-
{}
|
|
6659
|
-
) : {};
|
|
6660
|
-
const createdBy = cookies["user"] || "";
|
|
6661
|
-
const payload = { ...req.body, ...req.params, createdBy };
|
|
6606
|
+
const payload = { ...req.body, ...req.params };
|
|
6662
6607
|
const { error } = scheduleTaskSchema.validate(payload);
|
|
6663
6608
|
if (error) {
|
|
6664
6609
|
logger33.log({ level: "error", message: error.message });
|