Skip to content

Commit

Permalink
fix(events): only show public fields in list. Fixes MA-165 (#490)
Browse files Browse the repository at this point in the history
* fix(events): only show public fields in list. Fixes MA-165

* chore(events): add fields to public list

* fix(events): only show public fields if you are participant

Co-authored-by: WikiRik <[email protected]>
  • Loading branch information
diederikw and WikiRik authored Mar 31, 2021
1 parent a8bd374 commit 2fdbde0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ module.exports = {
'questions',
'max_participants',
'application_status',
'status'
'status',
'meals_per_day',
'accommodation_type',
'optional_programme',
'optional_fee',
'link_info_travel_country'
],
EVENT_TYPES: ['training', 'nwm', 'conference', 'cultural'],
CURRENT_USER_PREFIX: 'me'
Expand Down
4 changes: 3 additions & 1 deletion lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ exports.listEvents = async (req, res) => {
where: {
deleted: false,
status: 'published'
}
},
attributes: constants.EVENT_PUBLIC_FIELDS
});

const events = await Event.findAll(queryObj);
Expand Down Expand Up @@ -81,6 +82,7 @@ exports.listUserAppliedEvents = async (req, res) => {
deleted: false,
'$applications.user_id$': req.user.id
},
attributes: constants.EVENT_PUBLIC_FIELDS,
subQuery: false,
include: [{
model: Application,
Expand Down

0 comments on commit 2fdbde0

Please sign in to comment.