[WIP]
This commit is contained in:
parent
8729c7b906
commit
8009c157c2
37
app.js
37
app.js
@ -165,6 +165,25 @@ app.get("/:user/update", (req, res) => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post("/gd/:id/update", (req, res) => {
|
||||||
|
var token = req.body.credentials.token;
|
||||||
|
var user = req.body.credentials.username;
|
||||||
|
var id = req.params.id;
|
||||||
|
var fixed = req.query.fixed == "true";
|
||||||
|
|
||||||
|
validateAdmin(user, token).then(valid => {
|
||||||
|
if(valid){
|
||||||
|
con.query("UPDATE `gottesdienst` SET `FESTGESETZT` = " + (fixed ? 1 : 0) + " WHERE `gottesdienst`.`ID` = " + id + ";", (err, res1) => {
|
||||||
|
console.log("SUCCESSFUL", id, fixed, "UPDATE `gottesdienst` SET `FESTGESETZT` = " + (fixed ? 1 : 0) + " WHERE `gottesdienst`.`ID` = " + id + ";");
|
||||||
|
res.send({success: true});
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
console.log("Unauthorized not valid");
|
||||||
|
res.send({success: false, error: "Unauthorized"});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
app.get("/gottesdienste", (req, res) => {
|
app.get("/gottesdienste", (req, res) => {
|
||||||
var groupid = req.params.groupid;
|
var groupid = req.params.groupid;
|
||||||
@ -327,6 +346,24 @@ app.post("/add/gottesdienst", (req, res) => {
|
|||||||
// });
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post("/remove/gottesdienst", (req, res) => {
|
||||||
|
validateAdmin(req.body.credentials.username, req.body.credentials.token).then(success => {
|
||||||
|
if(success){
|
||||||
|
var id = req.body.id;
|
||||||
|
|
||||||
|
con.query("DELETE FROM `gottesdienst` WHERE `ID` = '" + id + "'", (err, result) => {
|
||||||
|
if(err){
|
||||||
|
res.send(JSON.stringify({success: false}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.send(JSON.stringify({success: true}));
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
res.send(JSON.stringify({err: "Not enough permissions"}));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
var attachToMini = function(mini, pos, then){
|
var attachToMini = function(mini, pos, then){
|
||||||
mini.registered = [];
|
mini.registered = [];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user