Refine auth, API proxy, and server routing
This commit is contained in:
@@ -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);
|
||||
}));
|
||||
|
||||
// 更新账目
|
||||
|
||||
Reference in New Issue
Block a user