Skip to content

Commit

Permalink
config entries per pa
Browse files Browse the repository at this point in the history
ge
  • Loading branch information
aletya committed Sep 13, 2024
1 parent 003085d commit d6a5453
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 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,
ENTIRES_PER_PAGE: 60,

// QR Scanning
QR_HASH_ITERATIONS: 10000,
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) /

Check failure on line 194 in src/services/registration/registration-router.ts

View workflow job for this annotation

GitHub Actions / build

Property 'SPONSOR_ENTIRES_PER_PAGE' does not exist on type '{ DEFAULT_APP_PORT: number; ALLOWED_CORS_ORIGIN_PATTERNS: RegExp[]; ENV: "PRODUCTION" | "DEVELOPMENT" | "TESTING"; DATABASE_USERNAME: string; DATABASE_PASSWORD: string; DATABASE_HOST: string; ... 21 more ...; OUTGOING_EMAIL_ADDRESSES: ZodEnum<...>; }'. Did you mean 'ENTIRES_PER_PAGE'?
Config.SPONSOR_ENTIRES_PER_PAGE

Check failure on line 195 in src/services/registration/registration-router.ts

View workflow job for this annotation

GitHub Actions / build

Property 'SPONSOR_ENTIRES_PER_PAGE' does not exist on type '{ DEFAULT_APP_PORT: number; ALLOWED_CORS_ORIGIN_PATTERNS: RegExp[]; ENV: "PRODUCTION" | "DEVELOPMENT" | "TESTING"; DATABASE_USERNAME: string; DATABASE_PASSWORD: string; DATABASE_HOST: string; ... 21 more ...; OUTGOING_EMAIL_ADDRESSES: ZodEnum<...>; }'. Did you mean '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),

Check failure on line 242 in src/services/registration/registration-router.ts

View workflow job for this annotation

GitHub Actions / build

Property 'SPONSOR_ENTIRES_PER_PAGE' does not exist on type '{ DEFAULT_APP_PORT: number; ALLOWED_CORS_ORIGIN_PATTERNS: RegExp[]; ENV: "PRODUCTION" | "DEVELOPMENT" | "TESTING"; DATABASE_USERNAME: string; DATABASE_PASSWORD: string; DATABASE_HOST: string; ... 21 more ...; OUTGOING_EMAIL_ADDRESSES: ZodEnum<...>; }'. Did you mean 'ENTIRES_PER_PAGE'?
limit: Config.SPONSOR_ENTIRES_PER_PAGE,

Check failure on line 243 in src/services/registration/registration-router.ts

View workflow job for this annotation

GitHub Actions / build

Property 'SPONSOR_ENTIRES_PER_PAGE' does not exist on type '{ DEFAULT_APP_PORT: number; ALLOWED_CORS_ORIGIN_PATTERNS: RegExp[]; ENV: "PRODUCTION" | "DEVELOPMENT" | "TESTING"; DATABASE_USERNAME: string; DATABASE_PASSWORD: string; DATABASE_HOST: string; ... 21 more ...; OUTGOING_EMAIL_ADDRESSES: ZodEnum<...>; }'. Did you mean 'ENTIRES_PER_PAGE'?
}
);

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

0 comments on commit d6a5453

Please sign in to comment.