Skip to content

Commit 388f1aa

Browse files
committed
[Components] talenthr #14046
Sources - New Employee - New ATS Application Actions - Create Employee - Update Employee - Respond Time-Off Request
1 parent 6ac3fac commit 388f1aa

File tree

13 files changed

+1307
-206
lines changed

13 files changed

+1307
-206
lines changed
Lines changed: 158 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,182 @@
1+
import {
2+
OVERTIME_STATUS,
3+
PAY_RATE_PERIOD_OPTIONS,
4+
PAY_RATE_SCHEDULE_OPTIONS,
5+
} from "../../common/constants.mjs";
16
import talenthr from "../../talenthr.app.mjs";
2-
import { axios } from "@pipedream/platform";
37

48
export default {
59
key: "talenthr-create-employee",
610
name: "Create Employee",
7-
description: "Hires a new employee and registers them in the system. [See the documentation](https://apidocs.talenthr.io/)",
8-
version: "0.0.{{ts}}",
11+
description: "Hires a new employee and registers them in the system. [See the documentation](https://apidocs.talenthr.io/#2950f0ba-b27b-4d4b-855f-4b79b667767c)",
12+
version: "0.0.1",
913
type: "action",
1014
props: {
1115
talenthr,
12-
name: {
16+
firstName: {
1317
propDefinition: [
1418
talenthr,
15-
"name",
19+
"firstName",
1620
],
1721
},
18-
role: {
22+
lastName: {
1923
propDefinition: [
2024
talenthr,
21-
"role",
25+
"lastName",
2226
],
2327
},
28+
email: {
29+
propDefinition: [
30+
talenthr,
31+
"email",
32+
],
33+
},
34+
hireDate: {
35+
propDefinition: [
36+
talenthr,
37+
"hireDate",
38+
],
39+
},
40+
employmentStatusId: {
41+
propDefinition: [
42+
talenthr,
43+
"employmentStatusId",
44+
],
45+
},
46+
reportsToEmployeeId: {
47+
propDefinition: [
48+
talenthr,
49+
"employeeId",
50+
],
51+
optional: true,
52+
},
53+
jobTitleId: {
54+
propDefinition: [
55+
talenthr,
56+
"jobTitleId",
57+
],
58+
optional: true,
59+
},
60+
jobLocationId: {
61+
propDefinition: [
62+
talenthr,
63+
"jobLocationId",
64+
],
65+
optional: true,
66+
},
67+
divisionId: {
68+
propDefinition: [
69+
talenthr,
70+
"divisionId",
71+
],
72+
optional: true,
73+
},
74+
departmentId: {
75+
propDefinition: [
76+
talenthr,
77+
"departmentId",
78+
],
79+
optional: true,
80+
},
81+
payRate: {
82+
type: "string",
83+
label: "Pay Rate",
84+
description: "Employee's wage and must have 2 decimals. E.g 1255.38",
85+
},
86+
payRatePeriod: {
87+
type: "string",
88+
label: "Pay Rate Period",
89+
description: "The period over which money is earned.",
90+
options: PAY_RATE_PERIOD_OPTIONS,
91+
},
92+
payRateSchedule: {
93+
type: "string",
94+
label: "Pay Rate Schedule",
95+
description: "Frequency of the wage.",
96+
options: PAY_RATE_SCHEDULE_OPTIONS,
97+
optional: true,
98+
},
99+
overtimeStatus: {
100+
type: "string",
101+
label: "Overtime Status",
102+
description: "Determining whether an employee is exempt or non-exempt from overtime regulations.",
103+
options: OVERTIME_STATUS,
104+
optional: true,
105+
},
106+
preventEmail: {
107+
type: "boolean",
108+
label: "Prevent Email",
109+
description: "Opt for 'true', if you don't want to send an invitation email to the hiring employee, else 'false'.",
110+
optional: true,
111+
},
112+
isExisting: {
113+
type: "boolean",
114+
label: "Is Existing",
115+
description: "Opt for 'false' if the employee is a new hire and you want to run the Automatic Onboarding process, else 'true'.",
116+
optional: true,
117+
},
118+
whoId: {
119+
type: "integer",
120+
label: "Who Id",
121+
description: "The employee who will meet the newly hired employee. Required if **When Time** and address is present.",
122+
optional: true,
123+
},
124+
address: {
125+
propDefinition: [
126+
talenthr,
127+
"address",
128+
],
129+
optional: true,
130+
},
131+
whenTime: {
132+
type: "string",
133+
label: "When Time",
134+
description: "The date time that the meeting will take place. Required if **Who Id** and address is present. The hire date must be formatted as 'YYYY-MM-DD HH:II'.",
135+
optional: true,
136+
},
137+
instructions: {
138+
type: "string",
139+
label: "Instructions",
140+
description: "Important Instructions for the newly hired employee.",
141+
optional: true,
142+
},
24143
},
25144
async run({ $ }) {
26145
const response = await this.talenthr.createEmployee({
27-
name: this.name,
28-
role: this.role,
146+
$,
147+
data: {
148+
first_name: this.firstName,
149+
last_name: this.lastName,
150+
email: this.email,
151+
hire_date: this.hireDate,
152+
employment_status: {
153+
employment_status_id: this.employmentStatusId,
154+
},
155+
reports_to_employee_id: this.reportsToEmployeeId,
156+
job_record: {
157+
job_title_id: this.jobTitleId,
158+
location_id: this.jobLocationId,
159+
division_id: this.divisionId,
160+
department_id: this.departmentId,
161+
},
162+
compensation_record: {
163+
pay_rate: parseFloat(this.payRate),
164+
pay_rate_period: this.payRatePeriod,
165+
pay_rate_schedule: this.payRateSchedule,
166+
overtime_status: this.overtimeStatus,
167+
},
168+
prevent_email: this.preventEmail,
169+
is_existing: this.isExisting,
170+
hire_packet: {
171+
who_id: this.whoId,
172+
address: this.address,
173+
when_time: this.whenTime,
174+
instructions: this.instrwuctions,
175+
},
176+
},
29177
});
30178

31-
$.export("$summary", `Successfully created employee: ${response.name}`);
179+
$.export("$summary", `Successfully created employee: ${response.data.id}`);
32180
return response;
33181
},
34182
};
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
11
import talenthr from "../../talenthr.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "talenthr-respond-time-off-request",
65
name: "Respond to Time Off Request",
76
description: "Responds to an employee's time off request. This action requires the request ID and the response status as props. [See the documentation](https://apidocs.talenthr.io/)",
8-
version: "0.0.{{ts}}",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
talenthr,
12-
requestId: {
11+
employeeId: {
1312
propDefinition: [
1413
talenthr,
15-
"requestId",
14+
"employeeId",
1615
],
1716
},
18-
responseStatus: {
17+
timeOffRequestId: {
1918
propDefinition: [
2019
talenthr,
21-
"responseStatus",
20+
"timeOffRequestId",
21+
({ employeeId }) => ({
22+
employeeId,
23+
}),
2224
],
2325
},
26+
accept: {
27+
type: "boolean",
28+
label: "Accept",
29+
description: "Approve 'true' or Reject 'false' the specified time off request. If the time off request has been answered or it has been cancelled then you cannot appove or reject it.",
30+
},
2431
},
2532
async run({ $ }) {
2633
const response = await this.talenthr.respondToTimeOffRequest({
27-
requestId: this.requestId,
28-
responseStatus: this.responseStatus,
34+
timeOffRequestId: this.timeOffRequestId,
35+
employeeId: this.employeeId,
36+
data: {
37+
accept: this.accept,
38+
},
2939
});
3040

31-
$.export("$summary", `Successfully responded to time off request with ID ${this.requestId}`);
41+
$.export("$summary", `Successfully responded to time off request with ID ${this.timeOffRequestId}`);
3242
return response;
3343
},
3444
};

0 commit comments

Comments
 (0)