Objective
- Let field staff (inspectors) update specific required-information values on the workorder themselves—so structured data (for example a sewer line recommendation) lands in
requiredInfoValuesfor search and reporting instead of relying on office staff via side channels. - Support that workflow in both the main Attik workorder UI and the mobile app, but only for fields an admin has explicitly marked as inspector-editable and that the inspector can already see.
Background
- Operations feedback (AJF sewer team): a required field such as sewer line recommendation must be completed in a structured, searchable way on the inspection record.
- Today those users cannot edit the workorder (or the relevant slice of it), so updates are messaged to the office and entered manually—slow and error-prone.
- Required field definitions live in Mongo as
requiredInfo(attik-backend/src/models/requiredInfoSchema.ts):name,required,type,options,_spectoraCustomFieldId,hidden, etc. There is no schema property today for “inspectors may edit this field.” - Per-inspection values are stored on the inspection as
requiredInfoValues(attik-backend/src/models/requiredInfoValueSchema.ts:_requiredInfoId,name,value).PATCH inspection/:idassignsb.requiredInfoValuesdirectly inattik-backend/src/routes/inspection.tswhen present. - Web workorder editing uses
RequiredInfoSection→RequiredInfoAccordion(attik-frontend/src/app/tools/inspections/[id]/components/RequiredInfoSection.tsx), mounted fromWorkorderPage.tsx, persisting withPATCH inspection/{id}. - Mobile renders the same values read-only in
RequiredInfoGrid.tsxfromapp/(app)/inspection/[id].tsx; there is no mobile service in-repo that patchesrequiredInfoValuesalongside attachments/notes. - Activity logging already diffs
requiredInfoValuesfor change history (attik-backend/src/util/functions/activity/requiredInfoHandlers.ts).
Scope
Backend — attik-backend
- Extend the required-field definition model and API (
requiredInfoSchema,routes/requiredInfo.ts) with a per-field flag (or equivalent) meaning “inspectors assigned to the job may edit this field’s value,” plus validation rules the dev team deems appropriate. - Tighten
PATCH inspection/:idbehavior so inspector-scoped clients can only changerequiredInfoValuesentries that are both flagged and allowed for that inspection’s services—without opening broader workorder edits unless product intends that. - Decision needed: how this interacts with office/admin permissions, existing memberships, and any middleware that already restricts inspection updates for inspector roles.
Frontend — attik-frontend
- Settings / definition UI where
RequiredInfois created or edited (company required info and service linkage—e.g.servicestypes insrc/util/types/serverTypeCollection/services.tsand related settings screens) should expose the new inspector-editable toggle. - Workorder
RequiredInfoSection/RequiredInfoAccordionshould honor the flag and the current user’s role: editable inputs for permitted inspector users on flagged fields; unchanged behavior for everyone else unless product specifies otherwise.
Mobile — attik-mobile
- Replace or augment read-only
RequiredInfoGridso flagged fields become editable when the authenticated user is an inspector (or the same role product uses on web), calling the same inspection PATCH contract the web uses. - Decision needed: offline/retry UX, validation messaging, and parity with
RequiredInfoAccordionfield types (text,number,select,date,boolean,indicator).
References
attik-backend/src/models/requiredInfoSchema.tsattik-backend/src/models/requiredInfoValueSchema.tsattik-backend/src/routes/requiredInfo.tsattik-backend/src/routes/inspection.ts(PATCH,requiredInfoValues)attik-backend/src/util/functions/activity/requiredInfoHandlers.tsattik-frontend/src/util/types/serverTypeCollection/requiredInfo.tsattik-frontend/src/app/tools/inspections/[id]/components/RequiredInfoSection.tsxattik-frontend/src/components/scheduling/RequiredInfoAccordion.tsxattik-mobile/components/inspection/RequiredInfoGrid.tsxattik-mobile/app/(app)/inspection/[id].tsx