Files
kt-financial-system/apps/backend/api/telegram/notifications/[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

22 lines
584 B
TypeScript

import { query } from '~/utils/db';
import { useResponseError, useResponseSuccess } from '~/utils/response';
export default defineEventHandler(async (event) => {
const idParam = event.context.params?.id;
const id = Number(idParam);
if (!idParam || Number.isNaN(id)) {
return useResponseError('缺少ID参数', -1);
}
const result = await query(
'DELETE FROM telegram_notification_configs WHERE id = $1',
[id],
);
if (result.rowCount === 0) {
return useResponseError('配置不存在或删除失败', -1);
}
return useResponseSuccess({ id });
});