getInspectionReportsAndRequired, which updates a report when a row already matches the Spectora report id, creates when no match exists, and archives existing rows whose _spectoraReportId is absent from the current Spectora report/attachment id set returned for that inspection—so multiple waves are plausible when Spectora’s payload exposes new report ids over the job life (schedule changes, inspector changes, republish, etc.).Repro materials and example jobs
1008590172)1008589968)1008590109)1008581481)1008589712)1008576981)1008589393)attik-backend/src/util/functions/spectora/getInspectionReportsAndRequired.ts: matching Spectora reports to existing Report documents, create vs update, and the archive stale ids pass that sets status: 'archived' when an id disappears from the current Spectora set.attik-backend/src/routes/webhooks/spectora/syncInspection.ts (report sync block).POST /:id/sync-spectora-reports on the inspection router in attik-backend/src/routes/inspection.ts, which also invokes getInspectionReportsAndRequired (see integration tests under attik-backend/tests/integration/inspection.syncSpectoraReports.test.ts for behavior expectations).attik-backend/src/models/reportSchema.ts defines fields such as _spectoraReportId, spectora_slug, reportType, status, and links used when reconciling with Spectora.report rows listed with _spectoraReportId, status, _requiredReportTypeId / template, timestamps—confirm whether two non-archived Spectora rows ever occupy the same “slot.”sync-spectora-reports) correlated with activity timestamps.attik-backend/src/util/functions/spectora/getInspectionReportsAndRequired.tsattik-backend/src/routes/webhooks/spectora/syncInspection.tsattik-backend/src/routes/inspection.ts (/:id/sync-spectora-reports)attik-backend/tests/integration/inspection.syncSpectoraReports.test.tsPlease authenticate to join the conversation.
Planned
Bug Reports
18 days ago
Linear
Get notified by email when there are changes.
Planned
Bug Reports
18 days ago
Linear
Get notified by email when there are changes.