Skip to content

Commit

Permalink
feat(hiringcafe): add new payload params (DIYgod#18029)
Browse files Browse the repository at this point in the history
- default sortBy param to 'date' instead of 'default'
- add default size and page value

Signed-off-by: mintyfrankie <77310871+mintyfrankie@users.noreply.github.com>
  • Loading branch information
mintyfrankie authored Jan 2, 2025
1 parent 415793f commit 7d1fa06
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/routes/hiring.cafe/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ({
Expand All @@ -69,10 +70,11 @@ const validateSearchParams = ({ keywords, page = 0, size = CONFIG.DEFAULT_PAGE_S

const fetchJobs = async (searchParams: SearchParams): Promise<ApiResponse> => {
const payload = {
size: searchParams.size,
page: searchParams.page,
size: searchParams.size || 20,
page: searchParams.page || 0,
searchState: {
searchQuery: searchParams.keywords,
sortBy: searchParams.sortBy || 'date',
},
};

Expand Down

0 comments on commit 7d1fa06

Please sign in to comment.