fix(Todoist Node): Fix multiple item support (#3614)

* Fixed multiple items handling with todoist node

* Removed unused import
This commit is contained in:
Jonathan Bennetts 2022-07-04 08:43:56 +01:00 committed by GitHub
parent bb41f8388d
commit 7ba85c4ab9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -15,8 +15,8 @@ import { IDataObject } from 'n8n-workflow';
export class TodoistService implements Service {
async execute(ctx: Context, operation: OperationType): Promise<TodoistResponse> {
return this.handlers[operation].handleOperation(ctx, 0);
async execute(ctx: Context, operation: OperationType, itemIndex: number): Promise<TodoistResponse> {
return this.handlers[operation].handleOperation(ctx, itemIndex);
}
private handlers = {
@ -51,7 +51,7 @@ export interface Section {
}
export interface Service {
execute(ctx: Context, operation: OperationType): Promise<TodoistResponse>;
execute(ctx: Context, operation: OperationType, itemIndex: number): Promise<TodoistResponse>;
}
export interface TodoistResponse {

View file

@ -10,7 +10,7 @@ import {
INodeTypeDescription,
} from 'n8n-workflow';
import {FormatDueDatetime, todoistApiRequest,} from './GenericFunctions';
import {todoistApiRequest,} from './GenericFunctions';
import {OperationType, TodoistService} from './Service';
interface IBodyCreateTask {
@ -698,7 +698,7 @@ export class Todoist implements INodeType {
for (let i = 0; i < length; i++) {
try {
if (resource === 'task') {
responseData = (await service.execute(this, OperationType[operation as keyof typeof OperationType]));
responseData = (await service.execute(this, OperationType[operation as keyof typeof OperationType], i));
}
if (Array.isArray(responseData?.data)) {
returnData.push.apply(returnData, responseData?.data as IDataObject[]);