Skip to content
Docs

Command palette

Jump to a page or search the docs.

Changelog

Partner workshops and dealers

How M-Oficinas and the partner portal D-Parceiros let an approved workshop verify a service and a dealer hand over a car, with the owner's consent and an audit trail.

Markdown

What it does

A Partner is an Organization of a workshop or dealer that a platform admin approved (US44, US45, RF47, RF48). Only an approved Partner appears to owners, and only it can make a record "Partner-verified" (the domain rule: never "verified" without an auditable partner). Nothing is shared by default and no data is sold; there are no offers.

  • Confirmation request. An owner picks a workshop on M-Oficinas and one of a car's services. The request carries a copy of what the Partner sees: the car's make, model and year, the owner's first name and initial, the service's title, date, reading and workshop. Never the plate, VIN, an address or an amount (a CHECK refuses those keys). On D-Parceiros the Partner confirms it, and the service becomes partner_verified with verified_by (the Partner) and verified_at; or declines it, and the owner sees that. Correcting the service withdraws an open request; a verified service cannot be corrected.
  • Hand-over. A dealer prepares a car (catalog text and its reading at delivery) and the services it did before delivery. The portal shows a 16-character code once (Crockford base32, 80 bits, 30 days); only its SHA-256 is stored. The customer enters it in the app, sees exactly what accepting adds, and only then does the car join their garage, through the garage's own create (the Free plan's one-car limit counts it), with the dealer's services partner-verified at no cost to the new owner: the price is the purchase's.

Data and isolation

packages/db/src/schema/partner.ts:

TableOwned byTenant traffic
partnerthe Partner's Organization (its key)every session reads approved Partners; an Organization reads and inserts its own application, never approves
partner_requestthe household (organization_id)the household and the addressed Partner read it; the household inserts and withdraws, the Partner declines
partner_handoverthe dealer's Organizationthe dealer reads and inserts its own

Two steps cross Organizations, each on its own system reason: partner.verify (confirming writes the household's service trust, which tenant traffic can never claim) and partner.handover (the customer reads a hand-over by its code's hash and accepts it). Confirming checks that the Partner is approved, the request is its own and pending, and that whoever sent it is not a Member of the Partner.

Procedures

ProcedureWhoFailures
partner.directoryevery Membernone: approved Partners of the User's data region
partner.request { id, requestId, partnerId }the car's owner roleNOT_FOUND (service, Partner), CONFLICT (open or verified)
partner.requests { id }every Membernone: the service's requests, latest first
partner.portalevery Membernone: the Partner (or application), pending requests, hand-overs
partner.submitApplication { kind, name, city, region }owners and adminsCONFLICT (already applied)
partner.confirm / partner.decline { id }Members of the PartnerFORBIDDEN (not approved, own Member's request), NOT_FOUND
partner.createHandoverMembers of an approved PartnerFORBIDDEN
partner.previewHandover / partner.acceptHandover { code }every Member / owners and adminsNOT_FOUND (wrong, expired or used code), PLAN_LIMIT
admin.partners.applications / admin.partners.approveplatform adminsNOT_FOUND

Applying, approving, sending, confirming, declining and creating a hand-over are audited (partner.*); an accepted hand-over records who accepted it and the car it became. A hand-over nobody accepted is deleted, with the customer's name, HANDOVER_EXPIRED_KEEP_DAYS (30 days) after its code expired, by the cron tick's handovers job (partner.jobs.ts, 100 a tick).

Screens

  • M-Oficinas (screen-M-Oficinas, /workshops) opens from Profile, or from a service's trust card on M-Servico ("Ask a partner workshop to confirm"), which then shows the request's state. The more button opens Receive a car (/handover, also autofolio://handover?code=…).
  • D-Parceiros (screen-D-Parceiros, /partners) is the signed-in portal of the Active Organization: requests to confirm, the hand-over form with the code and recent hand-overs, the application form for an Organization that is not a Partner yet, and a switch for a Member of another Partner. Admins approve applications at /admin/partners.

autofolio://dev/M-Oficinas lists the seeded workshops. For the portal, POST /api/auth/dev/seed-sign-in with { "lang": "en", "as": "partner" } signs in the first workshop's staff with the household's two requests waiting.

Key files

Edit on GitHubDocumentation is in English.

We use essential cookies to make our app work. With your consent, we also use optional cookies to improve your experience. Read our Cookie Policy and Privacy Policy.