Skip to content

Commit 78a8c1a

Browse files
committed
some adjusts
1 parent e042186 commit 78a8c1a

File tree

2 files changed

+140
-16
lines changed

2 files changed

+140
-16
lines changed

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

Lines changed: 138 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default {
4848
linkedInHandle: {
4949
type: "string",
5050
label: "LinkedIn Handle",
51-
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+
description: "Enter your candidate's unique LinkedIn identifier (e.g., \"satyanadella\"). This helps the system check for duplicates before creating a new candidate entry.",
5252
optional: true,
5353
},
5454
title: {
@@ -75,16 +75,18 @@ export default {
7575
description: "Candidate's school",
7676
optional: true,
7777
},
78-
educationInfo: {
79-
type: "string[]",
80-
label: "Education Info",
81-
description: "A list of objects containing candidate's education 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.",
78+
educationInfoNumber: {
79+
type: "integer",
80+
label: "Education Info Quantity",
81+
description: "The number of education info objects to be created",
82+
reloadProps: true,
8283
optional: true,
8384
},
84-
workInfo: {
85-
type: "string[]",
86-
label: "Work Info",
87-
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.",
85+
workInfoNumber: {
86+
type: "integer",
87+
label: "Work Info Quantity",
88+
description: "The number of work info objects to be created",
89+
reloadProps: true,
8890
optional: true,
8991
},
9092
profileUrls: {
@@ -107,9 +109,9 @@ export default {
107109
optional: true,
108110
},
109111
customFields: {
110-
type: "string[]",
112+
type: "object",
111113
label: "Custom Fields",
112-
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.",
114+
description: "An object containing new custom field values. Only custom fields specified are updated. **Format: {\"custom_field_id\": \"value\"}**. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post) for further details.",
113115
optional: true,
114116
},
115117
sourcedFrom: {
@@ -126,7 +128,123 @@ export default {
126128
optional: true,
127129
},
128130
},
131+
async additionalProps() {
132+
const props = {};
133+
if (this.educationInfoNumber) {
134+
for (let i = 1; i <= this.educationInfoNumber; i++) {
135+
props[`educationInfo${i}School`] = {
136+
type: "string",
137+
label: `Education Info ${i} - School`,
138+
description: `Education info ${i} school of the candidate`,
139+
optional: true,
140+
};
141+
props[`educationInfo${i}University`] = {
142+
type: "string",
143+
label: `Education Info ${i} - University`,
144+
description: `Education info ${i} university of the candidate`,
145+
optional: true,
146+
};
147+
props[`educationInfo${i}StartDate`] = {
148+
type: "string",
149+
label: `Education Info ${i} - Start Date`,
150+
description: `Education info ${i} start date of the candidate`,
151+
optional: true,
152+
};
153+
props[`educationInfo${i}EndDate`] = {
154+
type: "string",
155+
label: `Education Info ${i} - End Date`,
156+
description: `Education info ${i} end date of the candidate`,
157+
optional: true,
158+
};
159+
props[`educationInfo${i}FieldOfSchool`] = {
160+
type: "string",
161+
label: `Education Info ${i} - Field Of School`,
162+
description: `Education info ${i} field of school of the candidate`,
163+
optional: true,
164+
};
165+
props[`educationInfo${i}Major1`] = {
166+
type: "string",
167+
label: `Education Info ${i} - Major 1`,
168+
description: `Education info ${i} major 1 of the candidate`,
169+
optional: true,
170+
};
171+
props[`educationInfo${i}Major2`] = {
172+
type: "string",
173+
label: `Education Info ${i} - Major 2`,
174+
description: `Education info ${i} major 2 of the candidate`,
175+
optional: true,
176+
};
177+
props[`educationInfo${i}Degree`] = {
178+
type: "string",
179+
label: `Education Info ${i} - Degree`,
180+
description: `Education info ${i} degree of the candidate`,
181+
optional: true,
182+
};
183+
}
184+
}
185+
if (this.workInfoNumber) {
186+
for (let i = 1; i <= this.workInfoNumber; i++) {
187+
props[`WorkInfo${i}Company`] = {
188+
type: "string",
189+
label: `Work Info ${i} - Company`,
190+
description: `Work info ${i} company of the candidate`,
191+
optional: true,
192+
};
193+
props[`WorkInfo${i}Title`] = {
194+
type: "string",
195+
label: `Work Info ${i} - Title`,
196+
description: `Work info ${i} title of the candidate`,
197+
optional: true,
198+
};
199+
props[`WorkInfo${i}WorkStartDate`] = {
200+
type: "string",
201+
label: `Work Info ${i} - Work Start Date`,
202+
description: `Work info ${i} work start date of the candidate`,
203+
optional: true,
204+
};
205+
props[`WorkInfo${i}WorkEndDate`] = {
206+
type: "string",
207+
label: `Work Info ${i} - Work End Date`,
208+
description: `Work info ${i} work end date of the candidate`,
209+
optional: true,
210+
};
211+
props[`WorkInfo${i}IsCurrent`] = {
212+
type: "boolean",
213+
label: `Work Info ${i} - Is Current`,
214+
description: `Work info ${i} is Current of the candidate`,
215+
optional: true,
216+
};
217+
}
218+
}
219+
220+
return props;
221+
},
129222
async run({ $ }) {
223+
const educationInfo = [];
224+
const workInfo = [];
225+
for (var i = 1; i <= this.educationInfoNumber; i++) {
226+
educationInfo.push({
227+
school: this[`educationInfo${i}School`],
228+
university: this[`educationInfo${i}University`],
229+
start_date: this[`educationInfo${i}StartDate`],
230+
end_date: this[`educationInfo${i}EndDate`],
231+
field_of_study: this[`educationInfo${i}FieldOfSchool`],
232+
major1: this[`educationInfo${i}Major1`],
233+
major2: this[`educationInfo${i}Major2`],
234+
degree: this[`educationInfo${i}Degree`],
235+
});
236+
}
237+
238+
for (var j = 1; j <= this.workInfoNumber; j++) {
239+
workInfo.push({
240+
company: this[`WorkInfo${j}Company`],
241+
title: this[`WorkInfo${j}Title`],
242+
work_start_date: this[`WorkInfo${j}WorkStartDate`],
243+
work_end_date: this[`WorkInfo${j}WorkEndDate`],
244+
is_current: this[`WorkInfo${j}IsCurrent`],
245+
});
246+
}
247+
130248
const emails = [
131249
{
132250
email_address: this.primaryEmail,
@@ -154,12 +272,18 @@ export default {
154272
company: this.company,
155273
location: this.location,
156274
school: this.school,
157-
education_info: parseObject(this.educationInfo),
158-
work_info: parseObject(this.workInfo),
275+
education_info: educationInfo,
276+
work_info: workInfo,
159277
profile_urls: parseObject(this.profileUrls),
160278
phone_number: this.phoneNumber,
161279
project_ids: parseObject(this.projectIds),
162-
custom_fields: parseObject(this.customFields),
280+
custom_fields: Object.entries(parseObject(this.customFields))?.map(([
281+
key,
282+
value,
283+
]) => ({
284+
custom_field_id: key,
285+
value,
286+
})),
163287
sourced_from: this.sourcedFrom,
164288
autofill: this.autofill,
165289
},

components/gem/gem.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export default {
2727
},
2828
projectIds: {
2929
type: "string[]",
30-
label: "Project Ids",
31-
description: "If `Project Ids` is provided with an array of project ids, the candidate will be added into the projects once they are created.",
30+
label: "Project IDs",
31+
description: "If `Project IDs` is provided with an array of project ids, the candidate will be added into the projects once they are created.",
3232
async options({ page }) {
3333
const data = await this.listProjects({
3434
params: {

0 commit comments

Comments
 (0)