Skip to content

Commit

Permalink
5428 - Clickup improvement (PipedreamHQ#5478)
Browse files Browse the repository at this point in the history
* Creating listId prop for "new task" source

* Checking listId on 'new task' event

* Adding description for new list prop

* Updating version numbers
  • Loading branch information
GTFalcao authored Feb 15, 2023
1 parent db971c3 commit c16ddff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/clickup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/clickup",
"version": "0.0.8",
"version": "0.1.0",
"description": "Pipedream Clickup Components",
"main": "clickup.app.mjs",
"keywords": [
Expand Down
31 changes: 29 additions & 2 deletions components/clickup/sources/new-task/new-task.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import common from "../common/common.mjs";
import app from "../../clickup.app.mjs";

export default {
...common,
key: "clickup-new-task",
name: "New Task (Instant)",
description: "Emit new event when a new task is created",
version: "0.0.4",
version: "0.1.0",
dedupe: "unique",
type: "source",
props: {
...common.props,
listId: {
propDefinition: [
app,
"lists",
({ workspaceId }) => ({
workspaceId,
}),
],
description: "If a list is selected, only tasks created in this list will emit an event",
optional: true,
},
},
methods: {
...common.methods,
_getMeta({ task_id: taskId }) {
Expand All @@ -26,6 +41,18 @@ export default {
async run(httpRequest) {
console.log("Event received");
this.checkSignature(httpRequest);
this.$emit(httpRequest.body, this._getMeta(httpRequest.body));

const { body } = httpRequest;
const { listId } = this;
if (listId) {
const { task_id: taskId } = body;
const { list: { id } } = await this.app.getTask({
taskId,
});

if (id !== listId) return;
}

this.$emit(body, this._getMeta(body));
},
};

0 comments on commit c16ddff

Please sign in to comment.