Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

fix(greenhouse): job openings #58

Merged
merged 6 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connectors/connector-greenhouse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@openint/cdk": "workspace:*",
"@openint/util": "workspace:*",
"@opensdks/runtime": "^0.0.19",
"@opensdks/sdk-greenhouse": "^0.0.7"
"@opensdks/sdk-greenhouse": "^0.0.8"
},
"devDependencies": {}
}
12 changes: 5 additions & 7 deletions connectors/connector-postgres/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const agTableMappings = [
{from: 'integration_ats_candidate', to: 'IntegrationATSCandidate'},
{from: 'integration_ats_job_opening', to: 'IntegrationATSJobOpening'},
{from: 'integration_ats_offer', to: 'IntegrationATSOffer'},
{from: 'integration_connection', to: 'IntegrationConnection'}
{from: 'integration_connection', to: 'IntegrationConnection'},
{from: 'integration_ats_opening', to: 'IntegrationATSOpening'},
]

async function setupTable({
Expand Down Expand Up @@ -245,7 +246,7 @@ export const postgresServer = {
isOpenInt: true,
}

const isAgInsert =
const isAgInsert =
endUser?.orgId === 'org_2lcCCimyICKI8cpPNQt195h5zrP' ||
endUser?.orgId === 'org_2ms9FdeczlbrDIHJLcwGdpv3dTx'

Expand All @@ -258,11 +259,8 @@ export const postgresServer = {
rowToInsert['opening_external_id'] = data.entity?.raw?.id || '';
rowToInsert['candidate_name'] = data.entity?.raw?.first_name + ' ' + data.entity?.raw?.last_name || '';
} else if (tableName === 'IntegrationAtsJobOpening') {
rowToInsert['opening_external_id'] = data.entity?.raw?.id || '';
// NOTE Job openings are nested within Jobs and that o bject does not contain an id of the parent (job id)
// Depends on the implementation we may have to change this, leaving empty for now
// https://developers.greenhouse.io/harvest.html#the-job-object
rowToInsert['job_id'] = '';
rowToInsert['opening_external_id'] = data.entity?.raw?.opening_id || '';
rowToInsert['job_id'] = data.entity?.raw?.job_id || '';
} else if (tableName === 'IntegrationAtsOffer') {
// Note: These fields seemed duplicated from the nested objects
rowToInsert['opening_external_id'] = data.entity?.raw?.opening?.id || '';
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions unified/unified-ats/adapters/greenhouse-adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ export const greenhouseAdapter = {
if (!jobId) {
throw new Error('jobId is required');
}
// @ts-expect-error while greenhouse sdk is updated
const res = await instance.GET(`/v1/jobs/${jobId}/openings`, {
const res = await instance.GET(`/v1/jobs/{id}/openings`, {
params: {
query: {
per_page: input?.page_size,
page: cursor,
},
path: {
id: jobId,
}
},
})
let nextCursor = undefined
// @ts-expect-error while greenhouse sdk is updated
if (input?.page_size && res.data?.length === input?.page_size) {
nextCursor = (cursor || 0) + input.page_size
}
return {
has_next_page: !!nextCursor,
next_cursor: nextCursor ? String(nextCursor) : undefined,
// @ts-expect-error while greenhouse sdk is updated
items: res.data?.map((d) => applyMapper(mappers.jobOpening, d)) ?? [],
items: res.data?.map((d) => applyMapper(mappers.opening, {job_id: jobId, ...d})) ?? [],
}
},
listOffers: async ({instance, input}) => {
Expand Down
Loading