Skip to content

Commit

Permalink
Fix make not querying correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Nov 22, 2024
1 parent 01512b7 commit a21ac8e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/v1/routes/make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ app.get("/:make", async (c) => {
const { month, fuelType, vehicleType } = c.req.query();

const filter = {
...(make && { make: new RegExp(make, "i") }),
...(make && {
make: new RegExp(
`^${make.replace(/[^a-zA-Z0-9]/g, "[^a-zA-Z0-9]*")}$`,
"i",
),
}),
...(month && { month }),
...(fuelType && { fuel_type: new RegExp(`^${fuelType}$`, "i") }),
...(vehicleType && { vehicle_type: new RegExp(vehicleType, "i") }),
Expand Down

0 comments on commit a21ac8e

Please sign in to comment.