Updated admin and mod flag system

This commit is contained in:
2021-03-24 08:22:47 +11:00
parent f60833ec17
commit e597974581
12 changed files with 134 additions and 47 deletions
+24
View File
@@ -0,0 +1,24 @@
const { accounts } = require('../database/models');
const Sequelize = require('sequelize');
const Op = Sequelize.Op;
//admin/admin
const route = async (req, res) => {
const updated = await accounts.update({
admin: false
}, {
where: {
username: {
[Op.eq]: req.body.username
}
}
});
if (!updated[0]) {
return res.status(500).send('Failed to set admin status');
}
res.status(200).end();
};
module.exports = route;