🔥 Remove unused filters

This commit is contained in:
Iván Ovejero 2021-05-07 10:18:10 +02:00
parent a885518019
commit 15b8db75d8
2 changed files with 8 additions and 96 deletions

View file

@ -192,14 +192,7 @@ export class ZohoCrm implements INodeType {
// account: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/accounts', body);
responseData = await handleListing.call(this, 'GET', '/accounts');
} else if (operation === 'update') {
@ -275,14 +268,7 @@ export class ZohoCrm implements INodeType {
// contact: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/contacts', body);
responseData = await handleListing.call(this, 'GET', '/contacts');
} else if (operation === 'update') {
@ -357,14 +343,7 @@ export class ZohoCrm implements INodeType {
// deal: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/deals', body);
responseData = await handleListing.call(this, 'GET', '/deals');
} else if (operation === 'update') {
@ -440,14 +419,7 @@ export class ZohoCrm implements INodeType {
// invoice: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/invoices', body);
responseData = await handleListing.call(this, 'GET', '/invoices');
} else if (operation === 'update') {
@ -522,14 +494,7 @@ export class ZohoCrm implements INodeType {
// lead: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/leads', body);
responseData = await handleListing.call(this, 'GET', '/leads');
} else if (operation === 'update') {
@ -605,14 +570,7 @@ export class ZohoCrm implements INodeType {
// purchaseOrder: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/purchaseorders', body);
responseData = await handleListing.call(this, 'GET', '/purchaseorders');
} else if (operation === 'update') {
@ -687,14 +645,7 @@ export class ZohoCrm implements INodeType {
// quote: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/quotes', body);
responseData = await handleListing.call(this, 'GET', '/quotes');
} else if (operation === 'update') {
@ -770,14 +721,7 @@ export class ZohoCrm implements INodeType {
// salesOrder: getAll
// ----------------------------------------
const body: IDataObject = {};
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (Object.keys(filters).length) {
Object.assign(body, filters);
}
responseData = await handleListing.call(this, 'GET', '/salesorders', body);
responseData = await handleListing.call(this, 'GET', '/salesorders');
} else if (operation === 'update') {

View file

@ -304,12 +304,6 @@ export const productDetails = {
],
};
const pluralize = (resource: string) => (isCamelCase(resource) ? splitCamelCased(resource) : resource) + 's';
const isCamelCase = (resource: string) => /([a-z])([A-Z])/.test(resource);
const splitCamelCased = (resource: string) => resource.replace(/([a-z])([A-Z])/, '$1 $2').toLowerCase();
export const makeGetAllFields = (resource: string) => [
{
displayName: 'Return All',
@ -352,30 +346,4 @@ export const makeGetAllFields = (resource: string) => [
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
resource: [
resource,
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'IDs',
name: 'id',
type: 'string',
default: '',
description: `Comma-separated list of IDs to filter the ${pluralize(resource)} by.`,
},
],
},
];