mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 22:54:05 -08:00
214dd5061e
* Init Node * Added get customer details api for syncomsp-node * Fixed formatting bug 🐛 * Updated description for query params, and removed redundant condition in router * Changed default value for page parameter * 🚢 Added tickets API * 🚢 Added contacts API * 🚢 Added RMM Alerts API * Add customer API * Updates post code review * Rename SyncroMspAPI.credentials.ts to SyncroMspApi.credentials.ts * added create and delete method to customers module * fix liniting issue * Added Update method to customer module * Code Review Changes * 🚢 Added CRUD for contacts endpoint * 🚢 Added CRUD for RMM Alert endpoint * Added options for status field * 🐛 fix linting issues * Init Node * Added get customer details api for syncomsp-node * Fixed formatting bug 🐛 * Updated description for query params, and removed redundant condition in router * Changed default value for page parameter * 🚢 Added tickets API * 🚢 Added contacts API * 🚢 Added RMM Alerts API * Updates post code review * Add customer API * added create and delete method to customers module * fix liniting issue * Added Update method to customer module * Rename SyncroMspAPI.credentials.ts to SyncroMspApi.credentials.ts * Code Review Changes * 🚢 Added CRUD for contacts endpoint * 🚢 Added CRUD for RMM Alert endpoint * Added options for status field * 🐛 fix linting issues * 🚢 Added CRUD for ticket endpoint * :tag: update get customer module * :tag: update get customer module * Minor bug fixes * Changed response for ticket update * 👕 Fix lint issue * Alphabetically ordered all options * 🐛 Fixed build issue * 🐛 Fixed Server.ts build issue, rebased from master * ⚡ Fix node issues * ⚡ Fix more issues * ⚡ Fixed all operations with the standard convention * 👕 Fix lint * Fix reviewed changes * update border color * ⚡ minor fixes * minor fixes * Added fallback when port in use * ⚡ Minor Fixes * ⚡ Hide addtional paramerts when return all is active * ⚡ Fix issues with Tickets * ⚡ Fix issues with Rmm * ⚡ Fix issues with Customer * 👕 Fix lint * ⚡ Fix issues with Contact * 👕 Fixed formatting issue * ⚡ Return 404 in ID not found * 👕 Fixed formatting issue * ⚡ Improvements * ⚡ Improvements * ⚡ Improvements * ⚡ Add credentials verification * ⚡ Improvements * ⚡ Improvements * ⚡ Additional improvements Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com> Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import {
|
|
IExecuteFunctions,
|
|
} from 'n8n-core';
|
|
|
|
import {
|
|
INodeExecutionData, NodeApiError,
|
|
} from 'n8n-workflow';
|
|
|
|
import * as customer from './customer';
|
|
import * as ticket from './ticket';
|
|
import * as contact from './contact';
|
|
import * as rmm from './rmm';
|
|
|
|
import { SyncroMsp } from './Interfaces';
|
|
|
|
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
const items = this.getInputData();
|
|
const operationResult: INodeExecutionData[] = [];
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
const resource = this.getNodeParameter<SyncroMsp>('resource', i);
|
|
let operation = this.getNodeParameter('operation', i);
|
|
if (operation === 'del') {
|
|
operation = 'delete';
|
|
}
|
|
|
|
const syncroMsp = {
|
|
resource,
|
|
operation,
|
|
} as SyncroMsp;
|
|
|
|
try {
|
|
if (syncroMsp.resource === 'customer') {
|
|
operationResult.push(...await customer[syncroMsp.operation].execute.call(this, i));
|
|
} else if (syncroMsp.resource === 'ticket') {
|
|
operationResult.push(...await ticket[syncroMsp.operation].execute.call(this, i));
|
|
} else if (syncroMsp.resource === 'contact') {
|
|
operationResult.push(...await contact[syncroMsp.operation].execute.call(this, i));
|
|
} else if (syncroMsp.resource === 'rmm') {
|
|
operationResult.push(...await rmm[syncroMsp.operation].execute.call(this, i));
|
|
}
|
|
} catch (err) {
|
|
if (this.continueOnFail()) {
|
|
operationResult.push({ json: this.getInputData(i)[0].json, error: err });
|
|
} else {
|
|
throw new NodeApiError(this.getNode(), err);
|
|
}
|
|
}
|
|
}
|
|
|
|
return [operationResult];
|
|
}
|