Skip to content

Commit

Permalink
PIPE-210 - Enable priority result to be returned in the output
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryangr0 committed Aug 13, 2024
1 parent fec1f57 commit 67809bd
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
.idea
*~
real_user_mapping.json
real_user_mapping.json
*.private.env.json
6 changes: 6 additions & 0 deletions __tests__/get_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
"status": {
"status": "in progress"
},
"priority": {
"color": "#d8d8d8",
"id": "4",
"orderindex": "4",
"priority": "low"
},
"url": "https://app.clickup.com/t/9hx"
}
14 changes: 13 additions & 1 deletion __tests__/get_tasks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ test('Test get 2 tasks from Clickup API', async () => {
{
"custom_id": "TEST123",
"description": "Price isn't correct "displayed" in the rich snippets",
"priority": {
"color": "#d8d8d8",
"id": "4",
"orderindex": "4",
"priority": "low"
},
"url": "https://app.clickup.com/t/9hx"
},
{
"custom_id": "TEST123",
"description": "Price isn't correct "displayed" in the rich snippets",
"priority": {
"color": "#d8d8d8",
"id": "4",
"orderindex": "4",
"priority": "low"
},
"url": "https://app.clickup.com/t/9hx"
}
]);
Expand All @@ -40,7 +52,7 @@ test('Test get 2 tasks from Clickup API', async () => {

beforeEach(() => {
process.env['INPUT_CLICKUP_TOKEN'] = 'pk_123'
process.env['INPUT_RESPONSE_FIELDS'] = 'url\ndescription\ncustom_id'
process.env['INPUT_RESPONSE_FIELDS'] = 'url\ndescription\ncustom_id\npriority'
process.env['INPUT_CLICKUP_CUSTOM_TASK_IDS'] = 'ABC-185\nDEF-186'
process.env['INPUT_CLICKUP_TEAM_ID'] = '123'
process.env['INPUT_CONVERT_QUOTES'] = 'true'
Expand Down
7 changes: 7 additions & 0 deletions __tests__/manual/clickup.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Invoices
# @no-cookie-jar
GET {{host}}/api/v2/task/PIPE-221?custom_task_ids=true&team_id={{team_id}}
Authorization: {{clickup_api_token}}
User-Agent: vendic-clickup-get-tasks
Accept: {{accept}}
1
7 changes: 7 additions & 0 deletions __tests__/manual/http-client.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"development": {
"host": "https://api.clickup.com/",
"accept": "application/json",
"team_id": "6651913"
}
}
5 changes: 3 additions & 2 deletions src/get_tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export default async function get_tasks(): Promise<void> {

if (convert_quotes) {
Object.keys(task).forEach(function (key : string) {
if (typeof task[key as keyof Task] === 'string') {
task[key as keyof Task] = convertQuotesToHtml(task[key as keyof Task]);
const value = task[key as keyof Task];
if (typeof value === 'string') {
task[key as keyof Task] = convertQuotesToHtml(value) as any;
}
});
}
Expand Down
10 changes: 9 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
export type Task = {
url : string,
description: string,
custom_id: string
custom_id: string,
priority?: Priority,
}

export type Priority = {
color: string; // Optional property for color
id: string;
orderindex: string;
priority: string;
};

0 comments on commit 67809bd

Please sign in to comment.