-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New Components - breathe #15075
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
Merged
Merged
New Components - breathe #15075
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ab15381
breathe init
michelle0927 5584fda
new components
michelle0927 28c9e92
pnpm-lock.yaml
michelle0927 59df762
updates
michelle0927 7ad6731
Merge remote-tracking branch 'origin/master' into issue-15070
michelle0927 1cd16c3
pnpm-lock.yaml
michelle0927 4244b67
Merge remote-tracking branch 'origin/master' into issue-15070
michelle0927 6361abc
pnpm-lock.yaml
michelle0927 c7dd2cc
fix typo
michelle0927 dec32aa
allow selecting multiple employees
michelle0927 bb2d299
updates
michelle0927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
...nents/breathe/actions/approve-or-reject-leave-request/approve-or-reject-leave-request.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
118
components/breathe/actions/create-employee/create-employee.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.location, | ||
| working_pattern: this.workingPattern, | ||
| holiday_allownace: this.holiday_allowance, | ||
| }, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created employee with ID: ${response.employees[0].id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
57 changes: 57 additions & 0 deletions
57
components/breathe/actions/create-leave-request/create-leave-request.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.