mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(Todoist Node): Make it possible to move tasks between sections (#3074)
* refactor todoist implementation and break code into separate classes * add move item between sections functionality * add todoist sync integration * rebase with master * Fixed get task returning only true * Fix empty response bug * Fixed bug which prevented sections from being loaded * Removed crendentials from node and injected directly in credentials file * Remove console.logs * Changed parameter name for coherence * Fixed error * 🐛 Fix merge issues * ⚡ Improvements * 🔥 Remove unnecessary code * 👕 Fix linting issue * 👕 Fix linting issue * 🐛 Fix ts issue * 👕 Fix linting issue Co-authored-by: Rahim Rahimli <ragim95@gmail.com> Co-authored-by: Ricardo Espinoza <ricardo@n8n.io> Co-authored-by: ricardo <ricardoespinoza105@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
60
packages/nodes-base/nodes/Todoist/Service.ts
Normal file
60
packages/nodes-base/nodes/Todoist/Service.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import {
|
||||
CloseHandler,
|
||||
CreateHandler,
|
||||
DeleteHandler,
|
||||
GetAllHandler,
|
||||
GetHandler,
|
||||
MoveHandler,
|
||||
ReopenHandler,
|
||||
SyncHandler,
|
||||
UpdateHandler
|
||||
} from './OperationHandler';
|
||||
|
||||
import {Context} from './GenericFunctions';
|
||||
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);
|
||||
}
|
||||
|
||||
private handlers = {
|
||||
'create': new CreateHandler(),
|
||||
'close': new CloseHandler(),
|
||||
'delete': new DeleteHandler(),
|
||||
'get': new GetHandler(),
|
||||
'getAll': new GetAllHandler(),
|
||||
'reopen': new ReopenHandler(),
|
||||
'update': new UpdateHandler(),
|
||||
'move': new MoveHandler(),
|
||||
'sync': new SyncHandler(),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
export enum OperationType {
|
||||
create = 'create',
|
||||
close = 'close',
|
||||
delete = 'delete',
|
||||
get = 'get',
|
||||
getAll = 'getAll',
|
||||
reopen = 'reopen',
|
||||
update = 'update',
|
||||
move = 'move',
|
||||
sync = 'sync',
|
||||
}
|
||||
|
||||
export interface Section {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface Service {
|
||||
execute(ctx: Context, operation: OperationType): Promise<TodoistResponse>;
|
||||
}
|
||||
|
||||
export interface TodoistResponse {
|
||||
success?: boolean;
|
||||
data?: IDataObject;
|
||||
}
|
||||
Reference in New Issue
Block a user