import db from '../../database/models/index.js'; /** Must match `REQUEST_TYPES` / collaboration / `RequestParticipant` (use `constitutional`, not `constitutional-change`). */ export type WorkflowActivityRequestType = | 'relocation' | 'constitutional' | 'resignation' | 'termination'; /** * Persists a workflow / decision line for Work Notes (UI: activity strip when noteType is internal | workflow). * No-op if noteText is empty after trim. */ export async function writeWorkflowActivityWorknote(opts: { requestId: string; requestType: WorkflowActivityRequestType; userId: string; noteText: string; noteType: 'internal' | 'workflow'; }): Promise { const text = String(opts.noteText || '').trim(); if (!text) return; await db.Worknote.create({ requestId: opts.requestId, requestType: opts.requestType, userId: opts.userId, noteText: text, noteType: opts.noteType, status: 'active' }); }