Skip to content

Commit 0b8558e

Browse files
committed
[Components] lucca #16101
Sources - New Leave Request - New User - New Expense Report Actions - Approve Leave Request - Update User Info
1 parent 085ed56 commit 0b8558e

File tree

12 files changed

+509
-364
lines changed

12 files changed

+509
-364
lines changed

components/lucca/actions/approve-leave-request/approve-leave-request.mjs

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

43
export default {
54
key: "lucca-approve-leave-request",
6-
name: "Approve Leave Request",
7-
description: "Approve a pending leave request. [See the documentation](https://developers.lucca.fr/api-reference/legacy/timmi-absences/leave-requests/approve-or-deny-a-leave-request)",
8-
version: "0.0.{{ts}}",
5+
name: "Approve Or Deny Leave Request",
6+
description: "Approve or Deny a pending leave request. [See the documentation](https://developers.lucca.fr/api-reference/legacy/timmi-absences/leave-requests/approve-or-deny-a-leave-request)",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
lucca,
@@ -18,9 +17,8 @@ export default {
1817
approved: {
1918
type: "boolean",
2019
label: "Approved",
21-
description: "Whether the leave request should be approved. Defaults to `true`.",
20+
description: "Whether the leave request should be approved.",
2221
optional: true,
23-
default: true,
2422
},
2523
comment: {
2624
type: "string",
@@ -31,9 +29,12 @@ export default {
3129
},
3230
async run({ $ }) {
3331
const response = await this.lucca.approveLeaveRequest({
32+
$,
3433
leaveRequestId: this.leaveRequestId,
35-
approved: this.approved ?? true,
36-
comment: this.comment || "",
34+
data: {
35+
approved: this.approved,
36+
comment: this.comment,
37+
},
3738
});
3839

3940
$.export("$summary", `Leave request ${this.leaveRequestId} was successfully processed.`);

components/lucca/actions/update-user-info/update-user-info.mjs

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

43
export default {
54
key: "lucca-update-user-info",
65
name: "Update User Info",
76
description: "Update profile or HR information for an existing user. [See the documentation](https://developers.lucca.fr/api-reference/legacy/directory/update-a-user-by-id)",
8-
version: "0.0.{{ts}}",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
lucca,
@@ -15,13 +14,13 @@ export default {
1514
"userId",
1615
],
1716
},
18-
firstname: {
17+
firstName: {
1918
type: "string",
2019
label: "First Name",
2120
description: "The user's first name",
2221
optional: true,
2322
},
24-
lastname: {
23+
lastName: {
2524
type: "string",
2625
label: "Last Name",
2726
description: "The user's last name",
@@ -39,67 +38,55 @@ export default {
3938
description: "The user's login",
4039
optional: true,
4140
},
42-
legalentityid: {
41+
legalEntityId: {
4342
type: "integer",
4443
label: "Legal Entity ID",
4544
description: "The ID of the legal entity",
4645
optional: true,
4746
},
48-
cspid: {
47+
cspId: {
4948
type: "integer",
5049
label: "CSP ID",
5150
description: "The ID of the CSP",
5251
optional: true,
5352
},
54-
calendarid: {
53+
calendarId: {
5554
type: "integer",
5655
label: "Calendar ID",
5756
description: "The ID of the calendar",
5857
optional: true,
5958
},
60-
employeenumber: {
59+
employeeNumber: {
6160
type: "string",
6261
label: "Employee Number",
6362
description: "The employee number",
6463
optional: true,
6564
},
66-
birthdate: {
65+
birthDate: {
6766
type: "string",
6867
label: "Birth Date",
6968
description: "The birth date of the user. Format: 'YYYY-MM-DD'.",
7069
optional: true,
7170
},
72-
userworkcycles: {
73-
type: "string[]",
74-
label: "User Work Cycles",
75-
description: "An array of user work cycles in JSON format",
76-
optional: true,
77-
},
78-
departmentid: {
71+
departmentId: {
7972
type: "integer",
8073
label: "Department ID",
8174
description: "The ID of the department",
8275
optional: true,
8376
},
84-
managerid: {
77+
managerId: {
8578
type: "integer",
8679
label: "Manager ID",
8780
description: "The ID of the manager",
8881
optional: true,
8982
},
90-
roleprincipalid: {
83+
rolePrincipalId: {
9184
type: "integer",
9285
label: "Role Principal ID",
9386
description: "The ID of the role principal",
9487
optional: true,
9588
},
96-
habilitedroles: {
97-
type: "string[]",
98-
label: "Habilited Roles",
99-
description: "An array of habilited roles in JSON format",
100-
optional: true,
101-
},
102-
cultureid: {
89+
cultureId: {
10390
type: "integer",
10491
label: "Culture ID",
10592
description: "The ID of the culture",
@@ -111,19 +98,19 @@ export default {
11198
description: "The address of the user",
11299
optional: true,
113100
},
114-
bankname: {
101+
bankName: {
115102
type: "string",
116103
label: "Bank Name",
117104
description: "The name of the bank",
118105
optional: true,
119106
},
120-
directline: {
107+
directLine: {
121108
type: "string",
122109
label: "Direct Line",
123110
description: "The direct line of the user",
124111
optional: true,
125112
},
126-
jobtitle: {
113+
jobTitle: {
127114
type: "string",
128115
label: "Job Title",
129116
description: "The job title of the user",
@@ -141,19 +128,19 @@ export default {
141128
description: "The nationality of the user",
142129
optional: true,
143130
},
144-
personalemail: {
131+
personalEmail: {
145132
type: "string",
146133
label: "Personal Email",
147134
description: "The personal email of the user",
148135
optional: true,
149136
},
150-
personalmobile: {
137+
personalMobile: {
151138
type: "string",
152139
label: "Personal Mobile",
153140
description: "The personal mobile of the user",
154141
optional: true,
155142
},
156-
professionalmobile: {
143+
professionalMobile: {
157144
type: "string",
158145
label: "Professional Mobile",
159146
description: "The professional mobile of the user",
@@ -167,41 +154,16 @@ export default {
167154
},
168155
},
169156
async run({ $ }) {
170-
const data = {
171-
firstName: this.firstname,
172-
lastName: this.lastname,
173-
mail: this.mail,
174-
login: this.login,
175-
legalEntityId: this.legalentityid,
176-
cspId: this.cspid,
177-
calendarId: this.calendarid,
178-
employeeNumber: this.employeenumber,
179-
birthDate: this.birthdate,
180-
userWorkCycles: this.userworkcycles
181-
? this.userworkcycles.map(JSON.parse)
182-
: [],
183-
departmentId: this.departmentid,
184-
managerId: this.managerid,
185-
rolePrincipalId: this.roleprincipalid,
186-
habilitedRoles: this.habilitedroles
187-
? this.habilitedroles.map(JSON.parse)
188-
: [],
189-
cultureId: this.cultureid,
190-
address: this.address,
191-
bankName: this.bankname,
192-
directLine: this.directline,
193-
jobTitle: this.jobtitle,
194-
gender: this.gender,
195-
nationality: this.nationality,
196-
personalEmail: this.personalemail,
197-
personalMobile: this.personalmobile,
198-
professionalMobile: this.professionalmobile,
199-
quote: this.quote,
200-
};
157+
const {
158+
lucca,
159+
userId,
160+
...data
161+
} = this;
201162

202-
const response = await this.lucca.updateUserProfile({
203-
userId: this.userId,
204-
...data,
163+
const response = await lucca.updateUserProfile({
164+
$,
165+
userId,
166+
data,
205167
});
206168

207169
$.export("$summary", `Successfully updated user with ID: ${this.userId}`);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const LIMIT = 100;

0 commit comments

Comments
 (0)