Files
template-app/modules/documents/contract/collections.ts
T
2026-11-14 09:56:45 +00:00

22 lines
1.1 KiB
TypeScript

// The live collection of the documents module (umbrella TS6.1). The live server announces a change of
// `documents_document` -- the job takes an upload, reads it, fails it -- as `{ entity: "documents.document", id }`,
// ids only; a reader reads the document back through `documents.document.getMany`, so the procedure's
// permission and the repository's tenant wall decide what a member sees. The project's list is a read of
// the files and the rows together (an upload is `queued` before it has a row), so the pages keep it with
// `useRead` live on this entity rather than as rows of the collection. `pnpm kit check` refuses a
// collection without its batch-get procedure.
import type { ModuleCollection } from "@conusai-kit/core"
export const DOCUMENT_COLLECTION = {
entity: "documents.document",
table: "documents_document",
key: "documentId",
scopeLevel: "project",
read: "documents.document.read",
list: "documents.document.list",
getMany: "documents.document.getMany",
} as const satisfies ModuleCollection
export const DOCUMENTS_COLLECTIONS: readonly ModuleCollection[] = [DOCUMENT_COLLECTION]