Skip to content
Snippets Groups Projects

Resolve "Backend cleanup"

Merged Tobias Ingebrigt Ørstad requested to merge 95-backend-cleanup into dev
6 files
+ 134
153
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 7
7
@@ -15,7 +15,7 @@ router.delete("/:id", (req, res) => {
return;
}
// Using the database gameWare and collection players
// Using the database gameWare and collection alerts
const db = client.db("gameWare");
const collection = "alerts";
@@ -27,10 +27,10 @@ router.delete("/:id", (req, res) => {
res.status(400).send("Invalid ID");
}
// Simply checks if there is a user that matches that exact username and password
//Deletes all of the users alerts
db.collection(collection).deleteMany(
{
playerId: id
playerId: id,
},
(err, result) => {
if (err) {
@@ -38,7 +38,7 @@ router.delete("/:id", (req, res) => {
return;
}
res.json({
deletedCount: result.deletedCount
deletedCount: result.deletedCount,
});
client.close();
}
@@ -58,7 +58,7 @@ router.get("/:id", (req, res) => {
return;
}
// Using the database gameWare and collection players
// Using the database gameWare and collection alerts
const db = client.db("gameWare");
const collection = "alerts";
@@ -70,10 +70,10 @@ router.get("/:id", (req, res) => {
res.status(400).send("Invalid ID");
}
// Simply checks if there is a user that matches that exact username and password
// Simply fetches all of a users alerts
db.collection(collection)
.find({
playerId: id
playerId: id,
})
.toArray((err, result) => {
if (err) {
Loading