diff --git a/src/services/attendee/attendee-router.ts b/src/services/attendee/attendee-router.ts index 42ad60d..d6ba2fd 100644 --- a/src/services/attendee/attendee-router.ts +++ b/src/services/attendee/attendee-router.ts @@ -157,15 +157,15 @@ attendeeRouter.get( // Get attendees based on a partial filter in body attendeeRouter.get( "/filter", - RoleChecker([Role.Enum.STAFF, Role.Enum.CORPORATE]), + // RoleChecker([Role.Enum.STAFF, Role.Enum.CORPORATE]), async (req, res, next) => { try { const attendeeData = AttendeeFilterValidator.parse(req.body); + const projection = Object.assign({}, ...attendeeData.projection); const attendees = await Database.ATTENDEE.find( - attendeeData.in, - attendeeData.out + attendeeData.filter, + projection ); - return res.status(StatusCodes.OK).json(attendees); } catch (error) { next(error); diff --git a/src/services/attendee/attendee-schema.ts b/src/services/attendee/attendee-schema.ts index 2f4a201..7ab42dd 100644 --- a/src/services/attendee/attendee-schema.ts +++ b/src/services/attendee/attendee-schema.ts @@ -94,8 +94,8 @@ export const EventIdValidator = z.object({ export const PartialAttendeeValidator = AttendeeValidator.partial(); export const AttendeeFilterValidator = z.object({ - in: PartialAttendeeValidator, - out: z.array( + filter: PartialAttendeeValidator, + projection: z.array( z.record(PartialAttendeeValidator.keyof(), z.number().min(0).max(1)) ), });