Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Progark gruppe 3
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ingebrigt Ørstad
Progark gruppe 3
Merge requests
!81
Resolve "Alert in QI"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Alert in QI"
84-alert-in-qi
into
dev
Overview
0
Commits
5
Pipelines
0
Changes
4
Merged
Ivar Nordvik Myrstad
requested to merge
84-alert-in-qi
into
dev
4 years ago
Overview
0
Commits
5
Pipelines
0
Changes
4
Expand
Closes
#84 (closed)
Edited
4 years ago
by
Ivar Nordvik Myrstad
0
0
Merge request reports
Compare
dev
version 2
6e30ffba
4 years ago
version 1
3dffdd76
4 years ago
dev (base)
and
latest version
latest version
27e77a8a
5 commits,
4 years ago
version 2
6e30ffba
4 commits,
4 years ago
version 1
3dffdd76
3 commits,
4 years ago
4 files
+
88
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
backend/api/alerts.js
+
11
−
7
Options
@@ -4,7 +4,7 @@ const mongo = require("mongodb");
const
MongoClient
=
mongo
.
MongoClient
;
const
connectionUrl
=
process
.
env
.
MONGO_CONNECTION_STRING
;
router
.
delete
(
"
/:
player
"
,
(
req
,
res
)
=>
{
router
.
delete
(
"
/:
id
"
,
(
req
,
res
)
=>
{
MongoClient
.
connect
(
connectionUrl
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
},
@@ -28,23 +28,26 @@ router.delete("/:player", (req, res) => {
}
// Simply checks if there is a user that matches that exact username and password
db
.
collection
(
collection
).
remove
(
db
.
collection
(
collection
).
deleteMany
(
{
_
playerId
:
id
,
playerId
:
id
},
(
err
,
result
)
=>
{
if
(
err
)
{
res
.
sendStatus
(
500
);
return
;
}
res
.
sendStatus
(
result
);
res
.
json
({
deletedCount
:
result
.
deletedCount
});
client
.
close
();
}
);
}
);
});
router
.
get
(
"
/
user/
:id
"
,
(
req
,
res
)
=>
{
router
.
get
(
"
/:id
"
,
(
req
,
res
)
=>
{
MongoClient
.
connect
(
connectionUrl
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
},
@@ -70,14 +73,15 @@ router.get("/user/:id", (req, res) => {
// Simply checks if there is a user that matches that exact username and password
db
.
collection
(
collection
)
.
find
({
playerId
:
id
,
playerId
:
id
})
.
toArray
((
err
,
result
)
=>
{
if
(
err
)
{
res
.
sendStatus
(
500
);
return
;
}
res
.
sendStatus
(
result
);
res
.
json
(
result
);
client
.
close
();
});
}
);
Loading