mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix(Todoist Node): Fix multiple item support (#3614)
* Fixed multiple items handling with todoist node * Removed unused import
This commit is contained in:
parent
bb41f8388d
commit
7ba85c4ab9
|
@ -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 {
|
||||
|
|
|
@ -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[]);
|
||||
|
|
Loading…
Reference in a new issue