Skip to content

Commit

Permalink
Merge pull request #95 from ChangePlusPlusVandy/adapt-event-model-change
Browse files Browse the repository at this point in the history
Only display published events
  • Loading branch information
JiashuHarryHuang authored Apr 28, 2024
2 parents ae45ae0 + 182fc66 commit 92a509d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pages/api/events/explore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default async function handler(
// Select all events where startDate > today order by progamDate ascending
const events = await VolunteerEvents.find({
startDate: { $gt: new Date() },
published: true,
}).sort({ startDate: 1 });

return res.status(200).json(events);
Expand Down
1 change: 1 addition & 0 deletions pages/api/events/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default async function handler(
const events = await VolunteerEvents.find({
_id: { $in: user.events },
endDate: { $lt: new Date() },
published: true,
}).sort({ eventDate: 1 });

// return the result
Expand Down
1 change: 1 addition & 0 deletions pages/api/events/log-hour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default async function handler(
const events = await VolunteerEvents.find({
_id: { $in: user.events },
startDate: { $lt: new Date() },
published: true,
}).sort({ startDate: 1 });

return res.status(200).json(events);
Expand Down
1 change: 1 addition & 0 deletions pages/api/events/past-five.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default async function handler(
const events = await VolunteerEvents.find({
_id: { $in: user.events },
endDate: { $lt: new Date() },
published: true,
})
.sort({ endDate: 1 })
.limit(5);
Expand Down
1 change: 1 addition & 0 deletions pages/api/events/upcoming-current.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default async function handler(
const currentDate = new Date();
const events = await VolunteerEvents.find({
_id: { $in: user.events },
published: true,
$or: [
{
startDate: { $gt: currentDate },
Expand Down

0 comments on commit 92a509d

Please sign in to comment.