Files
kt-financial-system/apps/backend/api/finance/transactions/[id].delete.ts
你的用户名 b68511b2e2
Some checks failed
Deploy to Production / Build and Test (push) Successful in 10m51s
Deploy to Production / Deploy to Server (push) Failing after 6m41s
feat: migrate backend storage to postgres
2025-11-06 22:01:50 +08:00

19 lines
551 B
TypeScript

import { getRouterParam } from 'h3';
import { softDeleteTransaction } from '~/utils/finance-repository';
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 updated = await softDeleteTransaction(id);
if (!updated) {
return useResponseError('交易不存在', -1);
}
return useResponseSuccess({ message: '删除成功' });
});