fix(api): parse price filters as dollars

This commit is contained in:
2026-04-30 23:17:56 -04:00
parent 5c732287c5
commit 89ad1c521f
4 changed files with 91 additions and 36 deletions

View File

@@ -3,6 +3,7 @@ import { logger } from "../logger";
import {
emptySearchResponse,
getRequiredSearchQuery,
parseDollarPriceParam,
parseNonNegativeIntegerParam,
} from "./helpers";
@@ -26,17 +27,11 @@ export async function kijijiRoute(req: Request): Promise<Response> {
if (maxPages instanceof Response) {
return maxPages;
}
const priceMin = parseNonNegativeIntegerParam(
reqUrl.searchParams,
"priceMin",
);
const priceMin = parseDollarPriceParam(reqUrl.searchParams, "priceMin");
if (priceMin instanceof Response) {
return priceMin;
}
const priceMax = parseNonNegativeIntegerParam(
reqUrl.searchParams,
"priceMax",
);
const priceMax = parseDollarPriceParam(reqUrl.searchParams, "priceMax");
if (priceMax instanceof Response) {
return priceMax;
}