Functions Reference
Every exported Convex function, by module. Org-scoped functions (orgQuery/orgMutation) implicitly take sessionToken + orgSlug; only additional args are listed. The policy in italics is the server-side gate (see Roles & Permissions). Nearly every mutation writes an audit log entry.
auth.ts
| Function | Kind | Args | Does |
|---|
signIn | action | email, password | PBKDF2 verify → {ok, token?, error?}; mints a 14-day session |
signOut | mutation | sessionToken | deletes the session |
me | query | sessionToken | current user + active org memberships (account picker / shell) |
userByEmail, createSession, setPassword, hashForSeed | internal | — | seeding & sign-in plumbing |
orgs.ts
| Function | Args | Does |
|---|
shell | — | app-shell bootstrap: branding, my role, locations, unread badges, clocked-in state |
updateGeneralSettings | name/timezone/accentColor/check-in windows | settings.manage |
logoUploadUrl / logoSet | storageId? | brand logo; settings.manage |
clients.ts
| Function | Args | Does |
|---|
listPage | paginationOpts, search?, includeArchived? | cursor-paginated alphabetical list; VIP masked without clients.view_vip |
list | search?, includeArchived? | non-paginated (take 50 on search) |
get | clientId | detail with pets, orders, visits, agreements; null on bad/cross-tenant id |
create / update / setArchived | client fields | clients.manage; update refuses to wipe a VIP flag hidden from the caller |
pets.ts
| Function | Args | Does |
|---|
listPage / list | search?, statusFilter? | pet lists (list adds open-issue titles + in-house flag) |
get | petId | full detail: visits, care events, photos, medication needs |
create / update / updateCare | pet fields | pets.manage; updateCare is the focused feeding/allergies/status editor |
birthdays | — | birthdays in the next 30 days |
visits.ts
| Function | Args | Does |
|---|
list | status?, locationId? | filterable list (incl. checked-in-today / checked-out-today pseudo-filters) |
get | visitId | detail with care events, order/deposit state, agreement checklist |
book | pet/location/room/product/schedule | inserts as planned; visits.manage |
checkIn | visitId, roomId?, overrideAgreements? | visits.checkin; blocks on unsigned required agreements unless override + visits.checkin_override |
checkOut | visitId | → completed; visits.checkin |
cancel / markNoShow / update / cancelMany | — | visits.manage |
All transitions funnel through the internal transition() helper enforcing VISIT_TRANSITIONS.
careEvents.ts / medications.ts / issues.ts
| Function | Args | Does |
|---|
careEvents.forVisit | visitId | care log |
careEvents.log | visitId, type, note?, at? | one-tap log; visits.checkin |
careEvents.remove | eventId | visits.manage |
medications.listForPet | petId | needs with last dose |
medications.addNeed / setNeedActive | — | pets.manage |
medications.administer | needId, visitId, note? | records a paired careEvent dose; visits.checkin |
issues.listForPet | petId | issue history |
issues.open | petId, visitId?, type, severity, title, note? | visits.checkin |
issues.resolve | issueId, resolutionNote? | serious issues require visits.checkin_override |
agreements.ts / documents.ts
| Function | Args | Does |
|---|
agreements.statusForVisit | visitId | desk checklist of signed/unsigned required agreements |
agreements.signAtDesk | agreementId, clientId, visitId?, signedName | staff-captured signature; visits.checkin |
documents.generateUploadUrl / attach / remove | — | pets.manage; MIME allowlist (pdf/doc/docx/txt/jpeg/png) |
documents.listFor | petId? | visitId? | clientId? | with signed URLs |
products.ts / orders.ts / paymentMethods.ts
| Function | Args | Does |
|---|
products.list / get | type?, includeInactive? | catalog |
products.create / update / setActive | — | products.manage |
orders.list | status?, clientId? | with balance/deposit rollups |
orders.get | orderId | items, payments, history |
orders.create | clientId, locationId, items[], notes? | computes totals + per-location tax (default 925 bps), decrements retail inventory, assigns order number; orders.manage |
orders.recordPayment | orderId, amountCents, methodType, last4? | manual payment capped at balance; orders.manage |
orders.refund | orderId, paymentId, amountCents | orders.refund; caps against remaining refundable per payment; >30-day-old payments need orders.refund_override |
orders.setFulfillment / setItemNote / markPickupComplete / archiveMany | — | orders.manage |
paymentMethods.listForClient | clientId | wallet |
paymentMethods.addDevCard / remove / charge | — | dev vault; orders.manage; non-dev providers throw PROVIDER_NOT_CONFIGURED |
portal.ts (customer self-service)
Scoped to the caller's own client record; staff pass asClientId (requires clients.manage, audit-logged via startImpersonation).
| Function | Does |
|---|
myOverview | pets, upcoming visits, orders, agreements to sign, bookable products, wallet |
bookVisit | self-serve booking: creates visit + order with deposit |
payOrder / addCard | pay own order / vault a card (dev) |
myThread / sendMessage | the client's thread (find-or-create) |
generateUploadUrl / attachDocument | upload vet records to own pets |
signAgreement | self-sign |
messages.ts / notes.ts
| Function | Does |
|---|
messages.threadList / thread | inbox with unread counts / full thread with attachment URLs |
messages.send / startThread / generateAttachmentUploadUrl | outbound by channel; messages.send |
messages.markThreadRead | read receipts |
notes.list | sorted: unacked-required → pinned → recent, with x/y ack counts |
notes.create / update / remove | notes.manage |
notes.markRead | acknowledge |
staff.ts / timeclock.ts / schedules.ts
| Function | Does |
|---|
staff.list / get | roster with pay + clocked-in state; PIN exposed only as hasPin; staff.manage |
staff.invite / updateMembership | create/link user + membership; role/title/pay/PIN/active; staff.manage |
timeclock.clockIn / clockOut | self; double-punch guarded |
timeclock.entries | userId?, fromMs?, toMs?; employees forced to own entries |
timeclock.approve / updateEntry | timeclock.approve; edits stamp editedBy |
schedules.week | weekly grid per staff member |
schedules.upsertShift / removeShift | staff.manage |
board.ts / dashboard.ts / reports.ts / search.ts
| Function | Does |
|---|
board.live | the flagship reactive board: rooms, in-house pets with care chips, arrivals with agreement/deposit prompts, counts |
dashboard.daily | KPIs, arrivals/departures, issues, notes/threads, clocked-in, shifts, HR row, birthdays |
reports.sales / transactions / petsClients / timeClock / overtime / missedPunches / readiness | the seven reports; all reports.view |
search.global | q → combined client + pet search-index lookup (8 each) |
settings.ts
All settings.manage unless noted: locationsList, locationUpsert, roomUpsert, policiesGet, policySet, policyReset, agreementsList, agreementUpsert (append-only versioning), remindersList, reminderUpsert, foodBrandsList (ungated), foodBrandUpsert, foodBrandRemove, feedInfo, regenerateFeedToken.
platform.ts (landlord — not org-scoped)
| Function | Does |
|---|
directory | public list of active orgs |
amIPlatformOwner | non-throwing check (active owner membership anywhere) |
applicationsList / applicationSetStatus | platform-owner only; approval creates an inactive org |
apply | public application submission (validates name/email) |
crons.ts / http.ts / seed.ts / providers
See Jobs & Providers. Seed: seed.run (action) → seed.insertAll builds the deterministic demo-boarding world (mulberry32(20260712)).