@7365admin1/module-hygiene 4.29.0 → 4.30.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,19 @@
1
1
  # @7365admin1/module-hygiene
2
2
 
3
+ ## 4.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dea5edb: Require a photo to complete a checklist task.
8
+
9
+ `attachment` is now required, with at least one non-blank id, when the decision
10
+ is `approve`. This endpoint is where every service and every client meets — the
11
+ five field apps and the web checklist all post here — so enforcing it here is
12
+ what makes the rule the same for all of them.
13
+
14
+ Rejecting is deliberately unaffected: a reject is a technician reporting a
15
+ problem, and demanding a photograph first would stop them reporting it.
16
+
3
17
  ## 4.29.0
4
18
 
5
19
  ### Minor Changes
package/dist/index.js CHANGED
@@ -5074,7 +5074,37 @@ function useAreaChecklistController() {
5074
5074
  approve: import_joi9.default.boolean().optional(),
5075
5075
  reject: import_joi9.default.boolean().optional(),
5076
5076
  remarks: import_joi9.default.string().optional().allow("", null),
5077
- attachment: import_joi9.default.array().items(import_joi9.default.string()).optional(),
5077
+ /*
5078
+ * A PHOTO IS REQUIRED TO COMPLETE A TASK.
5079
+ *
5080
+ * Owner requirement, 2026-09-10: *"once task was completed they required
5081
+ * to take photo before completing the task ... all the services that has
5082
+ * this module must be the same process."*
5083
+ *
5084
+ * This endpoint is the one place every service and every client meets:
5085
+ * the five field apps (M&E, Cleaning, Landscape, Pest, Pool) all PATCH
5086
+ * `/api/hygiene-area-checklist/...` with a `serviceType`, and the web
5087
+ * checklist (`layer-common ManageChecklistMain`) posts here too. Requiring
5088
+ * it here is what makes "the same process" true rather than five client
5089
+ * guards that can drift apart — and a client guard alone is a suggestion.
5090
+ *
5091
+ * ONLY ON APPROVE. Completing a unit is the act the evidence is for.
5092
+ * A REJECT is the technician reporting a problem, and demanding a
5093
+ * photograph before somebody can report one would stop them reporting it.
5094
+ * `decision` carries which is which.
5095
+ *
5096
+ * At least one entry, and each must be a real id — an empty array or a
5097
+ * blank string would satisfy `.optional()` while carrying no evidence at
5098
+ * all, which is the shape a client sends when its uploader failed.
5099
+ */
5100
+ attachment: import_joi9.default.array().items(import_joi9.default.string().trim().min(1)).when("decision", {
5101
+ is: "approve",
5102
+ then: import_joi9.default.array().min(1).required().messages({
5103
+ "array.min": "A photo is required to complete this task. Take or upload at least one photo before marking it complete.",
5104
+ "any.required": "A photo is required to complete this task. Take or upload at least one photo before marking it complete."
5105
+ }),
5106
+ otherwise: import_joi9.default.array().optional()
5107
+ }),
5078
5108
  completedBy: import_joi9.default.string().hex().required()
5079
5109
  });
5080
5110
  const { error } = validation.validate(payload);