Skip to content

Commit

Permalink
Merge pull request #152 from ReflectionsProjections/dev/alex/filter-p…
Browse files Browse the repository at this point in the history
…agnation

config entries per page!
  • Loading branch information
divyack2 authored Sep 13, 2024
2 parents d690b7c + 71ab9ad commit 0182fd3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const Config = {

HASH_SALT_ROUNDS: 10,
VERIFY_EXP_TIME_MS: 300,
SPONSOR_ENTIRES_PER_PAGE: 60,

// QR Scanning
QR_HASH_ITERATIONS: 10000,
Expand Down
2 changes: 1 addition & 1 deletion src/services/checkin/checkin-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const checkinRouter = Router();

checkinRouter.post(
"/scan/staff",
RoleChecker([Role.Enum.ADMIN]),
RoleChecker([Role.Enum.ADMIN, Role.Enum.STAFF]),
async (req, res, next) => {
try {
const { eventId, qrCode } = ScanValidator.parse(req.body);
Expand Down
10 changes: 8 additions & 2 deletions src/services/registration/registration-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ registrationRouter.post(
);

return res.status(StatusCodes.OK).json({
pagecount: Math.floor((registrants.length + 59) / 60),
pagecount: Math.floor(
(registrants.length + Config.SPONSOR_ENTIRES_PER_PAGE - 1) /
Config.SPONSOR_ENTIRES_PER_PAGE
),
});
} catch (error) {
next(error);
Expand Down Expand Up @@ -235,7 +238,10 @@ registrationRouter.post(
const registrants = await Database.REGISTRATION.find(
query,
projection,
{ skip: 60 * (page - 1), limit: 60 }
{
skip: Config.SPONSOR_ENTIRES_PER_PAGE * (page - 1),
limit: Config.SPONSOR_ENTIRES_PER_PAGE,
}
);

return res.status(StatusCodes.OK).json({ registrants, page });
Expand Down

0 comments on commit 0182fd3

Please sign in to comment.