@7365admin1/module-hygiene 4.6.0 → 4.7.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @7365admin1/module-hygiene
2
2
 
3
+ ## 4.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update Cleaning Schedule Area fields
8
+
3
9
  ## 4.6.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -217,6 +217,8 @@ type TCleaningScheduleArea = {
217
217
  type TAreaChecklist = {
218
218
  set: number;
219
219
  units: TAreaChecklistUnits[];
220
+ remarks?: string;
221
+ attachment?: string[];
220
222
  };
221
223
  type TAreaChecklistUnits = {
222
224
  unit: string | ObjectId;
@@ -242,7 +244,7 @@ type TCleaningScheduleAreaGetQuery = {
242
244
  status?: (typeof allowedStatus)[number] | "all";
243
245
  } & Pick<TCleaningScheduleArea, "schedule">;
244
246
  type TAreaChecklistUpdate = Pick<TCleaningScheduleArea, "checklist">;
245
- type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "approve" | "reject" | "remarks" | "completedBy">;
247
+ type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "approve" | "reject" | "remarks" | "completedBy"> & Pick<TAreaChecklist, "attachment">;
246
248
  declare const areaChecklistSchema: Joi.ObjectSchema<any>;
247
249
  declare function MAreaChecklist(value: TCleaningScheduleArea): {
248
250
  schedule: string | ObjectId;
package/dist/index.js CHANGED
@@ -3135,8 +3135,12 @@ function useAreaChecklistRepo() {
3135
3135
  $project: {
3136
3136
  _id: 0,
3137
3137
  set: "$checklist.set",
3138
+ remarks: "$checklist.remarks",
3139
+ attachment: "$checklist.attachment",
3138
3140
  unit: "$checklist.units.unit",
3139
3141
  name: "$checklist.units.name",
3142
+ approve: "$checklist.units.approve",
3143
+ reject: "$checklist.units.reject",
3140
3144
  status: {
3141
3145
  $switch: {
3142
3146
  branches: [
@@ -3151,18 +3155,21 @@ function useAreaChecklistRepo() {
3151
3155
  ],
3152
3156
  default: "$checklist.units.status"
3153
3157
  }
3154
- },
3155
- remarks: "$checklist.units.remarks"
3158
+ }
3156
3159
  }
3157
3160
  },
3158
3161
  { $sort: { set: 1, name: 1 } },
3159
3162
  {
3160
3163
  $group: {
3161
3164
  _id: "$set",
3165
+ remarks: { $first: "$remarks" },
3166
+ attachment: { $first: "$attachment" },
3162
3167
  units: {
3163
3168
  $push: {
3164
3169
  unit: "$unit",
3165
3170
  name: "$name",
3171
+ approve: "$approve",
3172
+ reject: "$reject",
3166
3173
  status: "$status",
3167
3174
  remarks: "$remarks"
3168
3175
  }
@@ -3173,6 +3180,8 @@ function useAreaChecklistRepo() {
3173
3180
  $project: {
3174
3181
  _id: 0,
3175
3182
  set: "$_id",
3183
+ remarks: "$remarks",
3184
+ attachment: "$attachment",
3176
3185
  units: 1
3177
3186
  }
3178
3187
  },
@@ -3276,6 +3285,12 @@ function useAreaChecklistRepo() {
3276
3285
  if (value.remarks) {
3277
3286
  updateValue["checklist.$[checklist].units.$[unit].remarks"] = value.remarks;
3278
3287
  }
3288
+ if (value.attachment) {
3289
+ updateValue["checklist.$[checklist].attachment"] = value.attachment;
3290
+ if (value.remarks) {
3291
+ updateValue["checklist.$[checklist].remarks"] = value.remarks;
3292
+ }
3293
+ }
3279
3294
  if (value.completedBy) {
3280
3295
  updateValue["checklist.$[checklist].units.$[unit].completedBy"] = new import_mongodb9.ObjectId(value.completedBy);
3281
3296
  }
@@ -3782,6 +3797,7 @@ function useAreaChecklistController() {
3782
3797
  approve: import_joi9.default.boolean().optional(),
3783
3798
  reject: import_joi9.default.boolean().optional(),
3784
3799
  remarks: import_joi9.default.string().optional().allow("", null),
3800
+ attachment: import_joi9.default.array().items(import_joi9.default.string()).optional(),
3785
3801
  completedBy: import_joi9.default.string().hex().required()
3786
3802
  });
3787
3803
  const { error } = validation.validate(payload);