Skip to content

Commit

Permalink
Added the filtration methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Aydan Pirani committed Jul 17, 2024
1 parent ce1ba09 commit 184cf06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/attendee/attendee-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StatusCodes } from "http-status-codes";
import {
AttendeeValidator,
EventIdValidator,
PartialAttendeeValidator,
AttendeeFilterValidator,
} from "./attendee-schema";
import { Database } from "../../database";
import RoleChecker from "../../middleware/role-checker";
Expand Down Expand Up @@ -160,7 +160,7 @@ attendeeRouter.get(
RoleChecker([Role.Enum.STAFF, Role.Enum.CORPORATE]),
async (req, res, next) => {
try {
const attendeeData = PartialAttendeeValidator.parse(req.body);
const attendeeData = AttendeeFilterValidator.parse(req.body);
const attendees = await Database.ATTENDEE.find(
attendeeData,
"userId"
Expand Down
5 changes: 5 additions & 0 deletions src/services/attendee/attendee-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,8 @@ export const EventIdValidator = z.object({

// Partial schema for attendee filter
export const PartialAttendeeValidator = AttendeeValidator.partial();

export const AttendeeFilterValidator = z.object({
in: PartialAttendeeValidator,
out: PartialAttendeeValidator,
})

Check failure on line 99 in src/services/attendee/attendee-schema.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `;`

0 comments on commit 184cf06

Please sign in to comment.