// Authz-free here: by the time this runs the framework has already enforced the // `status:write` guard from the descriptor. A new incident opens in the // `investigating` state; `startedAt` is stamped by the column default. import { Effect } from 'effect' import type { AppContext } from '@voltro/runtime' import { EffectStore } from '@voltro/runtime' const execute = (input: { title: string; impact: string }, _ctx: AppContext) => Effect.gen(function* () { const store = yield* EffectStore const row = yield* store.insert('incidents', { title: input.title, impact: input.impact, status: 'investigating', resolvedAt: null, }) return { id: row['id'] as string, title: row['title'] as string, impact: row['impact'] as string, status: row['status'] as string, } }) export default execute