@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/dist/index.mjs CHANGED
@@ -3100,8 +3100,12 @@ function useAreaChecklistRepo() {
3100
3100
  $project: {
3101
3101
  _id: 0,
3102
3102
  set: "$checklist.set",
3103
+ remarks: "$checklist.remarks",
3104
+ attachment: "$checklist.attachment",
3103
3105
  unit: "$checklist.units.unit",
3104
3106
  name: "$checklist.units.name",
3107
+ approve: "$checklist.units.approve",
3108
+ reject: "$checklist.units.reject",
3105
3109
  status: {
3106
3110
  $switch: {
3107
3111
  branches: [
@@ -3116,18 +3120,21 @@ function useAreaChecklistRepo() {
3116
3120
  ],
3117
3121
  default: "$checklist.units.status"
3118
3122
  }
3119
- },
3120
- remarks: "$checklist.units.remarks"
3123
+ }
3121
3124
  }
3122
3125
  },
3123
3126
  { $sort: { set: 1, name: 1 } },
3124
3127
  {
3125
3128
  $group: {
3126
3129
  _id: "$set",
3130
+ remarks: { $first: "$remarks" },
3131
+ attachment: { $first: "$attachment" },
3127
3132
  units: {
3128
3133
  $push: {
3129
3134
  unit: "$unit",
3130
3135
  name: "$name",
3136
+ approve: "$approve",
3137
+ reject: "$reject",
3131
3138
  status: "$status",
3132
3139
  remarks: "$remarks"
3133
3140
  }
@@ -3138,6 +3145,8 @@ function useAreaChecklistRepo() {
3138
3145
  $project: {
3139
3146
  _id: 0,
3140
3147
  set: "$_id",
3148
+ remarks: "$remarks",
3149
+ attachment: "$attachment",
3141
3150
  units: 1
3142
3151
  }
3143
3152
  },
@@ -3241,6 +3250,12 @@ function useAreaChecklistRepo() {
3241
3250
  if (value.remarks) {
3242
3251
  updateValue["checklist.$[checklist].units.$[unit].remarks"] = value.remarks;
3243
3252
  }
3253
+ if (value.attachment) {
3254
+ updateValue["checklist.$[checklist].attachment"] = value.attachment;
3255
+ if (value.remarks) {
3256
+ updateValue["checklist.$[checklist].remarks"] = value.remarks;
3257
+ }
3258
+ }
3244
3259
  if (value.completedBy) {
3245
3260
  updateValue["checklist.$[checklist].units.$[unit].completedBy"] = new ObjectId9(value.completedBy);
3246
3261
  }
@@ -3747,6 +3762,7 @@ function useAreaChecklistController() {
3747
3762
  approve: Joi9.boolean().optional(),
3748
3763
  reject: Joi9.boolean().optional(),
3749
3764
  remarks: Joi9.string().optional().allow("", null),
3765
+ attachment: Joi9.array().items(Joi9.string()).optional(),
3750
3766
  completedBy: Joi9.string().hex().required()
3751
3767
  });
3752
3768
  const { error } = validation.validate(payload);