bigly-chat/form/delete_video.js

22 lines
596 B
JavaScript
Raw Normal View History

2024-10-24 22:41:21 -04:00
import Route from "../route.js";
import initDb from "../db.js";
import auth from "../form/auth.js";
let db = await initDb();
// TODO: rewrite
let main = new Route([auth], async function (req, res, input) {
let { username } = input;
let { target } = req.body;
if (!target ) return { 'success': false, 'message': 'Some fields are missing' }; // probably should not re-use these strings
await db.run('DELETE FROM video WHERE id = ? AND username = ?', [
target,
username
]);
return { 'message': 'Video deleted', 'success': true};
});
export default main;