import { assertOwnTenant } from '@voltro/plugin-multitenancy/guard' import type { AppContext } from '@voltro/runtime' const execute = async ( input: { tenantId: string; title: string }, ctx: AppContext, ) => { assertOwnTenant(input.tenantId, ctx.request.subject) // Framework auto-injects a `doc_…` id from the table's id() decl. `body` is // omitted — a `crdtText()` column is nullable and the first setBody write // establishes the document. return ctx.store.insert('documents', { title: input.title, tenantId: input.tenantId, createdAt: new Date(), }) } export default execute