Skip to content

Commit 6da9785

Browse files
authored
New Components - niceboard (#14372)
* init * new components * pnpm-lock.yaml * typo
1 parent 78d91e2 commit 6da9785

File tree

12 files changed

+706
-22
lines changed

12 files changed

+706
-22
lines changed

components/niceboard/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import niceboard from "../../niceboard.app.mjs";
2+
3+
export default {
4+
key: "niceboard-create-category",
5+
name: "Create Category",
6+
description: "Creates a new job category within Niceboard.",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
niceboard,
11+
niceboardUrl: {
12+
propDefinition: [
13+
niceboard,
14+
"niceboardUrl",
15+
],
16+
},
17+
name: {
18+
type: "string",
19+
label: "Category Name",
20+
description: "The name of the job category to be created",
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.niceboard.createCategory({
25+
$,
26+
niceboardUrl: this.niceboardUrl,
27+
data: {
28+
name: this.name,
29+
},
30+
});
31+
$.export("$summary", `Successfully created category with name "${this.name}"`);
32+
return response;
33+
},
34+
};
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import niceboard from "../../niceboard.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "niceboard-create-job",
6+
name: "Create Job",
7+
description: "Creates a new job posting within the Niceboard app.",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
niceboard,
12+
niceboardUrl: {
13+
propDefinition: [
14+
niceboard,
15+
"niceboardUrl",
16+
],
17+
},
18+
title: {
19+
propDefinition: [
20+
niceboard,
21+
"title",
22+
],
23+
},
24+
description: {
25+
propDefinition: [
26+
niceboard,
27+
"description",
28+
],
29+
},
30+
companyId: {
31+
propDefinition: [
32+
niceboard,
33+
"companyId",
34+
(c) => ({
35+
niceboardUrl: c.niceboardUrl,
36+
}),
37+
],
38+
},
39+
jobTypeId: {
40+
propDefinition: [
41+
niceboard,
42+
"jobTypeId",
43+
(c) => ({
44+
niceboardUrl: c.niceboardUrl,
45+
}),
46+
],
47+
},
48+
categoryId: {
49+
propDefinition: [
50+
niceboard,
51+
"categoryId",
52+
(c) => ({
53+
niceboardUrl: c.niceboardUrl,
54+
}),
55+
],
56+
optional: true,
57+
},
58+
locationId: {
59+
propDefinition: [
60+
niceboard,
61+
"locationId",
62+
(c) => ({
63+
niceboardUrl: c.niceboardUrl,
64+
}),
65+
],
66+
optional: true,
67+
},
68+
minSalary: {
69+
propDefinition: [
70+
niceboard,
71+
"minSalary",
72+
],
73+
},
74+
maxSalary: {
75+
propDefinition: [
76+
niceboard,
77+
"maxSalary",
78+
],
79+
},
80+
salaryTimeframe: {
81+
propDefinition: [
82+
niceboard,
83+
"salaryTimeframe",
84+
],
85+
},
86+
},
87+
async run({ $ }) {
88+
if ((this.minSalary || this.maxSalary) && !this.salaryTimeframe) {
89+
throw new ConfigurationError("Salary Timeframe is required if Minimum Salary or Maximum Salary is entered");
90+
}
91+
92+
const response = await this.niceboard.createJob({
93+
$,
94+
niceboardUrl: this.niceboardUrl,
95+
data: {
96+
title: this.title,
97+
description_html: this.description,
98+
company_id: this.companyId,
99+
jobtype_id: this.jobTypeId,
100+
category_id: this.categoryId,
101+
location_id: this.locationId,
102+
salary_min: this.minSalary,
103+
salary_max: this.maxSalary,
104+
salary_timeframe: this.salaryTimeframe,
105+
apply_by_form: true,
106+
},
107+
});
108+
109+
if (response?.job?.id) {
110+
$.export("$summary", `Successfully created job with ID: ${response.job.id}`);
111+
}
112+
return response;
113+
},
114+
};
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
import niceboard from "../../niceboard.app.mjs";
2+
3+
export default {
4+
key: "niceboard-update-job",
5+
name: "Update Job",
6+
description: "Updates an existing job posting within the Niceboard app.",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
niceboard,
11+
niceboardUrl: {
12+
propDefinition: [
13+
niceboard,
14+
"niceboardUrl",
15+
],
16+
},
17+
jobId: {
18+
propDefinition: [
19+
niceboard,
20+
"jobId",
21+
(c) => ({
22+
niceboardUrl: c.niceboardUrl,
23+
}),
24+
],
25+
},
26+
title: {
27+
propDefinition: [
28+
niceboard,
29+
"title",
30+
],
31+
optional: true,
32+
},
33+
description: {
34+
propDefinition: [
35+
niceboard,
36+
"description",
37+
],
38+
optional: true,
39+
},
40+
companyId: {
41+
propDefinition: [
42+
niceboard,
43+
"companyId",
44+
(c) => ({
45+
niceboardUrl: c.niceboardUrl,
46+
}),
47+
],
48+
optional: true,
49+
},
50+
jobTypeId: {
51+
propDefinition: [
52+
niceboard,
53+
"jobTypeId",
54+
(c) => ({
55+
niceboardUrl: c.niceboardUrl,
56+
}),
57+
],
58+
optional: true,
59+
},
60+
categoryId: {
61+
propDefinition: [
62+
niceboard,
63+
"categoryId",
64+
(c) => ({
65+
niceboardUrl: c.niceboardUrl,
66+
}),
67+
],
68+
optional: true,
69+
},
70+
locationId: {
71+
propDefinition: [
72+
niceboard,
73+
"locationId",
74+
(c) => ({
75+
niceboardUrl: c.niceboardUrl,
76+
}),
77+
],
78+
optional: true,
79+
},
80+
minSalary: {
81+
propDefinition: [
82+
niceboard,
83+
"minSalary",
84+
],
85+
},
86+
maxSalary: {
87+
propDefinition: [
88+
niceboard,
89+
"maxSalary",
90+
],
91+
},
92+
salaryTimeframe: {
93+
propDefinition: [
94+
niceboard,
95+
"salaryTimeframe",
96+
],
97+
},
98+
},
99+
async run({ $ }) {
100+
const response = await this.niceboard.updateJob({
101+
$,
102+
niceboardUrl: this.niceboardUrl,
103+
jobId: this.jobId,
104+
data: {
105+
title: this.title,
106+
description_html: this.description,
107+
company_id: this.companyId,
108+
jobtype_id: this.jobTypeId,
109+
category_id: this.categoryId,
110+
location_id: this.locationId,
111+
salary_min: this.minSalary,
112+
salary_max: this.maxSalary,
113+
salary_timeframe: this.salaryTimeframe,
114+
},
115+
});
116+
117+
if (response?.job?.id) {
118+
$.export("$summary", `Successfully updated job with ID: ${response.job.id}`);
119+
}
120+
return response;
121+
},
122+
};

components/niceboard/app/niceboard.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)