-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding positions to the API. Deleting filter by country * adding position/id to the api * removing unused components * Fix code style issues with ESLint
- Loading branch information
1 parent
36d9780
commit 1161a8a
Showing
8 changed files
with
90 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import compact from 'lodash/compact'; | ||
import { airtableFetchRecords, airtableFetchRecord } from './airtableAPI'; | ||
import { formatJobs } from '../utils/positions'; | ||
|
||
const config = { | ||
baseName: process.env.REACT_APP_AIRTABLE_STAFF_RECRUITMENT_BASE, | ||
table: 'Positions', | ||
gridView: 'Main View', | ||
recordBuilder: (record) => ({ | ||
id: record.id, | ||
requiredExperience: record.get('Required Experience'), | ||
name: record.get('Name'), | ||
expire: record.get('Expire') ? new Date(record.get('Expire')) : false, | ||
publish: new Date(record.get('Publish')), | ||
embedVideo: record.get('Video Embed'), | ||
description: record.get('Description'), | ||
applying: record.get('Applying for position'), | ||
availableIn: record.get('AvailableIn'), | ||
requiredDocuments: record.get('Required Documents') || [], | ||
jobPacks: record.get('Job Pack') || [], | ||
type: record.get('Type'), | ||
city: record.get('City') || '', | ||
state: record.get('State/Province') || '', | ||
country: record.get('Country') || '', | ||
term: record.get('Term') || '', | ||
messageQuestion: record.get('Message Question'), | ||
isThereVideoLink: record.get('Video Link?'), | ||
displayCampusSelect: record.get('University Campus?'), | ||
salaryRange: record.get('Salary Range'), | ||
}), | ||
}; | ||
|
||
const buildFilter = () => { | ||
const isExpiredIfExpire = "IF({Expire}='', TRUE(), IS_AFTER({Expire}, NOW()))"; | ||
const isPublishedIfPublish = "OR({Publish}!='', IS_BEFORE({Publish}, NOW()))"; | ||
// const countryAvailable = `OR((FIND("${state.countrySelected.toLowerCase()}", AvailableIn) > 0), (FIND("global", AvailableIn) > 0))`; | ||
return `AND(${compact([ | ||
// state.currentFilter, | ||
isExpiredIfExpire, | ||
isPublishedIfPublish, | ||
// countryAvailable, | ||
]).join(', ')})`; | ||
}; | ||
|
||
const fetchPositions = async () => { | ||
const filters = buildFilter(); | ||
const loadedJobs = await loadPositions(filters, [ | ||
'Name', | ||
'Expire', | ||
'Description', | ||
'City', | ||
'State/Province', | ||
'Country', | ||
'Term', | ||
'Salary Range', | ||
'Publish', | ||
'Type', | ||
]); | ||
|
||
return formatJobs(loadedJobs); | ||
}; | ||
|
||
export default async (req, res) => { | ||
const positions = await fetchPositions(); | ||
res.statusCode = 200; | ||
res.setHeader('Content-Type', 'application/json'); | ||
res.end(JSON.stringify(positions)); | ||
}; | ||
|
||
export const loadPositions = async (filter, fields) => airtableFetchRecords(config, filter, fields); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
1161a8a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@camposcristian is attempting to deploy this commit to the AIME Mentoring Team on Vercel.
In order for a Deployment to be created, @camposcristian needs to request access to the Team.
Afterwards, an owner of the Team is required to accept their membership request.
1161a8a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Size Checks (0 failures)
Size Checks
Heap Snapshot Checks (0 failures)
Heap Snapshot Checks
Axe Audits (0 failures)
Axe Audits
Lighthouse Audits (0 failures)
Lighthouse Audits