Skip to content

Commit a8eabd0

Browse files
committed
new components
1 parent e25420f commit a8eabd0

File tree

9 files changed

+409
-494
lines changed

9 files changed

+409
-494
lines changed

components/taleez/actions/add-candidate-to-job/add-candidate-to-job.mjs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import taleez from "../../taleez.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "taleez-add-candidate-to-job",
65
name: "Add Candidate to Job",
7-
description: "Links an existing candidate to a job offer. [See the documentation]()",
8-
version: "0.0.{{ts}}",
6+
description: "Links an existing candidate to a job offer. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/jobs/addCandidate_1)",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
taleez,
@@ -23,10 +22,13 @@ export default {
2322
},
2423
},
2524
async run({ $ }) {
26-
const response = await this.taleez.linkCandidateToJobOffer({
25+
const response = await this.taleez.linkCandidateToJob({
26+
$,
27+
jobId: this.jobId,
2728
data: {
28-
candidate_id: this.candidateId,
29-
job_id: this.jobId,
29+
ids: [
30+
this.candidateId,
31+
],
3032
},
3133
});
3234
$.export("$summary", `Linked candidate ${this.candidateId} to job ${this.jobId} successfully`);
Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,60 @@
11
import taleez from "../../taleez.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "taleez-create-candidate",
65
name: "Create Candidate",
7-
description: "Creates a new candidate in Taleez. [See the documentation]()",
8-
version: "0.0.{{ts}}",
6+
description: "Creates a new candidate in Taleez. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/candidates/create_1)",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
taleez,
12-
candidateName: {
13-
propDefinition: [
14-
taleez,
15-
"candidateName",
16-
],
11+
firstName: {
12+
type: "string",
13+
label: "First Name",
14+
description: "First name of the candidate",
15+
},
16+
lastName: {
17+
type: "string",
18+
label: "Last Name",
19+
description: "Last name of the candidate",
1720
},
1821
email: {
19-
propDefinition: [
20-
taleez,
21-
"email",
22-
],
22+
type: "string",
23+
label: "Email",
24+
description: "Candidate email address. Must be unique in your company",
2325
},
24-
jobListingId: {
25-
propDefinition: [
26-
taleez,
27-
"jobListingId",
28-
],
26+
phone: {
27+
type: "string",
28+
label: "Phone",
29+
description: "Candidate phone (formats : 0611223344, +33611223344, 00336112233). Ignored if not valid.",
30+
optional: true,
2931
},
30-
resume: {
32+
unitId: {
3133
propDefinition: [
3234
taleez,
33-
"resume",
35+
"unitId",
3436
],
35-
optional: true,
3637
},
37-
coverLetter: {
38+
recruiterId: {
3839
propDefinition: [
3940
taleez,
40-
"coverLetter",
41+
"recruiterId",
4142
],
42-
optional: true,
4343
},
4444
},
4545
async run({ $ }) {
46-
const response = await this.taleez.createCandidate();
47-
$.export("$summary", `Created candidate ${this.candidateName} successfully`);
46+
const response = await this.taleez.createCandidate({
47+
$,
48+
data: {
49+
firstName: this.firstName,
50+
lastName: this.lastName,
51+
mail: this.email,
52+
phone: this.phone,
53+
unitId: this.unitId,
54+
recruiterId: this.recruiterId,
55+
},
56+
});
57+
$.export("$summary", `Created candidate ${this.firstName} ${this.lastName} successfully`);
4858
return response;
4959
},
5060
};

components/taleez/actions/create-job/create-job.mjs

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import taleez from "../../taleez.app.mjs";
2+
3+
export default {
4+
key: "taleez-list-jobs",
5+
name: "List Jobs",
6+
description: "Retrieves a list of jobs in your company. [See the documentation](https://api.taleez.com/swagger-ui/index.html#/jobs/list_3)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
taleez,
11+
unitId: {
12+
propDefinition: [
13+
taleez,
14+
"unitId",
15+
],
16+
},
17+
status: {
18+
propDefinition: [
19+
taleez,
20+
"status",
21+
],
22+
},
23+
contract: {
24+
propDefinition: [
25+
taleez,
26+
"contract",
27+
],
28+
},
29+
city: {
30+
propDefinition: [
31+
taleez,
32+
"city",
33+
],
34+
},
35+
companyLabel: {
36+
propDefinition: [
37+
taleez,
38+
"companyLabel",
39+
],
40+
},
41+
tag: {
42+
propDefinition: [
43+
taleez,
44+
"tag",
45+
],
46+
},
47+
maxResults: {
48+
type: "integer",
49+
label: "Max Results",
50+
description: "The maximum number of jobs to retrieve. Default: `100`",
51+
optional: true,
52+
},
53+
},
54+
async run({ $ }) {
55+
const { list: jobs } = await this.taleez.listJobs({
56+
$,
57+
params: {
58+
unitId: this.unitId,
59+
status: this.status,
60+
contract: this.contract,
61+
city: this.city,
62+
companyLabel: this.companyLabel,
63+
tag: this.tag,
64+
pageSize: this.maxResults,
65+
withDetails: true,
66+
withProps: true,
67+
},
68+
});
69+
$.export("$summary", `Successfully retrieved ${jobs?.length} job${jobs?.length === 1
70+
? ""
71+
: "s"}`);
72+
return jobs;
73+
},
74+
};

components/taleez/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/taleez",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Taleez Components",
55
"main": "taleez.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
1518
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import taleez from "../../taleez.app.mjs";
2+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
3+
4+
export default {
5+
props: {
6+
taleez,
7+
db: "$.service.db",
8+
timer: {
9+
type: "$.interface.timer",
10+
default: {
11+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
12+
},
13+
},
14+
},
15+
methods: {
16+
_getLastTs() {
17+
return this.db.get("lastTs") || 0;
18+
},
19+
_setLastTs(lastTs) {
20+
this.db.set("lastTs", lastTs);
21+
},
22+
emitEvent(item) {
23+
const meta = this.generateMeta(item);
24+
this.$emit(item, meta);
25+
},
26+
async processEvent(max) {
27+
const lastTs = this._getLastTs();
28+
let maxTs = lastTs;
29+
const tsField = this.getTsField();
30+
31+
const results = this.taleez.paginate({
32+
fn: this.getResourceFn(),
33+
args: this.getArgs(),
34+
max,
35+
});
36+
37+
for await (const item of results) {
38+
if (tsField) {
39+
const ts = item[tsField];
40+
if (ts > lastTs) {
41+
this.emitEvent(item);
42+
maxTs = Math.max(ts, maxTs);
43+
}
44+
} else {
45+
this.emitEvent(item);
46+
}
47+
}
48+
49+
this._setLastTs(maxTs);
50+
},
51+
getArgs() {
52+
return {};
53+
},
54+
getTsField() {
55+
return undefined;
56+
},
57+
getResourceFn() {
58+
throw new Error("getResourceFn is not implemented");
59+
},
60+
generateMeta() {
61+
throw new Error("generateMeta is not implemented");
62+
},
63+
},
64+
hooks: {
65+
async deploy() {
66+
await this.processEvent(25);
67+
},
68+
},
69+
async run() {
70+
await this.processEvent();
71+
},
72+
};

0 commit comments

Comments
 (0)