Skip to content

Commit

Permalink
EDF: [premieroctet#177] add getter for reservable tickets in event sc…
Browse files Browse the repository at this point in the history
…hema
  • Loading branch information
Bastien-Wappizy committed Dec 30, 2024
1 parent 1867566 commit c273f35
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/web/server/plugins/entreprisedufutur/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ const getRegisteredNumber = async function (userId, params, data,fields) {
return userTickets.map(ticket=> ticket.user).length
}

const getReservableTickets = async function (userId, params, data,fields) {
const user = await User.findById(userId)
const eventTickets = await EventTicket.find({event: data._id})
return eventTickets.filter((t) => {
return t.targeted_roles.includes(user.role)
})
}

module.exports = {
getRegistered,
getRegisteredNumber,
getReservableTickets,
}

0 comments on commit c273f35

Please sign in to comment.