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