- 优化财务仪表板数据展示 - 增强账户管理功能 - 改进预算和分类管理 - 完善报表和统计分析 - 优化交易管理界面 - 更新Workspace工作区 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
27 lines
701 B
TypeScript
27 lines
701 B
TypeScript
import { getRouterParam, readBody } from 'h3';
|
|
import { updateCategoryRecord } from '~/utils/finance-metadata';
|
|
import { useResponseError, useResponseSuccess } from '~/utils/response';
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const id = Number(getRouterParam(event, 'id'));
|
|
if (Number.isNaN(id)) {
|
|
return useResponseError('参数错误', -1);
|
|
}
|
|
|
|
const body = await readBody(event);
|
|
|
|
const updated = updateCategoryRecord(id, {
|
|
name: body?.name,
|
|
icon: body?.icon,
|
|
color: body?.color,
|
|
userId: body?.userId,
|
|
isActive: body?.isActive,
|
|
});
|
|
|
|
if (!updated) {
|
|
return useResponseError('分类不存在', -1);
|
|
}
|
|
|
|
return useResponseSuccess(updated);
|
|
});
|