Skip to content

Commit

Permalink
fix: fix search service url
Browse files Browse the repository at this point in the history
  • Loading branch information
skoriop committed Jul 29, 2024
1 parent 6f7eab3 commit 3976984
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/src/controllers/timetable/searchTimetable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const searchTimetable = async (req: Request, res: Response) => {
} = req.query;

const usefulQueryParams = {
query,
from,
year,
name,
Expand All @@ -78,16 +77,16 @@ export const searchTimetable = async (req: Request, res: Response) => {
instructor: instructorQuery,
};

let searchServiceURL = `${env.SEARCH_SERVICE_URL}/timetable/search`;
let searchServiceURL = `${env.SEARCH_SERVICE_URL}/timetable/search?query=${query}`;

for (const [key, value] of Object.entries(usefulQueryParams)) {
if (value === undefined) continue;
if (Array.isArray(value)) {
for (const v of value) {
searchServiceURL += `?${key}=${v}`;
searchServiceURL += `&${key}=${v}`;
}
} else {
searchServiceURL += `?${key}=${value}`;
searchServiceURL += `&${key}=${value}`;
}
}

Expand Down

0 comments on commit 3976984

Please sign in to comment.