Skip to content

Commit

Permalink
Fix find event
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulrahmanAlsumaih committed Apr 25, 2021
1 parent 699a08a commit 05b7e35
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions backend/routes/Events.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,23 @@ router.post('/createEvents', (req, res) => {
// findEvents
router.post('/findEvents', (req, res) => {

var eventList = []
Events.find({type: "Public"})
.then(publicEvents => {
if (publicEvents)
{
publicEvents.forEach(element => {
eventList.push(element);
});
}
else{
return res.status(200).json({error: "Public does not exist"});
}
});
Admins.find({email: req.body.email})
.then(student => {
if (student)
{
var eventList = []
Events.find({type: "public"})
.then(publicEvents => {
if (publicEvents)
{
publicEvents.forEach(element => {
eventList.push(element);
});
}
});

RSOs.find({studentArray: {student: req.body.email}})
.then(rsos => {
if (rsos)
Expand Down

0 comments on commit 05b7e35

Please sign in to comment.