1+ import { STATUS_OPTIONS } from "../../common/constants.mjs" ;
2+ import { parseObject } from "../../common/utils.mjs" ;
13import everhour from "../../everhour.app.mjs" ;
2- import { axios } from "@pipedream/platform" ;
34
45export default {
56 key : "everhour-create-task" ,
@@ -18,19 +19,22 @@ export default {
1819 name : {
1920 type : "string" ,
2021 label : "Task Name" ,
21- description : "The name of the task to be created" ,
22- optional : true ,
22+ description : "The name of the task to be created." ,
2323 } ,
24- section : {
25- type : "string" ,
26- label : "Section" ,
27- description : "The section of the task" ,
28- optional : true ,
24+ sectionId : {
25+ propDefinition : [
26+ everhour ,
27+ "sectionId" ,
28+ ( { projectId } ) => ( {
29+ projectId,
30+ } ) ,
31+ ] ,
2932 } ,
30- labels : {
31- type : "string[]" ,
32- label : "Labels" ,
33- description : "An array of labels associated with the task" ,
33+ tags : {
34+ propDefinition : [
35+ everhour ,
36+ "tags" ,
37+ ] ,
3438 optional : true ,
3539 } ,
3640 position : {
@@ -45,29 +49,33 @@ export default {
4549 description : "A description of the task" ,
4650 optional : true ,
4751 } ,
48- dueon : {
52+ dueOn : {
4953 type : "string" ,
5054 label : "Due Date" ,
51- description : "The due date of the task (ISO 8601 format) " ,
55+ description : "The due date of the task. **Format: YYYY-MM-DD** " ,
5256 optional : true ,
5357 } ,
5458 status : {
5559 type : "string" ,
5660 label : "Status" ,
5761 description : "The status of the task" ,
62+ options : STATUS_OPTIONS ,
5863 optional : true ,
5964 } ,
6065 } ,
6166 async run ( { $ } ) {
6267 const response = await this . everhour . createTask ( {
68+ $,
6369 projectId : this . projectId ,
64- name : this . name ,
65- section : this . section ,
66- labels : this . labels ,
67- position : this . position ,
68- description : this . description ,
69- dueon : this . dueon ,
70- status : this . status ,
70+ data : {
71+ name : this . name ,
72+ section : this . sectionId ,
73+ tags : this . tags && parseObject ( this . tags ) ,
74+ position : this . position ,
75+ description : this . description ,
76+ dueOn : this . dueOn ,
77+ status : this . status ,
78+ } ,
7179 } ) ;
7280
7381 $ . export ( "$summary" , `Successfully created task with ID: ${ response . id } ` ) ;
0 commit comments