import { Effect } from 'effect' import type { AppContext } from '@voltro/runtime' import { EffectStore } from '@voltro/runtime' const execute = ( input: { incidentId: string; body: string; status: string }, _ctx: AppContext, ) => Effect.gen(function* () { const store = yield* EffectStore // Advance the incident's own status so the banner reflects the latest note. yield* store.update('incidents', input.incidentId, { status: input.status }) // Append the timeline entry. const row = yield* store.insert('incident_updates', { incidentId: input.incidentId, body: input.body, status: input.status, }) return { id: row['id'] as string, incidentId: row['incidentId'] as string, status: row['status'] as string, } }) export default execute