init: Todo Monitor 初始提交

This commit is contained in:
2026-08-02 02:47:50 +08:00
commit a3a9972ab7
45 changed files with 7880 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { Router } from 'express'
import { getDb } from '../db.js'
const router = Router()
router.post('/', (req, res) => {
const db = getDb()
const { notes = [] } = req.body
const updateNote = db.prepare(`
UPDATE notes
SET x = ?, y = ?, width = ?, height = ?, group_id = ?,
updated_at = datetime('now', 'localtime')
WHERE id = ?
`)
const transaction = db.transaction((items) => {
for (const item of items) {
updateNote.run(item.x, item.y, item.width, item.height, item.group_id ?? null, item.id)
}
})
transaction(notes)
res.json({ success: true, count: notes.length })
})
export default router