Inspection reports: support uploading file-type required report slots on mobile

Objective

  • Let inspectors fill empty file-type required report slots from the mobile app (e.g. PDF pick/upload), instead of relying on web-only uploads.
  • Preserve existing Spectora and link flows; add clear handling for oversize, wrong type, and network failures.

Background

  • In ReportsSection, empty slots only allow adding when requiredReport.reportType is spectora or link (canAdd); file slots show the label but cannot start an add flow.
  • handleAddUrl branches support Spectora URL validation and generic link creation; there is no file branch wired to an upload or document pick.
  • Web workorder reports use useReportUpload.ts (FilePond, presigned-style server actions, size/type constants such as MAX_FILE_SIZE / ACCEPTED_FILE_TYPES) from attik-frontend/src/app/tools/inspections/[id]/components/reports/ — mobile work should mirror the same backend contracts (multipart vs presigned finalize, inspection/report fields, _requiredReportTypeId / index behavior) rather than inventing a parallel API.

Scope

Attik Mobile

  • Primary UI: components/inspection/ReportsSection.tsx — extend canAdd / empty-slot actions for reportType === "file", wire mutations after a document pick, and keep slot keys (createSlotKey) and getUploadedReports behavior consistent.
  • Report mutations already used for Spectora/link: hooks/useReportMutations.ts (e.g. useCreateLinkReport, useCreateSpectoraReport) — evaluate whether a new mutation or API helper is needed for file-backed reports vs reusing an existing endpoint.
  • Document picking precedent: components/inspection/AttachmentsSection.tsx uses expo-document-picker (DocumentPicker.getDocumentAsync); reuse patterns or shared utilities where appropriate.
  • Hooks: hooks/useInspectionReports.ts and any report list invalidation after upload.

Attik Frontend (reference only)

  • src/app/tools/inspections/[id]/components/reports/useReportUpload.ts — server action URLs, metadata passed with uploads, and validation limits for parity.
  • ReportCard.tsx / Reports.tsx — how file slots render after upload.

Attik Backend

  • Confirm the routes and payload shape used when web creates or attaches file reports to an inspection (report + storage finalize if applicable); mobile must call the same contracts.

References

  • Mobile: attik-mobile/components/inspection/ReportsSection.tsx, attik-mobile/components/inspection/AttachmentsSection.tsx, attik-mobile/hooks/useReportMutations.ts, attik-mobile/hooks/useInspectionReports.ts
  • Web: attik-frontend/src/app/tools/inspections/[id]/components/reports/useReportUpload.ts

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
🏠

Main App

Date

About 2 months ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.