Skip to content

Commit

Permalink
return applied events in applications API not reponses
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuang2002 committed Feb 10, 2024
1 parent d799b56 commit b459919
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pages/api/applications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ export default async function handler(
const applicationResponses = await ApplicationResponse.find({
userId: session.user.id,
}).populate('eventId');

// get all the events that the user has applied to
const events = applicationResponses.map((response) => {
return response.eventId;
});

return res.status(200).json({ message: applicationResponses });
return res.status(200).json({ message: events });
} catch (error) {
console.error(error);
res.status(500).json({ message: error.message });
Expand Down

0 comments on commit b459919

Please sign in to comment.