mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
* 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>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import {
|
|
IExecuteFunctions,
|
|
} from 'n8n-core';
|
|
|
|
import {
|
|
IDataObject,
|
|
INodeExecutionData,
|
|
NodeOperationError,
|
|
} from 'n8n-workflow';
|
|
|
|
import {
|
|
apiRequest,
|
|
} from '../../../transport';
|
|
|
|
|
|
export async function updateTicket(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
|
const id = this.getNodeParameter('ticketId', index) as IDataObject;
|
|
const { assetId, customerId, dueDate, issueType, status, subject, ticketType, contactId } = this.getNodeParameter('updateFields', index) as IDataObject;
|
|
|
|
|
|
const qs = {} as IDataObject;
|
|
const requestMethod = 'PUT';
|
|
const endpoint = `tickets/${id}`;
|
|
let body = {} as IDataObject;
|
|
|
|
body = {
|
|
...(assetId && { asset_id: assetId }),
|
|
...(customerId && { customer_id: customerId }),
|
|
...(dueDate && { due_date: dueDate }),
|
|
...(issueType && { problem_type: issueType }),
|
|
...(status && { status }),
|
|
...(subject && { subject }),
|
|
...(ticketType && { ticket_type: ticketType }),
|
|
...(contactId && { contact_id: contactId }),
|
|
};
|
|
|
|
if (!Object.keys(body).length) {
|
|
throw new NodeOperationError(this.getNode(), 'At least one update fields has to be defined');
|
|
}
|
|
|
|
let responseData;
|
|
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
|
|
|
return this.helpers.returnJsonArray(responseData.ticket);
|
|
}
|