diff --git a/worker/tasks/fetch-github.js b/worker/tasks/fetch-github.js index f57576b..020d80a 100644 --- a/worker/tasks/fetch-github.js +++ b/worker/tasks/fetch-github.js @@ -7,6 +7,16 @@ const setAsync = promisify(client.set).bind(client); const baseURL = 'https://jobs.github.com/positions.json'; +const filterAlgo = ({title}) => { + const jobTitle = title.toLowerCase(); + return !( + jobTitle.includes('senior') || + jobTitle.includes('manager') || + jobTitle.includes('sr.') || + jobTitle.includes('architect') + ); +}; + const fetchGithub = async () => { let resultCount = 1, onPage = 0; @@ -22,6 +32,13 @@ const fetchGithub = async () => { } console.log(`got ${allJobs.length} jobs`); + + // filter algo + const jrJobs = allJobs.filter(filterAlgo); + + console.log(`filtered down to ${jrJobs.length}`); + + // set in redis const successs = await setAsync('github', JSON.stringify(allJobs)); console.log(successs);