import { defineMutation } from '@voltro/protocol' import { Schema } from 'effect' export const createNote = defineMutation({ name: 'notes.create', target: { table: 'notes', op: 'insert' }, // Open: writes only the title + body the caller sent, into the request's // tenant (`tenant()` auto-stamps `tenantId`), and touches no existing row. // No auth strategy and no rbac ship here, so every caller is an anonymous // Subject holding no scopes and a scope guard would deny all of them. openAccess: 'inserts a note built only from caller-supplied fields into the request\'s tenant; reads ' + 'nothing and modifies no existing row. No auth strategy ships here, so there is no ' + 'identity a scope guard could name.', input: Schema.Struct({ title: Schema.NonEmptyString, body: Schema.String }), output: Schema.Struct({ id: Schema.String, title: Schema.String, body: Schema.String, done: Schema.Boolean, tenantId: Schema.String, }), })