import { defineMutation } from '@voltro/protocol' import { Schema } from 'effect' export const createUser = defineMutation({ name: 'users.create', target: { table: 'users', op: 'insert' }, // Writes exactly the email + name the caller passed, into this template's own // `users` demo table, and echoes them back. It reads nothing and can reach no // existing row (`email` is `.unique()`, so a duplicate fails rather than // overwriting). No identity ships with this template, so a scope guard would // deny every caller. openAccess: 'inserts only the fields the caller supplied into the demo `users` table and echoes them ' + 'back; reads nothing and cannot modify an existing row (`email` is unique).', input: Schema.Struct({ email: Schema.NonEmptyString, name: Schema.String, }), output: Schema.Struct({ id: Schema.String, email: Schema.String, name: Schema.String, }), })