1
0
mirror of synced 2025-10-29 10:29:18 +00:00

added server management

This commit is contained in:
Valentin PUCCETTI
2023-09-11 15:21:36 +02:00
parent 298ef6d873
commit a034396dbe
23 changed files with 553 additions and 177 deletions

View File

@@ -1,4 +1,8 @@
const User = require('../model/user.model')
const Key = require("../model/key.model");
const regexp = /^\S*$/;
async function userList(code) {
return await User.findAll()
@@ -15,6 +19,23 @@ function makeAdmin(userId) {
});
}
async function delUser(id) {
User.findOne({where: { id: id}}).then((result) => {
if (result && regexp.test(id)) {
result.destroy()
.then(() => {
console.log('user ' + id + ' deleted from database')
});
} else {
return false;
}
});
}
module.exports = {
makeAdmin
makeAdmin,
delUser,
};