Skip to content

Commit d9002fb

Browse files
committed
[Components] gem #15752
Sources - New Candidate Actions - Create Candidate
1 parent ceca95f commit d9002fb

File tree

8 files changed

+341
-540
lines changed

8 files changed

+341
-540
lines changed

components/gem/actions/create-candidate/create-candidate.mjs

Lines changed: 138 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,170 @@
1+
import { SOURCED_FROM } from "../../common/constants.mjs";
12
import gem from "../../gem.app.mjs";
2-
import { axios } from "@pipedream/platform";
33

44
export default {
55
key: "gem-create-candidate",
66
name: "Create Candidate",
7-
description: "Creates a new candidate in Gem. [See the documentation]()",
8-
version: "0.0.{{ts}}",
7+
description: "Creates a new candidate in Gem. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post)",
8+
version: "0.0.1",
99
type: "action",
1010
props: {
1111
gem,
12-
firstName: {
12+
createdBy: {
1313
propDefinition: [
1414
gem,
15-
"firstName",
15+
"createdBy",
1616
],
1717
},
18+
firstName: {
19+
type: "string",
20+
label: "First Name",
21+
description: "Candidate's first name",
22+
optional: true,
23+
},
1824
lastName: {
19-
propDefinition: [
20-
gem,
21-
"lastName",
22-
],
25+
type: "string",
26+
label: "Last Name",
27+
description: "Candidate's last name",
28+
optional: true,
2329
},
24-
emails: {
25-
propDefinition: [
26-
gem,
27-
"emails",
28-
],
30+
nickname: {
31+
type: "string",
32+
label: "Nickname",
33+
description: "Candidate's nickname",
34+
optional: true,
2935
},
30-
jobPosition: {
31-
propDefinition: [
32-
gem,
33-
"jobPosition",
34-
],
36+
primaryEmail: {
37+
type: "string",
38+
label: "Primary Email Address",
39+
description: "Candidate's primary email address",
40+
},
41+
additionalEmails: {
42+
type: "string[]",
43+
label: "Email Addresses",
44+
description: "List of candidate's additional email addresses",
3545
optional: true,
3646
},
37-
source: {
38-
propDefinition: [
39-
gem,
40-
"source",
41-
],
47+
linkedInHandle: {
48+
type: "string",
49+
label: "LinkedIn Handle",
50+
description: "If `LinkedIn Handle` is provided, candidate creation will be de-duplicated. If a candidate with the provided `LinkedIn Handle already exists, a 400 error will be returned with `errors` containing information on the existing candidate in this shape: `{\"errors\": { \"duplicate_candidate\": { \"id\": \"string\", \"linked_in_handle\": \"string\" }}}`.",
51+
optional: true,
52+
},
53+
title: {
54+
type: "string",
55+
label: "Title",
56+
description: "Candidate's job title",
4257
optional: true,
4358
},
44-
notes: {
59+
company: {
60+
type: "string",
61+
label: "Company",
62+
description: "Candidate's company name",
63+
optional: true,
64+
},
65+
location: {
66+
type: "string",
67+
label: "Location",
68+
description: "Candidate's location",
69+
optional: true,
70+
},
71+
school: {
72+
type: "string",
73+
label: "School",
74+
description: "Candidate's school",
75+
optional: true,
76+
},
77+
educationalInfo: {
78+
type: "string[]",
79+
label: "Educational Info",
80+
description: "A list of objects containing candidate's educational information. **Format: [{\"school\": \"string\", \"parsed_university\": \"string\", \"parsed_school\": \"string\", \"start_date\": \"string\", \"end_date\": \"string\", \"field_of_study\": \"string\", \"parsed_major_1\": \"string\", \"parsed_major_2\": \"string\", \"degree\": \"string\"}]**. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post) for further details.",
81+
optional: true,
82+
},
83+
workInfo: {
84+
type: "string",
85+
label: "Work Info",
86+
description: "A list of objects containing candidate's work information. **Format: [{\"company\": \"string\", \"title\": \"string\", \"work_start_date\": \"string\", \"work_end_date\": \"string\", \"is_current\": \"string\"}]**. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post) for further details.",
87+
optional: true,
88+
},
89+
profileUrls: {
90+
type: "string[]",
91+
label: "Profile URLs",
92+
description: "If `Profile URLs` is provided with an array of urls, social `profiles` will be generated based on the provided urls and attached to the candidate",
93+
optional: true,
94+
},
95+
phoneNumber: {
96+
type: "string",
97+
label: "Phone Number",
98+
description: "Candidate's phone number",
99+
optional: true,
100+
},
101+
projectIds: {
45102
propDefinition: [
46103
gem,
47-
"notes",
104+
"projectIds",
48105
],
49106
optional: true,
50107
},
108+
customFields: {
109+
type: "string[]",
110+
label: "Custom Fields",
111+
description: "Array of objects containing new custom field values. Only custom fields specified in the array are updated. **Format: [{\"custom_field_id\": \"string\", \"value\": \"string\"}]**. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post) for further details.",
112+
optional: true,
113+
},
114+
sourcedFrom: {
115+
type: "string",
116+
label: "Sourced From",
117+
description: "Where the candidate was sourced from",
118+
options: SOURCED_FROM,
119+
optional: true,
120+
},
121+
autofill: {
122+
type: "boolean",
123+
label: "Autofill",
124+
description: "Requires `Linked In Handle` to be non-null. Attempts to fill in any missing fields.",
125+
optional: true,
126+
},
51127
},
52128
async run({ $ }) {
129+
const emails = [
130+
{
131+
email_address: this.primaryEmail,
132+
is_primary: true,
133+
},
134+
];
135+
if (this.additionalEmails) emails.push(...this.additionalEmails.map((email) => ({
136+
email_address: email,
137+
is_primary: false,
138+
})));
139+
140+
if (emails.length === 0) {
141+
throw new Error("Primary Email Address is required");
142+
}
53143
const candidate = await this.gem.createCandidate({
54-
firstName: this.firstName,
55-
lastName: this.lastName,
56-
emails: this.emails,
57-
jobPosition: this.jobPosition,
58-
source: this.source,
59-
notes: this.notes,
144+
$,
145+
data: {
146+
created_by: this.createdBy,
147+
first_name: this.firstName,
148+
last_name: this.lastName,
149+
nickname: this.nickname,
150+
emails,
151+
linked_in_handle: this.linkedInHandle,
152+
title: this.title,
153+
company: this.company,
154+
location: this.location,
155+
school: this.school,
156+
educational_info: this.educationalInfo,
157+
work_info: this.workInfo,
158+
profile_urls: this.profileUrls,
159+
phone_number: this.phoneNumber,
160+
project_ids: this.projectIds,
161+
custom_fields: this.customFields,
162+
sourced_from: this.sourcedFrom,
163+
autofill: this.autofill,
164+
},
60165
});
61166
$.export(
62-
"$summary",
63-
`Created candidate ${candidate.first_name} ${candidate.last_name} with ID: ${candidate.id}`,
167+
"$summary", `Created candidate ${candidate.first_name} ${candidate.last_name} with ID: ${candidate.id}`,
64168
);
65169
return candidate;
66170
},

components/gem/actions/update-candidate-stage/update-candidate-stage.mjs

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const LIMIT = 100;
2+
3+
export const SOURCED_FROM = [
4+
"SeekOut",
5+
"hireEZ",
6+
"Starcircle",
7+
"Censia",
8+
"Consider",
9+
];

0 commit comments

Comments
 (0)