Skip to content

Backend Organizations and Companions

Ankit Upadhyay edited this page Jul 24, 2026 · 2 revisions

Backend: Organizations and Companions

The tenant graph — veterinary organizations, their invites and ratings, and the companion (pet) ↔ parent (owner) relationships plus companion↔org membership. Part of Backend Overview.

What it owns

Org lifecycle and configuration, staff invites, public ratings, and the core relational graph a clinic operates on: which pets belong to which owners, and which pets are seen by which org. Org (/fhir/v1/organization), companion, and parent are FHIR-facing; invites and membership are plain REST.

Routers

organization.router.ts, organisation-invite.router.ts, organisationRating.router.ts, speciality.router.ts, companion.router.ts, companion-history.router.ts, companion-organisation.router.ts, parent.router.ts, parent-companion.router.ts, coparentInvite.router.ts, user-profile.router.ts.

Controllers

  • Web/PMS: web/organization.controller.ts, web/organisation-invite.controller.ts, web/speciality.controller.ts.
  • App/mobile: app/companion.controller.ts, app/companion-organisation.controller.ts, app/parent.controller.ts, app/parent-companion.controller.ts, app/coparentInvite.controller.ts, app/organisationRating.controller.ts.

Services

organization.service.ts, organisation-invite.service.ts, organisationReting.service.ts (sic), speciality.service.ts, companion.service.ts, companion-history.service.ts, companion-organisation.service.ts, parent.service.ts, parent-companion.service.ts, coparentInvite.service.ts, user-profile.service.ts.

Models

organization.ts, organisationInvite.ts, speciality.ts, user-profile.ts. Companion, parent, co-parent, usage-counter, billing, and rating entities live solely in the Prisma schema since PR #1819 removed their Mongoose models.

Notable

  • Companion history (companion-history.service.ts) is the unified medical-history timeline aggregating clinical, document, lab, and finance events — the backend side of the Companion & Clinical History plans.
  • Co-parent invites let a second owner share access to a companion (accept/decline/revoke lifecycle) — mirrored in the mobile co-parent feature.
  • The Organization model carries locale/currency (immutable after onboarding), country/regulatory config, feature flags, and appointment configuration — the org is the tenant boundary for RBAC.

Related

Product & Domain
Architecture
Applications
Design & Accessibility
Engineering Handbook
Decisions (ADRs)
Design Docs & Plans
Roadmap
Operations
Meta

Canonical code & docs: main repo · Auto-generated companion: DeepWiki

Clone this wiki locally