feat(api): expose owner_notes in capa GET and PATCH

Adds owner_notes to the GET select query and PATCH allowed fields list to enable reading and writing owner notes for CAPA actions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 11:56:10 +08:00
co-authored by Claude Sonnet 4.6
parent 52171ac3ca
commit 96eaeb7aef
+2 -1
View File
@@ -18,6 +18,7 @@ export async function GET(
.select(` .select(`
id, incident_id, root_cause_ref, description, owner_user_id, department, id, incident_id, root_cause_ref, description, owner_user_id, department,
due_date, priority, status, completed_at, verified_by, verified_at, created_at, due_date, priority, status, completed_at, verified_by, verified_at, created_at,
owner_notes,
incidents (reference_no, incident_type), incidents (reference_no, incident_type),
owner:users!owner_user_id (name, email) owner:users!owner_user_id (name, email)
`) `)
@@ -65,7 +66,7 @@ export async function PATCH(
return NextResponse.json({ error: 'Forbidden' }, { status: 403 }) return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
} }
const allowed = ['description', 'due_date', 'priority', 'status', 'department', 'root_cause_ref'] const allowed = ['description', 'due_date', 'priority', 'status', 'department', 'root_cause_ref', 'owner_notes']
const update: Record<string, unknown> = {} const update: Record<string, unknown> = {}
for (const key of allowed) { for (const key of allowed) {
if (key in body) update[key] = body[key] if (key in body) update[key] = body[key]