import { Effect } from 'effect' import type { AppContext } from '@voltro/runtime' import { EffectStore } from '@voltro/runtime' const execute = (input: { incidentId: string; body: string }, _ctx: AppContext) => Effect.gen(function* () { const store = yield* EffectStore const row = yield* store.update('incidents', input.incidentId, { status: 'resolved', resolvedAt: new Date(), }) // A closing timeline entry (default body when the operator left it blank). yield* store.insert('incident_updates', { incidentId: input.incidentId, body: input.body === '' ? 'Resolved.' : input.body, status: 'resolved', }) return { id: input.incidentId, status: (row?.['status'] as string | undefined) ?? 'resolved', } }) export default execute