fix(board): use plain number refs in event payloads

OGraph Engine expects ref fields (subject, assignee) as plain numbers,
not {ref: N} objects. The old format caused 500 errors on event emit.
This commit is contained in:
小糯 🐱 2026-04-13 17:00:29 +08:00
parent 8702e8b1c3
commit edeb549162

View File

@ -132,7 +132,7 @@ export class OGraphClient implements TaskAPI {
body: JSON.stringify({ body: JSON.stringify({
type: "task_created", type: "task_created",
payload: { payload: {
subject: { ref: obj.id }, subject: obj.id,
title: data.title, title: data.title,
priority: data.priority ?? "p2", priority: data.priority ?? "p2",
...(data.description ? { description: data.description } : {}), ...(data.description ? { description: data.description } : {}),
@ -147,8 +147,8 @@ export class OGraphClient implements TaskAPI {
body: JSON.stringify({ body: JSON.stringify({
type: "task_assigned", type: "task_assigned",
payload: { payload: {
subject: { ref: obj.id }, subject: obj.id,
assignee: { ref: data.assigneeId }, assignee: data.assigneeId,
}, },
}), }),
}) })
@ -162,7 +162,7 @@ export class OGraphClient implements TaskAPI {
body: JSON.stringify({ body: JSON.stringify({
type: "task_status_changed", type: "task_status_changed",
payload: { payload: {
subject: { ref: obj.id }, subject: obj.id,
status, status,
}, },
}), }),
@ -194,7 +194,7 @@ export class OGraphClient implements TaskAPI {
body: JSON.stringify({ body: JSON.stringify({
type: "task_status_changed", type: "task_status_changed",
payload: { payload: {
subject: { ref: id }, subject: id,
status: data.status, status: data.status,
}, },
}), }),
@ -209,8 +209,8 @@ export class OGraphClient implements TaskAPI {
body: JSON.stringify({ body: JSON.stringify({
type: "task_assigned", type: "task_assigned",
payload: { payload: {
subject: { ref: id }, subject: id,
assignee: data.assigneeId ? { ref: data.assigneeId } : null, assignee: data.assigneeId ?? null,
}, },
}), }),
}) })
@ -241,7 +241,7 @@ export class OGraphClient implements TaskAPI {
body: JSON.stringify({ body: JSON.stringify({
type: "task_status_changed", type: "task_status_changed",
payload: { payload: {
subject: { ref: _id }, subject: _id,
status: "done", status: "done",
}, },
}), }),
@ -254,7 +254,7 @@ export class OGraphClient implements TaskAPI {
body: JSON.stringify({ body: JSON.stringify({
type: "task_status_changed", type: "task_status_changed",
payload: { payload: {
subject: { ref: id }, subject: id,
status, status,
}, },
}), }),