From c499e13c97b89d30e004329c64ac27c4c255ccbd Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 13 Dec 2024 15:47:07 +0700 Subject: [PATCH] fix age --- src/controllers/ReportController.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 3b8c3e4b..f665548d 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -50,16 +50,16 @@ export class ReportController extends Controller { @Query() ageMin?: number, @Query() ageMax?: number, ) { - if (ageMin && (ageMin < 20 || ageMin > 80)) { - throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 20 and 80"); + if (ageMin && (ageMin < 18 || ageMin > 60)) { + throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 18 and 60"); } - if (ageMax && (ageMax < 20 || ageMax > 80)) { - throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 20 and 80"); + if (ageMax && (ageMax < 18 || ageMax > 60)) { + throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 18 and 60"); } - const minAge = ageMin ?? 20; - const maxAge = ageMax ?? 80; + const minAge = ageMin ?? 18; + const maxAge = ageMax ?? 60; if (minAge > maxAge) { throw new HttpError(HttpStatus.NOT_FOUND, "ageMin cannot be greater than ageMax"); @@ -152,16 +152,16 @@ export class ReportController extends Controller { @Query() ageMin?: number, @Query() ageMax?: number, ) { - if (ageMin && (ageMin < 20 || ageMin > 80)) { - throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 20 and 80"); + if (ageMin && (ageMin < 18 || ageMin > 60)) { + throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 18 and 60"); } - if (ageMax && (ageMax < 20 || ageMax > 80)) { - throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 20 and 80"); + if (ageMax && (ageMax < 18 || ageMax > 60)) { + throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 18 and 60"); } - const minAge = ageMin ?? 20; - const maxAge = ageMax ?? 80; + const minAge = ageMin ?? 18; + const maxAge = ageMax ?? 60; if (minAge > maxAge) { throw new HttpError(HttpStatus.NOT_FOUND, "ageMin cannot be greater than ageMax");