Allow inspectors to edit selected required fields

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 requiredInfoValues for 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/:id assigns b.requiredInfoValues directly in attik-backend/src/routes/inspection.ts when present.
  • Web workorder editing uses RequiredInfoSectionRequiredInfoAccordion (attik-frontend/src/app/tools/inspections/[id]/components/RequiredInfoSection.tsx), mounted from WorkorderPage.tsx, persisting with PATCH inspection/{id}.
  • Mobile renders the same values read-only in RequiredInfoGrid.tsx from app/(app)/inspection/[id].tsx; there is no mobile service in-repo that patches requiredInfoValues alongside attachments/notes.
  • Activity logging already diffs requiredInfoValues for 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/:id behavior so inspector-scoped clients can only change requiredInfoValues entries 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 RequiredInfo is created or edited (company required info and service linkage—e.g. services types in src/util/types/serverTypeCollection/services.ts and related settings screens) should expose the new inspector-editable toggle.
  • Workorder RequiredInfoSection / RequiredInfoAccordion should 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 RequiredInfoGrid so 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 RequiredInfoAccordion field types (text, number, select, date, boolean, indicator).

References

  • attik-backend/src/models/requiredInfoSchema.ts
  • attik-backend/src/models/requiredInfoValueSchema.ts
  • attik-backend/src/routes/requiredInfo.ts
  • attik-backend/src/routes/inspection.ts (PATCH, requiredInfoValues)
  • attik-backend/src/util/functions/activity/requiredInfoHandlers.ts
  • attik-frontend/src/util/types/serverTypeCollection/requiredInfo.ts
  • attik-frontend/src/app/tools/inspections/[id]/components/RequiredInfoSection.tsx
  • attik-frontend/src/components/scheduling/RequiredInfoAccordion.tsx
  • attik-mobile/components/inspection/RequiredInfoGrid.tsx
  • attik-mobile/app/(app)/inspection/[id].tsx

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🏠

Main App

Date

2 months ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.