@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/dist/index.mjs CHANGED
@@ -5043,7 +5043,37 @@ function useAreaChecklistController() {
5043
5043
  approve: Joi9.boolean().optional(),
5044
5044
  reject: Joi9.boolean().optional(),
5045
5045
  remarks: Joi9.string().optional().allow("", null),
5046
- attachment: Joi9.array().items(Joi9.string()).optional(),
5046
+ /*
5047
+ * A PHOTO IS REQUIRED TO COMPLETE A TASK.
5048
+ *
5049
+ * Owner requirement, 2026-09-10: *"once task was completed they required
5050
+ * to take photo before completing the task ... all the services that has
5051
+ * this module must be the same process."*
5052
+ *
5053
+ * This endpoint is the one place every service and every client meets:
5054
+ * the five field apps (M&E, Cleaning, Landscape, Pest, Pool) all PATCH
5055
+ * `/api/hygiene-area-checklist/...` with a `serviceType`, and the web
5056
+ * checklist (`layer-common ManageChecklistMain`) posts here too. Requiring
5057
+ * it here is what makes "the same process" true rather than five client
5058
+ * guards that can drift apart — and a client guard alone is a suggestion.
5059
+ *
5060
+ * ONLY ON APPROVE. Completing a unit is the act the evidence is for.
5061
+ * A REJECT is the technician reporting a problem, and demanding a
5062
+ * photograph before somebody can report one would stop them reporting it.
5063
+ * `decision` carries which is which.
5064
+ *
5065
+ * At least one entry, and each must be a real id — an empty array or a
5066
+ * blank string would satisfy `.optional()` while carrying no evidence at
5067
+ * all, which is the shape a client sends when its uploader failed.
5068
+ */
5069
+ attachment: Joi9.array().items(Joi9.string().trim().min(1)).when("decision", {
5070
+ is: "approve",
5071
+ then: Joi9.array().min(1).required().messages({
5072
+ "array.min": "A photo is required to complete this task. Take or upload at least one photo before marking it complete.",
5073
+ "any.required": "A photo is required to complete this task. Take or upload at least one photo before marking it complete."
5074
+ }),
5075
+ otherwise: Joi9.array().optional()
5076
+ }),
5047
5077
  completedBy: Joi9.string().hex().required()
5048
5078
  });
5049
5079
  const { error } = validation.validate(payload);