diff --git a/lib/routes/hiring.cafe/jobs.ts b/lib/routes/hiring.cafe/jobs.ts index 1e9a680cce6b51..30d492755f6e03 100644 --- a/lib/routes/hiring.cafe/jobs.ts +++ b/lib/routes/hiring.cafe/jobs.ts @@ -59,6 +59,7 @@ interface SearchParams { readonly keywords: string; readonly page?: number; readonly size?: number; + readonly sortBy?: 'date' | 'default' | 'compensation_desc' | 'experience_asc'; } const validateSearchParams = ({ keywords, page = 0, size = CONFIG.DEFAULT_PAGE_SIZE }: SearchParams): SearchParams => ({ @@ -69,10 +70,11 @@ const validateSearchParams = ({ keywords, page = 0, size = CONFIG.DEFAULT_PAGE_S const fetchJobs = async (searchParams: SearchParams): Promise => { const payload = { - size: searchParams.size, - page: searchParams.page, + size: searchParams.size || 20, + page: searchParams.page || 0, searchState: { searchQuery: searchParams.keywords, + sortBy: searchParams.sortBy || 'date', }, };