From 97f9da034842febced4b97d6f9857540a364ab79 Mon Sep 17 00:00:00 2001 From: snowgitea Date: Wed, 29 Apr 2026 02:08:50 +0800 Subject: [PATCH] chore: remove backend/check-data.cjs --- backend/check-data.cjs | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 backend/check-data.cjs diff --git a/backend/check-data.cjs b/backend/check-data.cjs deleted file mode 100644 index d0fd844..0000000 --- a/backend/check-data.cjs +++ /dev/null @@ -1,38 +0,0 @@ -// 检查数据库数据 -const { PrismaClient } = require('@prisma/client'); -const prisma = new PrismaClient(); - -async function checkData() { - console.log('=== 检查数据库数据 ===\n'); - - // 1. 检查用户 - const users = await prisma.user.findMany(); - console.log('用户:', users); - - // 2. 检查账户 - const accounts = await prisma.account.findMany({ where: { userId: 1 } }); - console.log('\n账户:', accounts); - console.log('账户余额总和:', accounts.reduce((sum, a) => sum + parseFloat(a.balance), 0)); - - // 3. 检查预算 - const budgets = await prisma.budget.findMany({ where: { userId: 1 } }); - console.log('\n预算:', budgets); - console.log('预算金额总和:', budgets.reduce((sum, b) => sum + parseFloat(b.amount), 0)); - - // 4. 检查本月记录 - const now = new Date(); - const month = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`; - const startDate = new Date(month + '-01'); - const endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0); - - const records = await prisma.record.findMany({ - where: { userId: 1, date: { gte: startDate, lte: endDate } } - }); - console.log('\n本月记录:', records.length, '条'); - console.log('总收入:', records.filter(r => r.type === 'income').reduce((sum, r) => sum + parseFloat(r.amount), 0)); - console.log('总支出:', records.filter(r => r.type === 'expense').reduce((sum, r) => sum + parseFloat(r.amount), 0)); - - await prisma.$disconnect(); -} - -checkData().catch(console.error);