21 lines
No EOL
535 B
JavaScript
21 lines
No EOL
535 B
JavaScript
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;
|
|
if (!target) return { 'success': false, 'message': 'Some fields are missing' };
|
|
|
|
await db.run('DELETE FROM video WHERE id = ? AND username = ?', [
|
|
target,
|
|
username
|
|
]);
|
|
|
|
return { 'message': 'Video deleted', 'success': true };
|
|
});
|
|
|
|
export default main; |