@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/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -256,7 +256,6 @@ type TCleaningScheduleArea = {
|
|
|
256
256
|
type: (typeof allowedTypes)[number];
|
|
257
257
|
checklist: TAreaChecklist[];
|
|
258
258
|
status?: (typeof allowedStatus)[number];
|
|
259
|
-
createdBy?: string | ObjectId;
|
|
260
259
|
createdAt?: Date | string;
|
|
261
260
|
completedAt?: Date | string;
|
|
262
261
|
updatedAt?: Date | string;
|
|
@@ -279,8 +278,8 @@ type TAreaChecklistUnits = {
|
|
|
279
278
|
completedBy?: string | ObjectId;
|
|
280
279
|
timestamp?: Date | string;
|
|
281
280
|
};
|
|
282
|
-
type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule" | "serviceType" | "area" | "name" | "type" | "checklist"
|
|
283
|
-
type TAreaChecklistBatchCreate = Pick<TCleaningScheduleArea, "schedule"
|
|
281
|
+
type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule" | "serviceType" | "area" | "name" | "type" | "checklist">;
|
|
282
|
+
type TAreaChecklistBatchCreate = Pick<TCleaningScheduleArea, "schedule"> & {
|
|
284
283
|
site: string | ObjectId;
|
|
285
284
|
};
|
|
286
285
|
type TCleaningScheduleAreaGetQuery = {
|
|
@@ -301,7 +300,6 @@ declare function MAreaChecklist(value: TAreaChecklistCreate): {
|
|
|
301
300
|
type: string;
|
|
302
301
|
checklist: TAreaChecklist[];
|
|
303
302
|
status: string;
|
|
304
|
-
createdBy: string | ObjectId | undefined;
|
|
305
303
|
createdAt: Date;
|
|
306
304
|
completedAt: string;
|
|
307
305
|
updatedAt: string;
|
|
@@ -576,18 +574,17 @@ type TScheduleTask = {
|
|
|
576
574
|
value: ObjectId;
|
|
577
575
|
}[];
|
|
578
576
|
status?: "active" | "deleted";
|
|
579
|
-
createdBy: string | ObjectId;
|
|
580
577
|
createdAt?: string | Date;
|
|
581
578
|
updatedAt?: string | Date;
|
|
582
579
|
deletedAt?: string | Date;
|
|
583
580
|
};
|
|
584
|
-
type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "serviceType" | "title" | "time" | "dates" | "description" | "areas"
|
|
581
|
+
type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "serviceType" | "title" | "time" | "dates" | "description" | "areas">;
|
|
585
582
|
type TScheduleTaskGetQuery = {
|
|
586
583
|
page?: number;
|
|
587
584
|
limit?: number;
|
|
588
585
|
search?: string;
|
|
589
586
|
} & Pick<TScheduleTask, "site" | "serviceType">;
|
|
590
|
-
type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas" | "status" | "
|
|
587
|
+
type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas" | "status" | "createdAt">;
|
|
591
588
|
type TScheduleTaskUpdate = Partial<Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas">>;
|
|
592
589
|
declare const scheduleTaskSchema: Joi.ObjectSchema<any>;
|
|
593
590
|
declare function MScheduleTask(value: TScheduleTaskCreate): {
|
|
@@ -602,7 +599,6 @@ declare function MScheduleTask(value: TScheduleTaskCreate): {
|
|
|
602
599
|
value: ObjectId;
|
|
603
600
|
}[];
|
|
604
601
|
status: string;
|
|
605
|
-
createdBy: string | ObjectId;
|
|
606
602
|
createdAt: Date;
|
|
607
603
|
updatedAt: string;
|
|
608
604
|
deletedAt: string;
|
package/dist/index.js
CHANGED
|
@@ -2788,8 +2788,7 @@ var areaChecklistSchema = import_joi8.default.object({
|
|
|
2788
2788
|
isScheduleTask: import_joi8.default.boolean().optional().default(false),
|
|
2789
2789
|
scheduleTaskId: import_joi8.default.string().hex().optional().allow(null)
|
|
2790
2790
|
}).required()
|
|
2791
|
-
).optional().default([])
|
|
2792
|
-
createdBy: import_joi8.default.string().hex().required()
|
|
2791
|
+
).optional().default([])
|
|
2793
2792
|
});
|
|
2794
2793
|
function MAreaChecklist(value) {
|
|
2795
2794
|
const { error } = areaChecklistSchema.validate(value);
|
|
@@ -2830,13 +2829,6 @@ function MAreaChecklist(value) {
|
|
|
2830
2829
|
};
|
|
2831
2830
|
});
|
|
2832
2831
|
}
|
|
2833
|
-
if (value.createdBy) {
|
|
2834
|
-
try {
|
|
2835
|
-
value.createdBy = new import_mongodb8.ObjectId(value.createdBy);
|
|
2836
|
-
} catch (error2) {
|
|
2837
|
-
throw new import_node_server_utils16.BadRequestError("Invalid createdBy ID format.");
|
|
2838
|
-
}
|
|
2839
|
-
}
|
|
2840
2832
|
return {
|
|
2841
2833
|
schedule: value.schedule,
|
|
2842
2834
|
serviceType: value.serviceType,
|
|
@@ -2845,7 +2837,6 @@ function MAreaChecklist(value) {
|
|
|
2845
2837
|
type: value.type,
|
|
2846
2838
|
checklist: value.checklist || [],
|
|
2847
2839
|
status: "open",
|
|
2848
|
-
createdBy: value.createdBy,
|
|
2849
2840
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2850
2841
|
completedAt: "",
|
|
2851
2842
|
updatedAt: ""
|
|
@@ -2988,32 +2979,6 @@ function useAreaChecklistRepo() {
|
|
|
2988
2979
|
try {
|
|
2989
2980
|
const pipeline = [
|
|
2990
2981
|
{ $match: query },
|
|
2991
|
-
{
|
|
2992
|
-
$lookup: {
|
|
2993
|
-
from: "users",
|
|
2994
|
-
let: { createdById: "$createdBy" },
|
|
2995
|
-
pipeline: [
|
|
2996
|
-
{
|
|
2997
|
-
$match: {
|
|
2998
|
-
$expr: {
|
|
2999
|
-
$and: [
|
|
3000
|
-
{ $ne: ["$$createdById", ""] },
|
|
3001
|
-
{ $eq: ["$_id", "$$createdById"] }
|
|
3002
|
-
]
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
},
|
|
3006
|
-
{ $project: { name: 1 } }
|
|
3007
|
-
],
|
|
3008
|
-
as: "createdByDoc"
|
|
3009
|
-
}
|
|
3010
|
-
},
|
|
3011
|
-
{
|
|
3012
|
-
$unwind: {
|
|
3013
|
-
path: "$createdByDoc",
|
|
3014
|
-
preserveNullAndEmptyArrays: true
|
|
3015
|
-
}
|
|
3016
|
-
},
|
|
3017
2982
|
{
|
|
3018
2983
|
$addFields: {
|
|
3019
2984
|
statusOrder: {
|
|
@@ -3065,8 +3030,7 @@ function useAreaChecklistRepo() {
|
|
|
3065
3030
|
},
|
|
3066
3031
|
else: 0
|
|
3067
3032
|
}
|
|
3068
|
-
}
|
|
3069
|
-
createdByName: "$createdByDoc.name"
|
|
3033
|
+
}
|
|
3070
3034
|
}
|
|
3071
3035
|
},
|
|
3072
3036
|
{ $skip: page * limit },
|
|
@@ -4120,8 +4084,7 @@ function useAreaChecklistService() {
|
|
|
4120
4084
|
unit: unit.unit.toString(),
|
|
4121
4085
|
name: unit.name
|
|
4122
4086
|
}))
|
|
4123
|
-
}))
|
|
4124
|
-
createdBy: value.createdBy
|
|
4087
|
+
}))
|
|
4125
4088
|
};
|
|
4126
4089
|
const insertedId = await _createAreaChecklist(checklistData);
|
|
4127
4090
|
totalChecklistsCreated++;
|
|
@@ -4478,16 +4441,13 @@ function useAreaChecklistController() {
|
|
|
4478
4441
|
(acc, [key, value2]) => ({ ...acc, [key]: value2 }),
|
|
4479
4442
|
{}
|
|
4480
4443
|
) : {};
|
|
4481
|
-
const createdBy = cookies["user"] || "";
|
|
4482
4444
|
const payload = {
|
|
4483
4445
|
site: req.params.site,
|
|
4484
|
-
schedule: req.params.schedule
|
|
4485
|
-
createdBy
|
|
4446
|
+
schedule: req.params.schedule
|
|
4486
4447
|
};
|
|
4487
4448
|
const validation = import_joi9.default.object({
|
|
4488
4449
|
site: import_joi9.default.string().hex().required(),
|
|
4489
|
-
schedule: import_joi9.default.string().hex().required()
|
|
4490
|
-
createdBy: import_joi9.default.string().hex().required()
|
|
4450
|
+
schedule: import_joi9.default.string().hex().required()
|
|
4491
4451
|
});
|
|
4492
4452
|
const { error, value } = validation.validate(payload);
|
|
4493
4453
|
if (error) {
|
|
@@ -6029,8 +5989,7 @@ var scheduleTaskSchema = import_joi16.default.object({
|
|
|
6029
5989
|
name: import_joi16.default.string().required(),
|
|
6030
5990
|
value: import_joi16.default.any().required()
|
|
6031
5991
|
})
|
|
6032
|
-
).required()
|
|
6033
|
-
createdBy: import_joi16.default.string().hex().required()
|
|
5992
|
+
).required()
|
|
6034
5993
|
});
|
|
6035
5994
|
function MScheduleTask(value) {
|
|
6036
5995
|
const { error } = scheduleTaskSchema.validate(value);
|
|
@@ -6057,13 +6016,6 @@ function MScheduleTask(value) {
|
|
|
6057
6016
|
}
|
|
6058
6017
|
});
|
|
6059
6018
|
}
|
|
6060
|
-
if (value.createdBy) {
|
|
6061
|
-
try {
|
|
6062
|
-
value.createdBy = new import_mongodb18.ObjectId(value.createdBy);
|
|
6063
|
-
} catch (error2) {
|
|
6064
|
-
throw new import_node_server_utils32.BadRequestError("Invalid createdBy ID format.");
|
|
6065
|
-
}
|
|
6066
|
-
}
|
|
6067
6019
|
return {
|
|
6068
6020
|
site: value.site,
|
|
6069
6021
|
serviceType: value.serviceType,
|
|
@@ -6073,7 +6025,6 @@ function MScheduleTask(value) {
|
|
|
6073
6025
|
description: value.description,
|
|
6074
6026
|
areas: value.areas,
|
|
6075
6027
|
status: "active",
|
|
6076
|
-
createdBy: value.createdBy,
|
|
6077
6028
|
createdAt: /* @__PURE__ */ new Date(),
|
|
6078
6029
|
updatedAt: "",
|
|
6079
6030
|
deletedAt: ""
|
|
@@ -6586,8 +6537,7 @@ function useScheduleTaskService() {
|
|
|
6586
6537
|
area: areaId,
|
|
6587
6538
|
name: area.name,
|
|
6588
6539
|
type: areaDetails.type || "common",
|
|
6589
|
-
checklist: schedTaskSets
|
|
6590
|
-
createdBy: scheduleTask.createdBy
|
|
6540
|
+
checklist: schedTaskSets
|
|
6591
6541
|
};
|
|
6592
6542
|
import_node_server_utils34.logger.info(
|
|
6593
6543
|
`Area ${area.name} (${areaId}): Creating new area checklist with schedule-task sets only`
|
|
@@ -6642,12 +6592,7 @@ function useScheduleTaskController() {
|
|
|
6642
6592
|
deleteScheduleTask: _deleteScheduleTask
|
|
6643
6593
|
} = useScheduleTaskRepository();
|
|
6644
6594
|
async function createScheduleTask(req, res, next) {
|
|
6645
|
-
const
|
|
6646
|
-
(acc, [key, value]) => ({ ...acc, [key]: value }),
|
|
6647
|
-
{}
|
|
6648
|
-
) : {};
|
|
6649
|
-
const createdBy = cookies["user"] || "";
|
|
6650
|
-
const payload = { ...req.body, ...req.params, createdBy };
|
|
6595
|
+
const payload = { ...req.body, ...req.params };
|
|
6651
6596
|
const { error } = scheduleTaskSchema.validate(payload);
|
|
6652
6597
|
if (error) {
|
|
6653
6598
|
import_node_server_utils35.logger.log({ level: "error", message: error.message });
|