// Creates a comment. The `flag`-action moderation rule (app.config.ts) checks // the body, but unlike `block` it does NOT reject — the comment is written and // flagged for review (the dashboard's Moderation panel surfaces the queue). // So there's no moderation error on this procedure. import { defineMutation } from '@voltro/protocol' import { Schema } from 'effect' export const createComment = defineMutation({ name: 'comments.create', target: { table: 'comments', op: 'insert' }, // Open, same reasoning as `posts.create` — and here the `flag` action makes // the distinction sharper still: it does not reject anything, it writes the // row and queues it for review. A rule that never refuses is plainly not an // access control, so the access decision has to be its own line. // // No auth strategy and no rbac ship here, so a `guards: [{ scope }]` would // deny every caller instead of the wrong ones. openAccess: 'inserts caller-supplied text into the request\'s tenant; the `flag` moderation rule ' + 'queues it for review and rejects nothing, so it is a review workflow rather than an ' + 'access control.', input: Schema.Struct({ body: Schema.String, }), output: Schema.Struct({ id: Schema.String, body: Schema.String, tenantId: Schema.String, }), })