Refine auth, API proxy, and server routing

This commit is contained in:
Developer
2026-05-18 15:16:46 +08:00
parent 4ad1766f10
commit d10dd53884
9 changed files with 88 additions and 17 deletions
+4 -1
View File
@@ -48,7 +48,10 @@ router.post('/', authenticate, asyncHandler(async (req, res) => {
const result = stmt.run(req.userId, type, amount, category.trim(), date, normalizeNote(note));
console.log(`Record created: user=${req.userId}, id=${result.lastInsertRowid}`);
res.json({ id: result.lastInsertRowid, message: '添加成功' });
const createdRecord = db.prepare('SELECT * FROM records WHERE id = ? AND user_id = ?')
.get(result.lastInsertRowid, req.userId);
res.json(createdRecord);
}));
// 更新账目