Skip to content

Commit

Permalink
Merge pull request #105 from ReflectionsProjections/dev/aydan/store-a…
Browse files Browse the repository at this point in the history
…ttendee-resumes

Finally Fix Filter
  • Loading branch information
AydanPirani authored Jul 17, 2024
2 parents bd3e61c + 17d31f5 commit fbe965c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/services/attendee/attendee-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ attendeeRouter.get(
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);
Expand Down
6 changes: 4 additions & 2 deletions src/services/attendee/attendee-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export const EventIdValidator = z.object({
export const PartialAttendeeValidator = AttendeeValidator.partial();

export const AttendeeFilterValidator = z.object({
in: PartialAttendeeValidator,
out: z.map(PartialAttendeeValidator.keyof(), z.number().min(0).max(1)),
filter: PartialAttendeeValidator,
projection: z.array(
z.record(PartialAttendeeValidator.keyof(), z.number().min(1).max(1))
),
});

0 comments on commit fbe965c

Please sign in to comment.