This commit is contained in:
AdisakKanthawilang 2024-12-13 15:47:07 +07:00
parent 72b5f30fac
commit c499e13c97

View file

@ -50,16 +50,16 @@ export class ReportController extends Controller {
@Query() ageMin?: number, @Query() ageMin?: number,
@Query() ageMax?: number, @Query() ageMax?: number,
) { ) {
if (ageMin && (ageMin < 20 || ageMin > 80)) { if (ageMin && (ageMin < 18 || ageMin > 60)) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 20 and 80"); throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 18 and 60");
} }
if (ageMax && (ageMax < 20 || ageMax > 80)) { if (ageMax && (ageMax < 18 || ageMax > 60)) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 20 and 80"); throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 18 and 60");
} }
const minAge = ageMin ?? 20; const minAge = ageMin ?? 18;
const maxAge = ageMax ?? 80; const maxAge = ageMax ?? 60;
if (minAge > maxAge) { if (minAge > maxAge) {
throw new HttpError(HttpStatus.NOT_FOUND, "ageMin cannot be greater than ageMax"); 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() ageMin?: number,
@Query() ageMax?: number, @Query() ageMax?: number,
) { ) {
if (ageMin && (ageMin < 20 || ageMin > 80)) { if (ageMin && (ageMin < 18 || ageMin > 60)) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 20 and 80"); throw new HttpError(HttpStatus.BAD_REQUEST, "ageMin must be between 18 and 60");
} }
if (ageMax && (ageMax < 20 || ageMax > 80)) { if (ageMax && (ageMax < 18 || ageMax > 60)) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 20 and 80"); throw new HttpError(HttpStatus.BAD_REQUEST, "ageMax must be between 18 and 60");
} }
const minAge = ageMin ?? 20; const minAge = ageMin ?? 18;
const maxAge = ageMax ?? 80; const maxAge = ageMax ?? 60;
if (minAge > maxAge) { if (minAge > maxAge) {
throw new HttpError(HttpStatus.NOT_FOUND, "ageMin cannot be greater than ageMax"); throw new HttpError(HttpStatus.NOT_FOUND, "ageMin cannot be greater than ageMax");