mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
⚡ small improvements
This commit is contained in:
@@ -570,6 +570,18 @@ export class ClickUp implements INodeType {
|
||||
name,
|
||||
type,
|
||||
};
|
||||
if (type === 'number' || type === 'currency') {
|
||||
if (!additionalFields.unit) {
|
||||
throw new Error('Unit field must be set');
|
||||
}
|
||||
}
|
||||
if (type === 'number' || type === 'percentaje'
|
||||
|| type === 'automatic' || type === 'currency' ) {
|
||||
if (additionalFields.stepsStart === undefined
|
||||
|| !additionalFields.stepsEnd === undefined) {
|
||||
throw new Error('Steps start and steps end fields must be set');
|
||||
}
|
||||
}
|
||||
if (additionalFields.unit) {
|
||||
body.unit = additionalFields.unit as string;
|
||||
}
|
||||
@@ -873,33 +885,28 @@ export class ClickUp implements INodeType {
|
||||
if (resource === 'taskDependency') {
|
||||
if (operation === 'create') {
|
||||
const taskId = this.getNodeParameter('task', i) as string;
|
||||
const dependsOn = this.getNodeParameter('dependsOn', i) as string;
|
||||
const dependencyOf = this.getNodeParameter('dependencyOf', i) as string;
|
||||
if (dependencyOf !== '' && dependsOn !== '' ) {
|
||||
throw new Error('Both can not be passed in the same request.');
|
||||
}
|
||||
const dependecyIs = this.getNodeParameter('is', i) as string;
|
||||
const theTaskId = this.getNodeParameter('theTaskId', i) as string;
|
||||
const body: IDataObject = {};
|
||||
if (dependsOn) {
|
||||
body.depends_on = dependsOn;
|
||||
if (dependecyIs === 'waitingOn') {
|
||||
body.depends_on = theTaskId;
|
||||
}
|
||||
if (dependencyOf) {
|
||||
body.dependency_of = dependencyOf;
|
||||
if (dependecyIs === 'blocking') {
|
||||
body.dependency_of = theTaskId;
|
||||
}
|
||||
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 dependsOn = this.getNodeParameter('dependsOn', i) as string;
|
||||
const dependencyOf = this.getNodeParameter('dependencyOf', i) as string;
|
||||
if (dependencyOf !== '' && dependsOn !== '' ) {
|
||||
throw new Error('Both can not be passed in the same request.');
|
||||
const dependecyIs = this.getNodeParameter('is', i) as string;
|
||||
const theTaskId = this.getNodeParameter('theTaskId', i) as string;
|
||||
|
||||
if (dependecyIs === 'waitingOn') {
|
||||
qs.depends_on = theTaskId;
|
||||
}
|
||||
if (dependsOn) {
|
||||
qs.depends_on = dependsOn;
|
||||
}
|
||||
if (dependencyOf) {
|
||||
qs.dependency_of = dependencyOf;
|
||||
if (dependecyIs === 'blocking') {
|
||||
qs.dependency_of = theTaskId;
|
||||
}
|
||||
responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/dependency`, {}, qs);
|
||||
responseData = { success: true };
|
||||
|
||||
Reference in New Issue
Block a user