Altered API, read more

I moved /auth/account/privilege to /admin/privilege

I also fixed PATCH and DELETE on /account
This commit is contained in:
2021-03-14 04:34:46 +11:00
parent 61ddd5b38f
commit b2bf1aaf92
8 changed files with 40 additions and 28 deletions
+27
View File
@@ -0,0 +1,27 @@
const bcrypt = require('bcryptjs');
const { accounts } = require('../database/models');
//auth/update
const route = async (req, res) => {
//generate the password hash
let hash;
if (req.body.password) {
hash = await bcrypt.hash(req.body.password, await bcrypt.genSalt(11));
}
//update the account
await accounts.update({
contact: req.body.contact,
hash: hash
}, {
where: {
id: req.user.id
}
});
//respond with an OK
res.status(200).end();
};
module.exports = route;