n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
CustomerProperties,
|
||||
} from '../../Interfaces';
|
||||
import { CustomerProperties } from '../../Interfaces';
|
||||
|
||||
import {
|
||||
addressFixedCollection
|
||||
} from '../../../methods/sharedFields';
|
||||
import { addressFixedCollection } from '../../../methods/sharedFields';
|
||||
|
||||
export const customerUpdateDescription: CustomerProperties = [
|
||||
{
|
||||
@@ -13,12 +9,8 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -30,12 +22,8 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -101,9 +89,7 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
noEmail: [
|
||||
false,
|
||||
],
|
||||
noEmail: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -118,7 +104,8 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
name: 'referredBy',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Source from which customer is referred to the platform like Linkedin, Google, Customer name etc',
|
||||
description:
|
||||
'Source from which customer is referred to the platform like Linkedin, Google, Customer name etc',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function updateCustomer(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function updateCustomer(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('customerId', index) as IDataObject;
|
||||
const { address, businessName, email, firstName, getSms, invoiceCcEmails,
|
||||
lastName, noEmail, notes, notificationEmail, phone, referredBy } = this.getNodeParameter('updateFields', index) as IDataObject;
|
||||
const {
|
||||
address,
|
||||
businessName,
|
||||
email,
|
||||
firstName,
|
||||
getSms,
|
||||
invoiceCcEmails,
|
||||
lastName,
|
||||
noEmail,
|
||||
notes,
|
||||
notificationEmail,
|
||||
phone,
|
||||
referredBy,
|
||||
} = this.getNodeParameter('updateFields', index) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'PUT';
|
||||
@@ -35,7 +41,7 @@ export async function updateCustomer(this: IExecuteFunctions, index: number): Pr
|
||||
email,
|
||||
firstname: firstName,
|
||||
get_sms: getSms,
|
||||
invoice_cc_emails: (invoiceCcEmails as string[] || []).join(','),
|
||||
invoice_cc_emails: ((invoiceCcEmails as string[]) || []).join(','),
|
||||
lastname: lastName,
|
||||
no_email: noEmail,
|
||||
notes,
|
||||
@@ -47,7 +53,10 @@ export async function updateCustomer(this: IExecuteFunctions, index: number): Pr
|
||||
let responseData;
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
if (!responseData.customer) {
|
||||
throw new NodeApiError(this.getNode(), responseData, { httpCode: '404', message: 'Customer ID not found' });
|
||||
throw new NodeApiError(this.getNode(), responseData, {
|
||||
httpCode: '404',
|
||||
message: 'Customer ID not found',
|
||||
});
|
||||
}
|
||||
return this.helpers.returnJsonArray(responseData.customer);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { updateCustomer as execute } from './execute';
|
||||
import { customerUpdateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
Reference in New Issue
Block a user