Further simplified ClickUp-Dependency

This commit is contained in:
Jan Oberhauser
2020-04-22 10:05:45 +02:00
parent 75b829f8ae
commit 934340d59f
2 changed files with 11 additions and 80 deletions

View File

@@ -885,29 +885,20 @@ export class ClickUp implements INodeType {
if (resource === 'taskDependency') {
if (operation === 'create') {
const taskId = this.getNodeParameter('task', i) as string;
const dependecyIs = this.getNodeParameter('is', i) as string;
const theTaskId = this.getNodeParameter('theTaskId', i) as string;
const dependsOnTaskId = this.getNodeParameter('dependsOnTask', i) as string;
const body: IDataObject = {};
if (dependecyIs === 'waitingOn') {
body.depends_on = theTaskId;
}
if (dependecyIs === 'blocking') {
body.dependency_of = theTaskId;
}
body.depends_on = dependsOnTaskId;
responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/dependency`, body);
responseData = { success: true };
}
if (operation === 'delete') {
const taskId = this.getNodeParameter('task', i) as string;
const dependecyIs = this.getNodeParameter('is', i) as string;
const theTaskId = this.getNodeParameter('theTaskId', i) as string;
const dependsOnTaskId = this.getNodeParameter('dependsOnTask', i) as string;
qs.depends_on = dependsOnTaskId;
if (dependecyIs === 'waitingOn') {
qs.depends_on = theTaskId;
}
if (dependecyIs === 'blocking') {
qs.dependency_of = theTaskId;
}
responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/dependency`, {}, qs);
responseData = { success: true };
}