feat: return scrip results on ticket create, update frontend types

- POST /tickets now returns { ticket, scrip_results } matching PATCH pattern
- createTicket API function returns UpdateResult instead of Ticket
- Update call site to use data.ticket.id

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Gjermund Høsøien Wiggen
2026-06-09 10:51:14 +02:00
parent 60d2196e51
commit aa808f1d3f
5 changed files with 27 additions and 5 deletions

16
.codegraph/.gitignore vendored Normal file
View File

@@ -0,0 +1,16 @@
# CodeGraph data files
# These are local to each machine and should not be committed
# Database
*.db
*.db-wal
*.db-shm
# Cache
cache/
# Logs
*.log
# Hook markers
.dirty

6
.codegraph/daemon.pid Normal file
View File

@@ -0,0 +1,6 @@
{
"pid": 1742792,
"version": "0.9.9",
"socketPath": "/home/gjermund/projects/tessera/.codegraph/daemon.sock",
"startedAt": 1780994115213
}

View File

@@ -231,9 +231,9 @@ export function createTicketsRouter(db: Db): Hono {
const createdTransactions = await db.insert(transactions).values(txList as any).returning(); const createdTransactions = await db.insert(transactions).values(txList as any).returning();
const prepared = await scripEngine.prepare(ticket.id, createdTransactions as any); const prepared = await scripEngine.prepare(ticket.id, createdTransactions as any);
await scripEngine.commit(prepared); const results = await scripEngine.commit(prepared);
return c.json(ticket, 201); return c.json({ ticket, scrip_results: results }, 201);
}); });
// GET /:id — get ticket with custom field values // GET /:id — get ticket with custom field values

View File

@@ -428,7 +428,7 @@ function TicketWorkbenchContent() {
setNewSubject(""); setNewSubject("");
setNewDescription(""); setNewDescription("");
setNewCustomFieldValues({}); setNewCustomFieldValues({});
if (data) router.push(`/tickets/${data.id}`); if (data) router.push(`/tickets/${data.ticket.id}`);
}; };
if (loading) return <SkeletonWorkbench />; if (loading) return <SkeletonWorkbench />;

View File

@@ -63,8 +63,8 @@ export async function createTicket(data: {
queue_id: string; queue_id: string;
description?: string; description?: string;
custom_fields?: Record<string, string>; custom_fields?: Record<string, string>;
}): Promise<{ data: Ticket | null; error: string | null }> { }): Promise<{ data: UpdateResult | null; error: string | null }> {
return request<Ticket>("/tickets", { method: "POST", body: JSON.stringify(data) }); return request<UpdateResult>("/tickets", { method: "POST", body: JSON.stringify(data) });
} }
export async function updateTicket(id: number, data: { subject?: string; status?: string; owner_id?: string | null }): Promise<{ data: UpdateResult | null; error: string | null }> { export async function updateTicket(id: number, data: { subject?: string; status?: string; owner_id?: string | null }): Promise<{ data: UpdateResult | null; error: string | null }> {