diff --git a/artifacts/api-server/src/routes/costs.ts b/artifacts/api-server/src/routes/costs.ts index 56f1617..e054f26 100644 --- a/artifacts/api-server/src/routes/costs.ts +++ b/artifacts/api-server/src/routes/costs.ts @@ -91,6 +91,11 @@ router.patch("/costs/:id", requireAuth, requireFeature("costs"), async (req, res if (currency !== undefined) updateData.currency = currency; if (notes !== undefined) updateData.notes = notes; + if (Object.keys(updateData).length === 0) { + res.json(existing); + return; + } + const [updated] = await db.update(toolCostsTable).set(updateData).where(eq(toolCostsTable.id, id)).returning(); await writeAuditLog(req, "tool_cost", id, "update", { toolId: existing.toolId, ...updateData }); res.json(updated);