Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [REVER-51] Workable Integration #566

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
65 changes: 65 additions & 0 deletions fern/definition/ats/candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
imports:
errors: ../common/errors.yml
types: ../common/types.yml
unified: ../common/unified.yml

types:
GetCandidateResponse:
properties:
status: types.ResponseStatus
result: unified.Candidate
GetCandidatesResponse:
properties:
status: types.ResponseStatus
next: optional<string>
previous: optional<string>
results: list<unified.Candidate>

service:
base-path: /ats/candidates
auth: false
headers:
x-revert-api-token:
type: string
docs: Your official API key for accessing revert apis.
x-revert-t-id:
type: string
docs: The unique customer id used when the customer linked their account.
x-api-version:
type: optional<string>
docs: Optional Revert API version you're using. If missing we default to the latest version of the API.
audiences:
- external
endpoints:
getCandidate:
docs: Get details of a candidate.
method: GET
path: /{id}
path-parameters:
id:
type: string
docs: The unique `id` of the candidate.
request:
name: GetCandidateRequest
query-parameters:
fields: optional<string>
response: GetCandidateResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
getCandidates:
docs: Get all the Candidates.
method: GET
path: ''
request:
name: GetCandidatesRequest
query-parameters:
fields: optional<string>
pageSize: optional<string>
cursor: optional<string>
response: GetCandidatesResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
65 changes: 65 additions & 0 deletions fern/definition/ats/department.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
imports:
errors: ../common/errors.yml
types: ../common/types.yml
unified: ../common/unified.yml

types:
GetDepartmentResponse:
properties:
status: types.ResponseStatus
result: unified.Department
GetDepartmentsResponse:
properties:
status: types.ResponseStatus
next: optional<string>
previous: optional<string>
results: list<unified.Department>

service:
base-path: /ats/departments
auth: false
headers:
x-revert-api-token:
type: string
docs: Your official API key for accessing revert apis.
x-revert-t-id:
type: string
docs: The unique customer id used when the customer linked their account.
x-api-version:
type: optional<string>
docs: Optional Revert API version you're using. If missing we default to the latest version of the API.
audiences:
- external
endpoints:
getDepartment:
docs: Get details of a department.
method: GET
path: /{id}
path-parameters:
id:
type: string
docs: The unique `id` of the department.
request:
name: GetDepartmentRequest
query-parameters:
fields: optional<string>
response: GetDepartmentResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
getDepartments:
docs: Get all the departments.
method: GET
path: ''
request:
name: GetDepartmentsRequest
query-parameters:
fields: optional<string>
pageSize: optional<string>
cursor: optional<string>
response: GetDepartmentsResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
65 changes: 65 additions & 0 deletions fern/definition/ats/job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
imports:
errors: ../common/errors.yml
types: ../common/types.yml
unified: ../common/unified.yml

types:
GetJobResponse:
properties:
status: types.ResponseStatus
result: unified.Job
GetJobsResponse:
properties:
status: types.ResponseStatus
next: optional<string>
previous: optional<string>
results: list<unified.Job>

service:
base-path: /ats/jobs
auth: false
headers:
x-revert-api-token:
type: string
docs: Your official API key for accessing revert apis.
x-revert-t-id:
type: string
docs: The unique customer id used when the customer linked their account.
x-api-version:
type: optional<string>
docs: Optional Revert API version you're using. If missing we default to the latest version of the API.
audiences:
- external
endpoints:
getJob:
docs: Get details of a job.
method: GET
path: /{id}
path-parameters:
id:
type: string
docs: The unique `id` of the job.
request:
name: GetJobRequest
query-parameters:
fields: optional<string>
response: GetJobResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
getJobs:
docs: Get all the jobs.
method: GET
path: ''
request:
name: GetJobsRequest
query-parameters:
fields: optional<string>
pageSize: optional<string>
cursor: optional<string>
response: GetJobsResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
65 changes: 65 additions & 0 deletions fern/definition/ats/offer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
imports:
errors: ../common/errors.yml
types: ../common/types.yml
unified: ../common/unified.yml

types:
GetOfferResponse:
properties:
status: types.ResponseStatus
result: unified.Offer
GetOffersResponse:
properties:
status: types.ResponseStatus
next: optional<string>
previous: optional<string>
results: list<unified.Offer>

service:
base-path: /ats/offers
auth: false
headers:
x-revert-api-token:
type: string
docs: Your official API key for accessing revert apis.
x-revert-t-id:
type: string
docs: The unique customer id used when the customer linked their account.
x-api-version:
type: optional<string>
docs: Optional Revert API version you're using. If missing we default to the latest version of the API.
audiences:
- external
endpoints:
getOffer:
docs: Get details of a offer.
method: GET
path: /{id}
path-parameters:
id:
type: string
docs: The unique `id` of the offer.
request:
name: GetOfferRequest
query-parameters:
fields: optional<string>
response: GetOfferResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
getOffers:
docs: Get all the offers.
method: GET
path: ''
request:
name: GetOffersRequest
query-parameters:
fields: optional<string>
pageSize: optional<string>
cursor: optional<string>
response: GetOffersResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
43 changes: 43 additions & 0 deletions fern/definition/ats/proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
imports:
errors: ../common/errors.yml
types: ../common/types.yml

types:
ProxyResponse:
properties:
result: unknown
PostProxyRequestBody:
properties:
path: string
body: optional<unknown>
method: string
queryParams: optional<unknown>

service:
base-path: /ats/proxy
auth: false
headers:
x-revert-api-token:
type: string
docs: Your official API key for accessing revert apis.
x-revert-t-id:
type: string
docs: The unique customer id used when the customer linked their account.
x-api-version:
type: optional<string>
docs: Optional Revert API version you're using. If missing we default to the latest version of the API.
audiences:
- external
endpoints:
tunnel:
docs: Call the native ATS api for a specific connection
method: POST
path: ''
request:
name: PostProxyRequest
body: PostProxyRequestBody
response: ProxyResponse
errors:
- errors.UnAuthorizedError
- errors.InternalServerError
- errors.NotFoundError
5 changes: 4 additions & 1 deletion packages/backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ OPEN_INT_API_KEY=
TWENTY_ACCOUNT_ID=
BITBUCKET_CLIENT_ID=
BITBUCKET_CLIENT_SECRET=
DEFAULT_RATE_LIMIT_DEVELOPER_PLAN=
DEFAULT_RATE_LIMIT_DEVELOPER_PLAN=
WORKABLE_CLIENT_ID=
WORKABLE_CLIENT_SECRET=
WORKABLE_ORG_URL=
3 changes: 3 additions & 0 deletions packages/backend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const config = {
OPEN_INT_BASE_API_URL: process.env.OPEN_INT_BASE_API_URL,
TWENTY_ACCOUNT_ID: process.env.TWENTY_ACCOUNT_ID,
DEFAULT_RATE_LIMIT_DEVELOPER_PLAN: process.env.DEFAULT_RATE_LIMIT_DEVELOPER_PLAN,
WORKABLE_CLIENT_ID: process.env.WORKABLE_CLIENT_ID!,
WORKABLE_CLIENT_SECRET: process.env.WORKABLE_CLIENT_SECRET!,
WORKABLE_ORG_URL: process.env.WORKABLE_ORG_URL!,
};

export default config;
10 changes: 10 additions & 0 deletions packages/backend/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Request, Response } from 'express';
export type CRM_TP_ID = 'zohocrm' | 'sfdc' | 'pipedrive' | 'hubspot' | 'closecrm' | 'ms_dynamics_365_sales';
export type CHAT_TP_ID = 'slack' | 'discord';
export type TICKET_TP_ID = 'linear' | 'clickup' | 'asana' | 'jira' | 'trello' | 'bitbucket';
export type ATS_TP_ID = 'workable';

export const DEFAULT_SCOPE = {
[TP_ID.hubspot]: [
Expand Down Expand Up @@ -49,6 +50,7 @@ export const DEFAULT_SCOPE = {
[TP_ID.jira]: ['read:jira-work', 'read:jira-user', 'write:jira-work', 'offline_access'],
[TP_ID.ms_dynamics_365_sales]: ['offline_access', 'User.Read'],
[TP_ID.bitbucket]: ['issue', 'issue:write', 'repository', 'account'],
[TP_ID.workable]: [],
};

export const mapIntegrationIdToIntegrationName = {
Expand All @@ -66,6 +68,7 @@ export const mapIntegrationIdToIntegrationName = {
[TP_ID.jira]: 'Jira',
[TP_ID.ms_dynamics_365_sales]: 'Microsoft Dynamics 365 Sales',
[TP_ID.bitbucket]: 'Bitbucket',
[TP_ID.workable]: 'Workable',
};

export const rootSchemaMappingId = 'revertRootSchemaMapping';
Expand Down Expand Up @@ -93,6 +96,13 @@ export enum TicketStandardObjects {
ticketComment = 'ticketComment',
}

export enum AtsStandardObjects {
jobs = 'jobs',
offers = 'offers',
candidates = 'candidates',
departments = 'departments',
}

export const objectNameMapping: Record<string, Record<CRM_TP_ID, string | undefined>> = {
[StandardObjects.company]: {
[TP_ID.hubspot]: 'companies',
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/helpers/crm/transform/preprocess.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TP_ID } from '@prisma/client';
import {
AtsStandardObjects,
CRM_TP_ID,
ChatStandardObjects,
StandardObjects,
Expand All @@ -17,7 +18,7 @@ export const preprocessUnifyObject = <T extends Record<string, any>>({
}: {
obj: T;
tpId: CRM_TP_ID | TICKET_TP_ID;
objType: StandardObjects | ChatStandardObjects | TicketStandardObjects;
objType: StandardObjects | ChatStandardObjects | TicketStandardObjects | AtsStandardObjects;
}) => {
const preprocessMap: any = {
[TP_ID.hubspot]: {
Expand Down
Loading