Organizations
Organizations group users and patients. A user can be member of many organizations (Free can join unlimited, but only Pro can create — organizations: 0 for free).
Organizations are dashboard-only: there is no API-key equivalent. All routes below require a session cookie.
Roles
| Role | Capabilities |
|---|---|
viewer | Read patients assigned to the org |
member | Same as viewer (default on join) |
admin | Invite, edit, delete, manage patients, QR share |
Invite is email-based (POST /api/v1/organizations/:id/invite), or via QR ?join=slug. Leaving is POST /:id/leave (admins cannot leave, must transfer).
API
POST /api/v1/organizations— Pro only (402ifcanCreateOrganizationfails). Body{ name, type, slug? }.POST /api/v1/organizations/join— unlimited for Free, createsmembership+ optionalpatientAssignment(only patients the user owns, IDOR guard).GET /api/v1/organizations— lists memberships withmemberCountsubquery.GET /api/v1/organizations/patients/data— enriched patient view across orgs with lateral join onglucose_reading(3h sparkline, TIR).
UI
OrganizationsPage.vue shows two cards: total organizations and “Crear: solo Pro · Unirte es ilimitado” (Lock vs Building2), plus GenericTable and v-if="!selectedBlock && !settingsOpen" placeholder fix. Create button opens PremiumUpsellModal for Free.