Skip to content

Commit 0d5fd08

Browse files
authored
New Components - lucca (#16154)
* lucca init * [Components] lucca #16101 Sources - New Leave Request - New User - New Expense Report Actions - Approve Leave Request - Update User Info * pnpm update * some adjusts * pnpm update * pnpm update * pnpm update * some adjusts
1 parent 2fbb432 commit 0d5fd08

File tree

13 files changed

+825
-8
lines changed

13 files changed

+825
-8
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import lucca from "../../lucca.app.mjs";
2+
3+
export default {
4+
key: "lucca-approve-leave-request",
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",
8+
type: "action",
9+
props: {
10+
lucca,
11+
leaveRequestId: {
12+
propDefinition: [
13+
lucca,
14+
"leaveRequestId",
15+
],
16+
},
17+
approved: {
18+
type: "boolean",
19+
label: "Approved",
20+
description: "Whether the leave request should be approved.",
21+
optional: true,
22+
},
23+
comment: {
24+
type: "string",
25+
label: "Comment",
26+
description: "Optional comment about the approval decision.",
27+
optional: true,
28+
},
29+
},
30+
async run({ $ }) {
31+
const response = await this.lucca.approveLeaveRequest({
32+
$,
33+
leaveRequestId: this.leaveRequestId,
34+
data: {
35+
approved: this.approved,
36+
comment: this.comment,
37+
},
38+
});
39+
40+
$.export("$summary", `Leave request ${this.leaveRequestId} was successfully processed.`);
41+
return response;
42+
},
43+
};
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import lucca from "../../lucca.app.mjs";
3+
4+
export default {
5+
key: "lucca-update-user-info",
6+
name: "Update User Info",
7+
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.1",
9+
type: "action",
10+
props: {
11+
lucca,
12+
userId: {
13+
propDefinition: [
14+
lucca,
15+
"userId",
16+
],
17+
},
18+
firstName: {
19+
type: "string",
20+
label: "First Name",
21+
description: "The user's first name",
22+
optional: true,
23+
},
24+
lastName: {
25+
type: "string",
26+
label: "Last Name",
27+
description: "The user's last name",
28+
optional: true,
29+
},
30+
mail: {
31+
type: "string",
32+
label: "Email",
33+
description: "The user's email",
34+
optional: true,
35+
},
36+
login: {
37+
type: "string",
38+
label: "Login",
39+
description: "The user's login",
40+
optional: true,
41+
},
42+
legalEntityId: {
43+
propDefinition: [
44+
lucca,
45+
"legalEntityId",
46+
],
47+
optional: true,
48+
},
49+
calendarId: {
50+
type: "integer",
51+
label: "Calendar ID",
52+
description: "The ID of the calendar",
53+
optional: true,
54+
},
55+
employeeNumber: {
56+
type: "string",
57+
label: "Employee Number",
58+
description: "The employee number",
59+
optional: true,
60+
},
61+
birthDate: {
62+
type: "string",
63+
label: "Birth Date",
64+
description: "The birth date of the user. Format: 'YYYY-MM-DD'.",
65+
optional: true,
66+
},
67+
address: {
68+
type: "string",
69+
label: "Address",
70+
description: "The address of the user",
71+
optional: true,
72+
},
73+
bankName: {
74+
type: "string",
75+
label: "Bank Name",
76+
description: "The name of the bank",
77+
optional: true,
78+
},
79+
directLine: {
80+
type: "string",
81+
label: "Direct Line",
82+
description: "The direct line of the user",
83+
optional: true,
84+
},
85+
gender: {
86+
type: "string",
87+
label: "Gender",
88+
description: "The gender of the user",
89+
optional: true,
90+
},
91+
nationality: {
92+
propDefinition: [
93+
lucca,
94+
"nationalityId",
95+
],
96+
optional: true,
97+
},
98+
personalEmail: {
99+
type: "string",
100+
label: "Personal Email",
101+
description: "The personal email of the user",
102+
optional: true,
103+
},
104+
personalMobile: {
105+
type: "string",
106+
label: "Personal Mobile",
107+
description: "The personal mobile of the user",
108+
optional: true,
109+
},
110+
professionalMobile: {
111+
type: "string",
112+
label: "Professional Mobile",
113+
description: "The professional mobile of the user",
114+
optional: true,
115+
},
116+
quote: {
117+
type: "string",
118+
label: "Quote",
119+
description: "The quote of the user",
120+
optional: true,
121+
},
122+
},
123+
async run({ $ }) {
124+
try {
125+
const {
126+
lucca,
127+
userId,
128+
...data
129+
} = this;
130+
131+
const response = await lucca.updateUserProfile({
132+
$,
133+
userId,
134+
data,
135+
});
136+
137+
$.export("$summary", `Successfully updated user with ID: ${this.userId}`);
138+
return response;
139+
} catch ({ message }) {
140+
console.log("message: ", message);
141+
142+
const parsedError = JSON.parse(message);
143+
throw new ConfigurationError(parsedError.Message || parsedError[0].message);
144+
}
145+
},
146+
};
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)