primary flag exists on embedded people rows and is set in some flows (e.g. job creation from selected contacts), but defaulting when there are several contacts—and staff control to fix it—are not fully productized: internal users need an explicit rule for “who counts first” plus a manual path to override._invoiceContactId), and display heuristics stay coherent.Backend
attik-backend/src/models/peopleSchema.ts — Each people row includes primary (boolean); same idea on quotes in attik-backend/src/models/quoteSchema.ts.attik-backend/src/util/functions/inspection/createInspection.ts — Sets primary from selectedContacts when creating an inspection (primary: contact.primary || false).attik-backend/src/routes/inspection.ts — PATCH assigns b.people wholesale; defaulting and uniqueness rules for primary, if any, live in whatever validation or normalization exists around that payload (worth tracing when defining defaults and staff edits).attik-backend/src/util/functions/priorityLab/buildPriorityLabPayload.ts — Uses people.find((p) => p.primary && p._contactId) before other fallbacks—integrations already assume primary can be meaningful.attik-backend/src/config/exportFieldDefinitions.ts — People export exposes primary as “Primary on job” (peopleFields).Frontend — defaults vs manual change
attik-frontend/src/util/functions/payments/primaryContactFromInspectionPeople.ts — Today’s default contact id for some flows: first row with primary, else people[0]. Any new “official” default rule should stay consistent with this helper or deliberately replace it and update callers.attik-frontend/src/app/tools/inspections/[id]/components/WorkorderPage.tsx — Add/remove person flows PATCH inspection/:id with people; new rows use primary: false and existing primary is copied through on rebuild—there is no dedicated UI here (in the reviewed code) to toggle who is primary; internal manual change implies adding that (or equivalent) on the workorder contacts experience.attik-frontend/src/app/client/job/[slug]/pay-beta/PaymentBetaClient.tsx and attik-frontend/src/app/client/job/[slug]/pay-beta/components/PayAtCloseTab.tsx — Use primaryContactIdFromInspectionPeople for payer-style defaults; behavior will follow whatever people[].primary and ordering rules become.Mobile
attik-mobile/app/(app)/inspection/[id].tsx — Surfaces multiple contacts for portal actions; may need alignment once web defines primary and defaults.Decision needed
primary: true invariant, behavior on Spectora/import). Decision needed: whether exactly one primary: true per inspection is enforced globally or per policy.attik-backend/src/models/peopleSchema.tsattik-frontend/src/util/functions/payments/primaryContactFromInspectionPeople.tspeople PATCH assembly: attik-frontend/src/app/tools/inspections/[id]/components/WorkorderPage.tsxattik-backend/src/routes/inspection.tsPlease authenticate to join the conversation.
Planned
Main App
About 1 month ago
Linear
Get notified by email when there are changes.
Planned
Main App
About 1 month ago
Linear
Get notified by email when there are changes.