Skip to content
Merged
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,72 @@
import breathe from "../../breathe.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "breathe-approve-or-reject-leave-request",
name: "Approve or Reject Leave Request",
description: "Approve or reject an employee leave request in Breathe. [See the documentation](https://developer.breathehr.com/examples#!/leave_requests)",
version: "0.0.1",
type: "action",
props: {
breathe,
employeeId: {
propDefinition: [
breathe,
"employeeId",
],
},
leaveRequestId: {
propDefinition: [
breathe,
"leaveRequestId",
(c) => ({
employeeId: c.employeeId,
}),
],
},
approveOrReject: {
type: "string",
label: "Approve or Reject?",
description: "Whether to approve or reject the leave request",
options: [
"approve",
"reject",
],
},
rejectionReason: {
type: "string",
label: "Rejection Reason",
description: "The reason for rejecting the leave request",
optional: true,
},
},
async run({ $ }) {
if (this.approveOrReject === "reject" && !this.rejectionReason) {
throw new ConfigurationError("Rejection Reason is required if rejecting the leave request");
}

let response;
if (this.approveOrReject === "reject") {
response = await this.breathe.rejectLeaveRequest({
$,
leaveRequestId: this.leaveRequestId,
data: {
leave_request: {
rejection_reason: this.rejectionReason,
},
},
});
}
else {
response = await this.breathe.approveLeaveRequest({
$,
leaveRequestId: this.leaveRequestId,
});
}

$.export("$summary", `Successfully ${this.approveOrReject === "reject"
? "rejected"
: "approved"} leave request with ID: ${this.leaveRequestId}`);
return response;
},
};
118 changes: 118 additions & 0 deletions components/breathe/actions/create-employee/create-employee.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import breathe from "../../breathe.app.mjs";

export default {
key: "breathe-create-employee",
name: "Create Employee",
description: "Creates a new employee in Breathe. [See the documentation](https://developer.breathehr.com/examples#!/employees/POST_version_employees_json)",
version: "0.0.1",
type: "action",
props: {
breathe,
firstName: {
type: "string",
label: "First Name",
description: "First name of the employee",
},
lastName: {
type: "string",
label: "Last Name",
description: "Last name of the employee",
},
email: {
type: "string",
label: "Email",
description: "Email address of the employee",
},
companyJoinDate: {
type: "string",
label: "Company Join Date",
description: "The date that the employee joined the company. Example: `2023-12-25`",
},
dob: {
type: "string",
label: "Date of Birth",
description: "The date of birth of the employee",
optional: true,
},
jobTitle: {
type: "string",
label: "Job Title",
description: "The job title of the employee",
optional: true,
},
departmentId: {
propDefinition: [
breathe,
"departmentId",
],
},
divisionId: {
propDefinition: [
breathe,
"divisionId",
],
},
locationId: {
propDefinition: [
breathe,
"locationId",
],
},
workingPatternId: {
propDefinition: [
breathe,
"workingPatternId",
],
},
holidayAllowanceId: {
propDefinition: [
breathe,
"holidayAllowanceId",
],
},
workMobile: {
type: "string",
label: "Work Mobile",
description: "The work moblie phone number of the employee",
optional: true,
},
personalMobile: {
type: "string",
label: "Personal Mobile",
description: "The personal mobile phone number of the employee",
optional: true,
},
homeTelephone: {
type: "string",
label: "Home Telephone",
description: "The home telephone number of the employee",
optional: true,
},
},
async run({ $ }) {
const response = await this.breathe.createEmployee({
$,
data: {
employee: {
person_type: "Employee",
first_name: this.firstName,
last_name: this.lastName,
email: this.email,
company_join_date: this.companyJoinDate,
dob: this.dob,
job_title: this.jobTitle,
work_mobile: this.workMobile,
personal_mobile: this.personalMobile,
home_telephone: this.homeTelephone,
department: this.departmentId,
division: this.divisionId,
location: this.locationId,
working_pattern: this.workingPatternId,
holiday_allowance: this.holidayAllowanceId,
},
},
});
$.export("$summary", `Successfully created employee with ID: ${response.employees[0].id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import breathe from "../../breathe.app.mjs";

export default {
key: "breathe-create-leave-request",
name: "Create Leave Request",
description: "Creates a new leave request for an employee in Breathe. [See the documentation](https://developer.breathehr.com/examples#!/employees/POST_version_employees_id_leave_requests_json)",
version: "0.0.1",
type: "action",
props: {
breathe,
employeeId: {
propDefinition: [
breathe,
"employeeId",
],
},
startDate: {
type: "string",
label: "Start Date",
description: "The start date of the leave request. Example: `2023-12-25`",
},
endDate: {
type: "string",
label: "End Date",
description: "The end date of the leave request. Example: `2023-12-27`",
},
halfStart: {
type: "boolean",
label: "Half Start",
description: "Set to `true` if requesting a half-day",
default: false,
optional: true,
},
notes: {
type: "string",
label: "Notes",
description: "Notes about the leave request",
optional: true,
},
},
async run({ $ }) {
const response = await this.breathe.createLeaveRequest({
$,
employeeId: this.employeeId,
data: {
leave_request: {
start_date: this.startDate,
end_date: this.endDate,
half_start: this.halfStart,
notes: this.notes,
},
},
});
$.export("$summary", `Successfully created leave for employee with ID: ${this.employeeId}`);
return response;
},
};
Loading
Loading