Files
Moonbase/src/lib/api/scopes.ts
tonym 39be24c2fc v0.14.0 — Animals & Pets
Livestock and household pets as leaves on the Location tree, mirroring Garden.

- Animal model (species/breed/sex/birthdate/location, soft-delete) + AnimalLog
  (feeding, vet, weight, medication, breeding, acquired, died); Task.animalId for
  recurring care reminders
- API-first /api/v1/animals (CRUD) + logs, animals:read/write scopes; animals
  service shared with the coming MCP
- Animals pages: list grouped by species with auto-computed age, detail with
  facts + latest weight + care log; add/edit/remove + log entry. Nav entry.
  Backup/restore cover the new tables
- Pure age.ts (newborn/days/months/years) with tests; verified end-to-end against
  a running server (create, vet + weigh-in logs, read-back)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 00:23:53 -05:00

25 lines
917 B
TypeScript

// Client-safe scope constants (no server deps) — shared by the auth helper,
// the token routes, and the token-management UI.
export const KNOWN_SCOPES = [
"plants:read", "plants:write",
"plant-types:read", "plant-types:write",
"locations:read", "locations:write",
"tasks:read", "tasks:write",
"items:read", "items:write",
"animals:read", "animals:write",
] as const;
export type KnownScope = (typeof KNOWN_SCOPES)[number];
// Resources for the token-creation UI (read/write columns). `soon` marks
// domains whose endpoints are still being built.
export const SCOPE_RESOURCES: { key: string; label: string; soon?: boolean }[] = [
{ key: "plants", label: "Plants" },
{ key: "plant-types", label: "Plant types" },
{ key: "locations", label: "Locations" },
{ key: "tasks", label: "Tasks & reminders" },
{ key: "items", label: "Inventory" },
{ key: "animals", label: "Animals & pets" },
];