Skip to content

Commit a22653d

Browse files
committed
new components
1 parent d608926 commit a22653d

File tree

11 files changed

+525
-363
lines changed

11 files changed

+525
-363
lines changed

components/niceboard/actions/create-category/create-category.mjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,32 @@ import niceboard from "../../niceboard.app.mjs";
33
export default {
44
key: "niceboard-create-category",
55
name: "Create Category",
6-
description: "Creates a new job category within the niceboard app. This action can help in organizing job postings more effectively.",
7-
version: "0.0.{{ts}}",
6+
description: "Creates a new job category within Niceboard.",
7+
version: "0.0.1",
88
type: "action",
99
props: {
1010
niceboard,
11+
niceboardUrl: {
12+
propDefinition: [
13+
niceboard,
14+
"niceboardUrl",
15+
],
16+
},
1117
name: {
1218
type: "string",
1319
label: "Category Name",
1420
description: "The name of the job category to be created",
1521
},
1622
},
1723
async run({ $ }) {
18-
const response = await this.niceboard.postCategory({
24+
const response = await this.niceboard.createCategory({
25+
$,
26+
niceboardUrl: this.niceboardUrl,
1927
data: {
2028
name: this.name,
2129
},
2230
});
23-
$.export("$summary", `Successfully created category with name ${this.name}`);
31+
$.export("$summary", `Successfully created category with name "${this.name}"`);
2432
return response;
2533
},
2634
};

components/niceboard/actions/create-job-alert/create-job-alert.mjs

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import niceboard from "../../niceboard.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
23

34
export default {
45
key: "niceboard-create-job",
56
name: "Create Job",
67
description: "Creates a new job posting within the Niceboard app.",
7-
version: "0.0.{{ts}}",
8+
version: "0.0.1",
89
type: "action",
910
props: {
1011
niceboard,
12+
niceboardUrl: {
13+
propDefinition: [
14+
niceboard,
15+
"niceboardUrl",
16+
],
17+
},
1118
title: {
1219
propDefinition: [
1320
niceboard,
@@ -20,54 +27,88 @@ export default {
2027
"description",
2128
],
2229
},
23-
category: {
30+
companyId: {
2431
propDefinition: [
2532
niceboard,
26-
"category",
33+
"companyId",
34+
(c) => ({
35+
niceboardUrl: c.niceboardUrl,
36+
}),
2737
],
2838
},
29-
company: {
39+
jobTypeId: {
3040
propDefinition: [
3141
niceboard,
32-
"company",
42+
"jobTypeId",
43+
(c) => ({
44+
niceboardUrl: c.niceboardUrl,
45+
}),
3346
],
3447
},
35-
jobType: {
48+
categoryId: {
3649
propDefinition: [
3750
niceboard,
38-
"jobType",
51+
"categoryId",
52+
(c) => ({
53+
niceboardUrl: c.niceboardUrl,
54+
}),
3955
],
4056
optional: true,
4157
},
42-
location: {
58+
locationId: {
4359
propDefinition: [
4460
niceboard,
45-
"location",
61+
"locationId",
62+
(c) => ({
63+
niceboardUrl: c.niceboardUrl,
64+
}),
4665
],
4766
optional: true,
4867
},
49-
salaryRange: {
68+
minSalary: {
5069
propDefinition: [
5170
niceboard,
52-
"salaryRange",
71+
"minSalary",
72+
],
73+
},
74+
maxSalary: {
75+
propDefinition: [
76+
niceboard,
77+
"maxSalary",
78+
],
79+
},
80+
salaryTimeframe: {
81+
propDefinition: [
82+
niceboard,
83+
"salaryTimeframe",
5384
],
54-
optional: true,
5585
},
5686
},
5787
async run({ $ }) {
58-
const response = await this.niceboard.postJob({
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,
5995
data: {
6096
title: this.title,
61-
description: this.description,
62-
category: this.category,
63-
company: this.company,
64-
jobType: this.jobType,
65-
location: this.location,
66-
salaryRange: this.salaryRange,
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,
67106
},
68107
});
69108

70-
$.export("$summary", `Successfully created job with ID: ${response.id}`);
109+
if (response?.job?.id) {
110+
$.export("$summary", `Successfully created job with ID: ${response.job.id}`);
111+
}
71112
return response;
72113
},
73114
};
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: "Updaets 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+
};

0 commit comments

Comments
 (0)