Skip to content

Commit 085ed56

Browse files
committed
lucca init
1 parent 1d8a832 commit 085ed56

File tree

7 files changed

+630
-6
lines changed

7 files changed

+630
-6
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import lucca from "../../lucca.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
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}}",
9+
type: "action",
10+
props: {
11+
lucca,
12+
leaveRequestId: {
13+
propDefinition: [
14+
lucca,
15+
"leaveRequestId",
16+
],
17+
},
18+
approved: {
19+
type: "boolean",
20+
label: "Approved",
21+
description: "Whether the leave request should be approved. Defaults to `true`.",
22+
optional: true,
23+
default: true,
24+
},
25+
comment: {
26+
type: "string",
27+
label: "Comment",
28+
description: "Optional comment about the approval decision.",
29+
optional: true,
30+
},
31+
},
32+
async run({ $ }) {
33+
const response = await this.lucca.approveLeaveRequest({
34+
leaveRequestId: this.leaveRequestId,
35+
approved: this.approved ?? true,
36+
comment: this.comment || "",
37+
});
38+
39+
$.export("$summary", `Leave request ${this.leaveRequestId} was successfully processed.`);
40+
return response;
41+
},
42+
};
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
import lucca from "../../lucca.app.mjs";
2+
import { axios } from "@pipedream/platform";
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.{{ts}}",
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+
type: "integer",
44+
label: "Legal Entity ID",
45+
description: "The ID of the legal entity",
46+
optional: true,
47+
},
48+
cspid: {
49+
type: "integer",
50+
label: "CSP ID",
51+
description: "The ID of the CSP",
52+
optional: true,
53+
},
54+
calendarid: {
55+
type: "integer",
56+
label: "Calendar ID",
57+
description: "The ID of the calendar",
58+
optional: true,
59+
},
60+
employeenumber: {
61+
type: "string",
62+
label: "Employee Number",
63+
description: "The employee number",
64+
optional: true,
65+
},
66+
birthdate: {
67+
type: "string",
68+
label: "Birth Date",
69+
description: "The birth date of the user. Format: 'YYYY-MM-DD'.",
70+
optional: true,
71+
},
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: {
79+
type: "integer",
80+
label: "Department ID",
81+
description: "The ID of the department",
82+
optional: true,
83+
},
84+
managerid: {
85+
type: "integer",
86+
label: "Manager ID",
87+
description: "The ID of the manager",
88+
optional: true,
89+
},
90+
roleprincipalid: {
91+
type: "integer",
92+
label: "Role Principal ID",
93+
description: "The ID of the role principal",
94+
optional: true,
95+
},
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: {
103+
type: "integer",
104+
label: "Culture ID",
105+
description: "The ID of the culture",
106+
optional: true,
107+
},
108+
address: {
109+
type: "string",
110+
label: "Address",
111+
description: "The address of the user",
112+
optional: true,
113+
},
114+
bankname: {
115+
type: "string",
116+
label: "Bank Name",
117+
description: "The name of the bank",
118+
optional: true,
119+
},
120+
directline: {
121+
type: "string",
122+
label: "Direct Line",
123+
description: "The direct line of the user",
124+
optional: true,
125+
},
126+
jobtitle: {
127+
type: "string",
128+
label: "Job Title",
129+
description: "The job title of the user",
130+
optional: true,
131+
},
132+
gender: {
133+
type: "string",
134+
label: "Gender",
135+
description: "The gender of the user",
136+
optional: true,
137+
},
138+
nationality: {
139+
type: "string",
140+
label: "Nationality",
141+
description: "The nationality of the user",
142+
optional: true,
143+
},
144+
personalemail: {
145+
type: "string",
146+
label: "Personal Email",
147+
description: "The personal email of the user",
148+
optional: true,
149+
},
150+
personalmobile: {
151+
type: "string",
152+
label: "Personal Mobile",
153+
description: "The personal mobile of the user",
154+
optional: true,
155+
},
156+
professionalmobile: {
157+
type: "string",
158+
label: "Professional Mobile",
159+
description: "The professional mobile of the user",
160+
optional: true,
161+
},
162+
quote: {
163+
type: "string",
164+
label: "Quote",
165+
description: "The quote of the user",
166+
optional: true,
167+
},
168+
},
169+
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+
};
201+
202+
const response = await this.lucca.updateUserProfile({
203+
userId: this.userId,
204+
...data,
205+
});
206+
207+
$.export("$summary", `Successfully updated user with ID: ${this.userId}`);
208+
return response;
209+
},
210+
};

0 commit comments

Comments
 (0)