- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
New Components - kenjo #15076
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 - kenjo #15076
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            3 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    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
        
          
          
            77 changes: 77 additions & 0 deletions
          
          77 
        
  components/kenjo/actions/create-attendance-entry/create-attendance-entry.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,77 @@ | ||
| import kenjo from "../../kenjo.app.mjs"; | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|  | ||
| export default { | ||
| key: "kenjo-create-attendance-entry", | ||
| name: "Create Attendance Entry", | ||
| description: "Creates a new attendance entry for an employee in Kenjo. [See the documentation](https://kenjo.readme.io/reference/post_attendances)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| kenjo, | ||
| employeeId: { | ||
| propDefinition: [ | ||
| kenjo, | ||
| "employeeId", | ||
| ], | ||
| }, | ||
| date: { | ||
| type: "string", | ||
| label: "Date", | ||
| description: "The date of the entry. Format: `YYYY-MM-DD`", | ||
| }, | ||
| startTime: { | ||
| type: "string", | ||
| label: "Start Time", | ||
| description: "The start time of the entry. Format: `hh:mm:ss`", | ||
| }, | ||
| endTime: { | ||
| type: "string", | ||
| label: "End Time", | ||
| description: "The end time of the entry. Format: `hh:mm:ss`", | ||
| optional: true, | ||
| }, | ||
| breakStartTime: { | ||
| type: "string", | ||
| label: "Break Start Time", | ||
| description: "The start time of the break. Format: `hh:mm:ss`", | ||
| optional: true, | ||
| }, | ||
| breakEndTime: { | ||
| type: "string", | ||
| label: "Break End Time", | ||
| description: "The end time of the break. Format: `hh:mm:ss`", | ||
| optional: true, | ||
| }, | ||
| comment: { | ||
| type: "string", | ||
| label: "Comment", | ||
| description: "Comment to describe the attendance record", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if (this.breakEndTime && !this.breakStartTime) { | ||
| throw new ConfigurationError("Break Start Time is required if including a break"); | ||
| } | ||
|  | ||
| const response = await this.kenjo.createAttendanceEntry({ | ||
| $, | ||
| data: { | ||
| userId: this.employeeId, | ||
| date: this.date, | ||
| startTime: this.startTime, | ||
| endTime: this.endTime, | ||
| breaks: this.breakStartTime && [ | ||
| { | ||
| start: this.breakStartTime, | ||
| end: this.breakEndTime, | ||
| }, | ||
| ], | ||
| comment: this.comment, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created attendance entry with ID: ${response._id}`); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            178 changes: 178 additions & 0 deletions
          
          178 
        
  components/kenjo/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,178 @@ | ||
| import kenjo from "../../kenjo.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "kenjo-create-employee", | ||
| name: "Create Employee", | ||
| description: "Creates a new employee in Kenjo. [See the documentation](https://kenjo.readme.io/reference/post_employees)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| kenjo, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address of the employee", | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "The first name of the employee", | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "The last name of the employee", | ||
| }, | ||
| companyId: { | ||
| propDefinition: [ | ||
| kenjo, | ||
| "companyId", | ||
| ], | ||
| }, | ||
| weeklyHours: { | ||
| type: "integer", | ||
| label: "Weekly Hours", | ||
| description: "The number of weekly hours that an employee works", | ||
| }, | ||
| officeId: { | ||
| propDefinition: [ | ||
| kenjo, | ||
| "officeId", | ||
| (c) => ({ | ||
| companyId: c.companyId, | ||
| }), | ||
| ], | ||
| }, | ||
| departmentId: { | ||
| propDefinition: [ | ||
| kenjo, | ||
| "departmentId", | ||
| ], | ||
| }, | ||
| language: { | ||
| type: "string", | ||
| label: "Language", | ||
| description: "The employee's language", | ||
| options: [ | ||
| "en", | ||
| "es", | ||
| "de", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| birthdate: { | ||
| type: "string", | ||
| label: "Birthdate", | ||
| description: "The birthdate of the employee. Format `YYYY-MM-DDThh:mm:ss.000Z`", | ||
| optional: true, | ||
| }, | ||
| jobTitle: { | ||
| type: "string", | ||
| label: "Job Title", | ||
| description: "The job title of the employee", | ||
| optional: true, | ||
| }, | ||
| workPhone: { | ||
| type: "string", | ||
| label: "Work Phone", | ||
| description: "The work phone number of the employee", | ||
| optional: true, | ||
| }, | ||
| personalPhone: { | ||
| type: "string", | ||
| label: "Personal Phone", | ||
| description: "The personal phone number of the employee", | ||
| optional: true, | ||
| }, | ||
| workDays: { | ||
| type: "string[]", | ||
| label: "Work Days", | ||
| description: "The days of the week that the employee works", | ||
| options: [ | ||
| "monday", | ||
| "tuesday", | ||
| "wednesday", | ||
| "thursday", | ||
| "friday", | ||
| "saturday", | ||
| "sunday", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| trackAttendance: { | ||
| type: "boolean", | ||
| label: "Track Attendance", | ||
| description: "Set to `true` to activate attendance tracking for the employee", | ||
| optional: true, | ||
| }, | ||
| street: { | ||
| type: "string", | ||
| label: "Street", | ||
| description: "The street address of the employee", | ||
| optional: true, | ||
| }, | ||
| postalCode: { | ||
| type: "string", | ||
| label: "Postal Code", | ||
| description: "The postal code of the employee", | ||
| optional: true, | ||
| }, | ||
| city: { | ||
| type: "string", | ||
| label: "City", | ||
| description: "The city of the employee", | ||
| optional: true, | ||
| }, | ||
| country: { | ||
| type: "string", | ||
| label: "Country", | ||
| description: "The country code in ISO 3166-1 alpha-2. Example: `ES`", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const workSchedule = { | ||
| trackAttendance: this.trackAttendance, | ||
| }; | ||
| if (this.workDays?.length) { | ||
| for (const day of this.workDays) { | ||
| workSchedule[`${day}WorkingDay`] = true; | ||
| } | ||
| } | ||
|  | ||
| const response = await this.kenjo.createEmployee({ | ||
| $, | ||
| data: { | ||
| account: { | ||
| email: this.email, | ||
| language: this.language, | ||
| }, | ||
| personal: { | ||
| firstName: this.firstName, | ||
| lastName: this.lastName, | ||
| birthdate: this.birthdate, | ||
| }, | ||
| work: { | ||
| companyId: this.companyId, | ||
| officeId: this.officeId, | ||
| departmentId: this.departmentId, | ||
| weeklyHours: this.weeklyHours, | ||
| jobTitle: this.jobTitle, | ||
| workPhone: this.workPhone, | ||
| }, | ||
| workSchedule, | ||
| address: (this.street || this.postalCode || this.city || this.country) && { | ||
| street: this.street, | ||
| postalCode: this.postalCode, | ||
| city: this.city, | ||
| country: this.country, | ||
| }, | ||
| home: this.personalPhone && { | ||
| personalPhone: this.personalPhone, | ||
| }, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Created employee with ID: ${response.account._id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
        
          
          
            76 changes: 76 additions & 0 deletions
          
          76 
        
  components/kenjo/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,76 @@ | ||
| import kenjo from "../../kenjo.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "kenjo-create-leave-request", | ||
| name: "Create Leave Request", | ||
| description: "Creates a new leave request in Kenjo. [See the documentation](https://kenjo.readme.io/reference/post_time-off-requests).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| kenjo, | ||
| employeeId: { | ||
| propDefinition: [ | ||
| kenjo, | ||
| "employeeId", | ||
| ], | ||
| }, | ||
| timeOffTypeId: { | ||
| propDefinition: [ | ||
| kenjo, | ||
| "timeOffTypeId", | ||
| ], | ||
| }, | ||
| from: { | ||
| type: "string", | ||
| label: "From", | ||
| description: "The starting date of the time-off request in format `YYYY-MM-DD`", | ||
| }, | ||
| to: { | ||
| type: "string", | ||
| label: "To", | ||
| description: "The ending date of the time-off request in format `YYYY-MM-DD`", | ||
| }, | ||
| partOfDayFrom: { | ||
| type: "string", | ||
| label: "Part of Day From", | ||
| description: "The duration of the from date. 'StartOfDay' means that the from date is the entire day. 'HalfOfDay' means that the request starts to apply in the middle of the from day. If not specified, the default value will be 'StartOfDay'.", | ||
| options: [ | ||
| "StartOfDay", | ||
| "HalfOfDay", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| partOfDayTo: { | ||
| type: "string", | ||
| label: "Part of Day To", | ||
| description: "The duration of the to date. 'EndOfDay' means that the to date is the entire day. 'HalfOfDay' means the request starts to apply in the middle of the to day. If not specified, the default value will be 'EndOfDay'.", | ||
| options: [ | ||
| "HalfOfDay", | ||
| "EndOfDay", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "The description of the time-off request", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.kenjo.createLeaveRequest({ | ||
| $, | ||
| data: { | ||
| _userId: this.employeeId, | ||
| _timeOffTypeId: this.timeOffTypeId, | ||
| from: this.from, | ||
| to: this.to, | ||
| partOfDayFrom: this.partOfDayFrom, | ||
| partOfDayTo: this.partOfDayTo, | ||
| description: this.description, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created leave request with ID: ${response._id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
      
      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.