Skip to content

New Components - smartymeet #12701

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import smartymeet from "../../smartymeet.app.mjs";

export default {
key: "smartymeet-create-candidate",
name: "Create Candidate",
description: "Creates a new candidate profile in SmartyMeet. [See the documentation](https://docs.smartymeet.com/category/smartymeet-versioned-api)",
version: "0.0.{{ts}}",
type: "action",
props: {
smartymeet,
name: {
type: "string",
label: "Name",
description: "The candidate's name.",
},
status: {
type: "string",
label: "Status",
description: "The candidate's status.",
options: [
"active",
"rejected",
"archived",
"closed",
],
optional: true,
},
phone: {
type: "string",
label: "Phone",
description: "The candidate's phone.",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "The candidate's email.",
optional: true,
},
/* talentId: {
propDefinition: [
smartymeet,
"talentId",
],
}, */
jobId: {
propDefinition: [
smartymeet,
"jobId",
],
},
},
async run({ $ }) {
const response = await this.smartymeet.createCandidate({
$,
data: {
type: "candidates",
attributes: {
name: this.name,
status: this.status,
phone: this.phone,
email: this.email,
},
relationships: {
/* talents: {
type: "talents",
id: this.talentId,
}, */
jobs: {
type: "jobs",
id: this.jobId,
},
},
},
});

$.export("$summary", `Successfully created candidate with Id: ${response.data.id}`);
return response;
},
};
Comment on lines +1 to +80
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Address commented-out code and improve error handling.

The action implementation is correct. However, consider the following improvements:

  1. Remove or address the commented-out code related to talentId.
  2. Improve error handling by checking the response status.
async run({ $ }) {
  const response = await this.smartymeet.createCandidate({
    $,
    data: {
      type: "candidates",
      attributes: {
        name: this.name,
        status: this.status,
        phone: this.phone,
        email: this.email,
      },
      relationships: {
        jobs: {
          type: "jobs",
          id: this.jobId,
        },
      },
    },
  });

  if (response && response.data && response.data.id) {
    $.export("$summary", `Successfully created candidate with Id: ${response.data.id}`);
    return response;
  }

  throw new Error("Failed to create candidate");
}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import smartymeet from "../../smartymeet.app.mjs";
export default {
key: "smartymeet-create-candidate",
name: "Create Candidate",
description: "Creates a new candidate profile in SmartyMeet. [See the documentation](https://docs.smartymeet.com/category/smartymeet-versioned-api)",
version: "0.0.{{ts}}",
type: "action",
props: {
smartymeet,
name: {
type: "string",
label: "Name",
description: "The candidate's name.",
},
status: {
type: "string",
label: "Status",
description: "The candidate's status.",
options: [
"active",
"rejected",
"archived",
"closed",
],
optional: true,
},
phone: {
type: "string",
label: "Phone",
description: "The candidate's phone.",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "The candidate's email.",
optional: true,
},
/* talentId: {
propDefinition: [
smartymeet,
"talentId",
],
}, */
jobId: {
propDefinition: [
smartymeet,
"jobId",
],
},
},
async run({ $ }) {
const response = await this.smartymeet.createCandidate({
$,
data: {
type: "candidates",
attributes: {
name: this.name,
status: this.status,
phone: this.phone,
email: this.email,
},
relationships: {
/* talents: {
type: "talents",
id: this.talentId,
}, */
jobs: {
type: "jobs",
id: this.jobId,
},
},
},
});
$.export("$summary", `Successfully created candidate with Id: ${response.data.id}`);
return response;
},
};
async run({ $ }) {
const response = await this.smartymeet.createCandidate({
$,
data: {
type: "candidates",
attributes: {
name: this.name,
status: this.status,
phone: this.phone,
email: this.email,
},
relationships: {
jobs: {
type: "jobs",
id: this.jobId,
},
},
},
});
if (response && response.data && response.data.id) {
$.export("$summary", `Successfully created candidate with Id: ${response.data.id}`);
return response;
}
throw new Error("Failed to create candidate");
}

140 changes: 140 additions & 0 deletions components/smartymeet/actions/create-job/create-job.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import {
CURRENCY_OPTIONS, EDUCATION_OPTIONS, EXPERIENCE_OPTIONS, INDUSTRY_OPTIONS,
JOB_FUNCTION_OPTIONS,
JOB_TYPE_OPTIONS,
STATUS_OPTIONS, WORKPLACE_OPTIONS,
} from "../../common/constants.mjs";
import { parseObject } from "../../common/utils.mjs";
import smartymeet from "../../smartymeet.app.mjs";

export default {
key: "smartymeet-create-job",
name: "Create Job",
description: "Generates a new job in the SmartyMeet system. [See the documentation](https://docs.smartymeet.com/smartymeet_versioned/jobs)",
version: "0.0.{{ts}}",
type: "action",
props: {
smartymeet,
title: {
type: "string",
label: "Title",
description: "The job's title.",
optional: true,
},
status: {
type: "string",
label: "Status",
description: "The Job's status.",
options: STATUS_OPTIONS,
optional: true,
},
candidates: {
type: "integer",
label: "Candidates",
description: "The candidates' quantity.",
optional: true,
},
workplace: {
type: "string",
label: "workplace",
description: "workplace",
options: WORKPLACE_OPTIONS,
optional: true,
},
description: {
type: "string",
label: "Description",
description: "The job's description.",
optional: true,
},
industry: {
type: "string",
label: "Industry",
description: "The company industry.",
options: INDUSTRY_OPTIONS,
optional: true,
},
jobFunction: {
type: "string",
label: "Job Function",
description: "The job function title.",
options: JOB_FUNCTION_OPTIONS,
optional: true,
},
jobType: {
type: "string",
label: "Job Type",
description: "The employment type.",
options: JOB_TYPE_OPTIONS,
optional: true,
},
experience: {
type: "string",
label: "Experience",
description: "The expected candidate's experience.",
options: EXPERIENCE_OPTIONS,
optional: true,
},
education: {
type: "string",
label: "Education",
description: "The expected candidate's education.",
options: EDUCATION_OPTIONS,
optional: true,
},
salaryFrom: {
type: "string",
label: "Salary From",
description: "The minimum salary amount.",
optional: true,
},
salaryTo: {
type: "string",
label: "Salary To",
description: "The maximum salary amount.",
optional: true,
},
currency: {
type: "string",
label: "Currency",
description: "The salary currency.",
options: CURRENCY_OPTIONS,
optional: true,
},
keywords: {
type: "string[]",
label: "keywords",
description: "keywords",
optional: true,
},
},
async run({ $ }) {
const response = await this.smartymeet.createJob({
$,
data: {
type: "jobs",
attributes: {
title: this.title,
status: this.status,
candidates: this.candidates,
workplace: this.workplace,
description: this.description,
industry: this.industry,
jobFunction: this.jobFunction,
jobType: this.jobType,
experience: this.experience,
education: this.education,
salary: {
from: this.salaryFrom,
to: this.salaryTo,
},
currency: this.currency,
keywords: parseObject(this.keywords),
},
},
});

$.export("$summary", `Successfully created job with title "${this.jobTitle}"`);
return response;
},
Comment on lines +111 to +139
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the summary message in the run function.

The summary message should use this.title instead of this.jobTitle.

-    $.export("$summary", `Successfully created job with title "${this.jobTitle}"`);
+    $.export("$summary", `Successfully created job with title "${this.title}"`);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run({ $ }) {
const response = await this.smartymeet.createJob({
$,
data: {
type: "jobs",
attributes: {
title: this.title,
status: this.status,
candidates: this.candidates,
workplace: this.workplace,
description: this.description,
industry: this.industry,
jobFunction: this.jobFunction,
jobType: this.jobType,
experience: this.experience,
education: this.education,
salary: {
from: this.salaryFrom,
to: this.salaryTo,
},
currency: this.currency,
keywords: parseObject(this.keywords),
},
},
});
$.export("$summary", `Successfully created job with title "${this.jobTitle}"`);
return response;
},
$.export("$summary", `Successfully created job with title "${this.title}"`);

};
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import smartymeet from "../../smartymeet.app.mjs";

export default {
key: "smartymeet-get-job-candidate-analysis",
name: "Get Job Candidate Analysis",
description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)",
version: "0.0.1",
type: "action",
props: {
smartymeet,
jobId: {
propDefinition: [
smartymeet,
"jobId",
],
},
candidateId: {
propDefinition: [
smartymeet,
"candidateId",
({ jobId }) => ({
jobId,
}),
],
},
},
async run({ $ }) {
const response = await this.smartymeet.listCandidates({
$,
jobId: this.jobId,
});

const candidate = response.find((candidate) => `${candidate.shardId}:${candidate.contactId}` === this.candidateId);

if (candidate) {
$.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`);
return candidate.jobs[0];
}
$.export("$summary", `Candidate with Id: ${this.candidateId} not found.`);
},
};
Comment on lines +1 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Consider improving the candidate search and error handling.

The action implementation is correct. However, consider the following improvements:

  1. Use a more descriptive variable name for the candidate search.
  2. Improve error handling by checking if the response contains candidates.
async run({ $ }) {
  const response = await this.smartymeet.listCandidates({
    $,
    jobId: this.jobId,
  });

  if (!response || response.length === 0) {
    $.export("$summary", `No candidates found for job Id: ${this.jobId}`);
    return;
  }

  const candidate = response.find((c) => `${c.shardId}:${c.contactId}` === this.candidateId);

  if (candidate) {
    $.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`);
    return candidate.jobs[0];
  }

  $.export("$summary", `Candidate with Id: ${this.candidateId} not found.`);
}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import smartymeet from "../../smartymeet.app.mjs";
export default {
key: "smartymeet-get-job-candidate-analysis",
name: "Get Job Candidate Analysis",
description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)",
version: "0.0.1",
type: "action",
props: {
smartymeet,
jobId: {
propDefinition: [
smartymeet,
"jobId",
],
},
candidateId: {
propDefinition: [
smartymeet,
"candidateId",
({ jobId }) => ({
jobId,
}),
],
},
},
async run({ $ }) {
const response = await this.smartymeet.listCandidates({
$,
jobId: this.jobId,
});
const candidate = response.find((candidate) => `${candidate.shardId}:${candidate.contactId}` === this.candidateId);
if (candidate) {
$.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`);
return candidate.jobs[0];
}
$.export("$summary", `Candidate with Id: ${this.candidateId} not found.`);
},
};
import smartymeet from "../../smartymeet.app.mjs";
export default {
key: "smartymeet-get-job-candidate-analysis",
name: "Get Job Candidate Analysis",
description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)",
version: "0.0.1",
type: "action",
props: {
smartymeet,
jobId: {
propDefinition: [
smartymeet,
"jobId",
],
},
candidateId: {
propDefinition: [
smartymeet,
"candidateId",
({ jobId }) => ({
jobId,
}),
],
},
},
async run({ $ }) {
const response = await this.smartymeet.listCandidates({
$,
jobId: this.jobId,
});
if (!response || response.length === 0) {
$.export("$summary", `No candidates found for job Id: ${this.jobId}`);
return;
}
const candidate = response.find((c) => `${c.shardId}:${c.contactId}` === this.candidateId);
if (candidate) {
$.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`);
return candidate.jobs[0];
}
$.export("$summary", `Candidate with Id: ${this.candidateId} not found.`);
},
};

Loading
Loading