- 优化财务仪表板数据展示 - 增强账户管理功能 - 改进预算和分类管理 - 完善报表和统计分析 - 优化交易管理界面 - 更新Workspace工作区 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
603 B
TypeScript
23 lines
603 B
TypeScript
import { readBody } from 'h3';
|
|
import { createCategoryRecord } from '~/utils/finance-metadata';
|
|
import { useResponseError, useResponseSuccess } from '~/utils/response';
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const body = await readBody(event);
|
|
|
|
if (!body?.name || !body?.type) {
|
|
return useResponseError('分类名称和类型为必填项', -1);
|
|
}
|
|
|
|
const category = createCategoryRecord({
|
|
name: body.name,
|
|
type: body.type,
|
|
icon: body.icon,
|
|
color: body.color,
|
|
userId: 1,
|
|
isActive: body.isActive ?? true,
|
|
});
|
|
|
|
return useResponseSuccess(category);
|
|
});
|