2024-11-25 14:12:44 -05:00
|
|
|
import Route from "../route.js";
|
|
|
|
import initDb from "../db.js";
|
|
|
|
import auth from "../form/auth.js";
|
|
|
|
|
|
|
|
let db = await initDb();
|
|
|
|
|
|
|
|
let main = new Route([auth], async function (req, res, input) {
|
|
|
|
let { username } = input;
|
|
|
|
|
|
|
|
let { target } = req.body;
|
2024-11-25 14:12:44 -05:00
|
|
|
if (!target) return { 'success': false, 'message': 'Some fields are missing' };
|
2024-11-25 14:12:44 -05:00
|
|
|
|
|
|
|
await db.run('DELETE FROM video WHERE id = ? AND username = ?', [
|
|
|
|
target,
|
|
|
|
username
|
|
|
|
]);
|
|
|
|
|
2024-11-25 14:12:44 -05:00
|
|
|
return { 'message': 'Video deleted', 'success': true };
|
2024-11-25 14:12:44 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
export default main;
|