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_verifiedwithverified_by(the Partner) andverified_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:
| Table | Owned by | Tenant traffic |
|---|---|---|
partner | the Partner's Organization (its key) | every session reads approved Partners; an Organization reads and inserts its own application, never approves |
partner_request | the household (organization_id) | the household and the addressed Partner read it; the household inserts and withdraws, the Partner declines |
partner_handover | the dealer's Organization | the 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
| Procedure | Who | Failures |
|---|---|---|
partner.directory | every Member | none: approved Partners of the User's data region |
partner.request { id, requestId, partnerId } | the car's owner role | NOT_FOUND (service, Partner), CONFLICT (open or verified) |
partner.requests { id } | every Member | none: the service's requests, latest first |
partner.portal | every Member | none: the Partner (or application), pending requests, hand-overs |
partner.submitApplication { kind, name, city, region } | owners and admins | CONFLICT (already applied) |
partner.confirm / partner.decline { id } | Members of the Partner | FORBIDDEN (not approved, own Member's request), NOT_FOUND |
partner.createHandover | Members of an approved Partner | FORBIDDEN |
partner.previewHandover / partner.acceptHandover { code } | every Member / owners and admins | NOT_FOUND (wrong, expired or used code), PLAN_LIMIT |
admin.partners.applications / admin.partners.approve | platform admins | NOT_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, alsoautofolio://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.