added company & people functions

This commit is contained in:
Joel Sanguenza 2022-10-31 20:52:50 +08:00
parent 9057d8b2cf
commit 81d5b80a92
5 changed files with 1193 additions and 17 deletions

View file

@ -0,0 +1,372 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const companiesOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
required: true,
displayOptions: {
show: {
resource: [
'company',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new company',
action: 'Create a company',
},
{
name: 'Get',
value: 'get',
description: 'Get companies',
action: 'Get a company',
},
{
name: 'Update',
value: 'update',
description: 'Update a company',
action: 'Update a company',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a company',
action: 'Delete a company',
},
],
default: 'create',
},
];
export const companiesDescription: INodeProperties[] = [
{
displayName: 'Company ID',
name: '_id',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'update',
'delete',
'get',
],
},
},
description: 'ID of Company',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'create',
'update',
'get',
],
},
},
description: 'Company Name or Title',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
description: 'Company Industry',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'create',
'update',
],
},
},
options: [
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
description: 'Company Industry',
},
{
displayName: 'Custom Fields',
name: 'customFields',
type: 'fixedCollection',
placeholder: 'Add Custom Field',
typeOptions: {
multipleValues: true,
},
description: 'Key value pairs containing the name and value of the custom field. Only dates in the format YYYY-MM-DD are accepted as input for custom date fields.',
default: [],
options: [
{
displayName: 'Custom Field',
name: 'customField',
values: [
{
displayName: 'Custom Field Name or ID',
name: '_id',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getCompanyCustomField',
},
},
{
displayName: 'Value Name or ID',
name: 'value',
type: 'string',
default: '',
description: 'Custom Field\'s values',
},
],
},
],
},
{
displayName: 'Billing Custom Fields',
name: 'billingCustomFields',
type: 'fixedCollection',
placeholder: 'Add Billing Custom Field',
typeOptions: {
multipleValues: true,
},
description: 'Key value pairs containing the name and value of the custom field. Only dates in the format YYYY-MM-DD are accepted as input for custom date fields.',
default: [],
options: [
{
displayName: 'Custom Field',
name: 'customField',
values: [
{
displayName: 'Key',
name: 'key',
type: 'string',
description: 'Billing Custom Field Key',
default: '',
},
{
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: 'Billing Custom Field values',
},
],
},
],
},
{
displayName: 'Contact Phones',
name: 'phones',
type: 'fixedCollection',
default: [],
placeholder: 'Add Contact Phones',
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Contact Phone',
name: 'phone',
values: [
{
displayName: 'Phone Number',
name: 'number',
type: 'string',
description: 'Enter Phone Number',
default: '',
},
{
displayName: 'Type',
name: 'type',
type: 'string',
description: 'Phone Number Type',
default: 'phone',
},
],
},
],
description: 'Company phone number. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
},
{
displayName: 'Contact Emails',
name: 'emails',
type: 'fixedCollection',
default: [],
placeholder: 'Add Contact Emails',
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Contact Email',
name: 'email',
values: [
{
displayName: 'Email Address',
name: 'address',
type: 'string',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
},
{
displayName: 'Type',
name: 'type',
type: 'string',
description: 'Email Type',
default: 'email',
},
],
},
],
description: 'Company Email Address. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
},
],
},
{
displayName: 'Address',
name: 'address',
type: 'fixedCollection',
placeholder: 'Enter Address',
typeOptions: {
multipleValues: false,
},
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'create',
'update',
],
},
},
description: 'Enter Street, City, Country, Zip-Code',
default: [],
options: [
{
displayName: 'Address',
name: 'address',
values: [
{
displayName: 'Street',
name: 'street',
type: 'string',
description: 'Enter Street',
default: '',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'Enter City',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
description: 'Enter Country',
},
{
displayName: 'Zip Code',
name: 'zipCode',
type: 'string',
default: '',
description: 'Enter Zip Code',
},
],
},
],
},
{
displayName: 'People',
name: 'people',
type: 'fixedCollection',
placeholder: 'Add People',
typeOptions: {
multipleValues: true,
},
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'create',
'update',
],
},
},
description: 'Add People',
default: [],
options: [
{
displayName: 'People',
name: 'person',
values: [
{
displayName: 'Name or ID',
name: '_id',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
},
{
displayName: 'Role',
name: 'role',
type: 'string',
default: '',
description: 'Person\'s Role',
},
],
},
],
},
];

View file

@ -102,7 +102,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Project Name or ID',
name: 'projectId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
@ -113,7 +113,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Task Board Name or ID',
name: 'taskBoardId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskBoardId',
@ -123,7 +123,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Task Group Name or ID',
name: 'taskGroupId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskGroupId',
@ -133,7 +133,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Template Name or ID',
name: 'templateId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskTemplateId',
@ -143,7 +143,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Creator Name or ID',
name: 'createdBy',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
@ -182,10 +182,10 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Custom Field Name or ID',
name: '_id',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getCustomFieldTitle',
loadOptionsMethod: 'getTaskCustomField',
},
},
@ -231,7 +231,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Assigned To: Name or ID',
name: 'value',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
@ -271,7 +271,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Followers: Name or ID',
name: 'value',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
@ -287,7 +287,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Task Group Name or ID',
name: 'taskGroupId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskGroupId',
@ -351,7 +351,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Project Name or ID',
name: 'projectId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getProjectId',
@ -361,7 +361,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Task Board Name or ID',
name: 'taskBoardId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskBoardId',
@ -371,7 +371,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Task Group Name or ID',
name: 'taskGroupId',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskGroupId',
@ -381,7 +381,7 @@ export const taskDescription: INodeProperties[] = [
displayName: 'Creator Name or ID',
name: 'createdBy',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',

View file

@ -2,6 +2,8 @@ import { taskDescription, taskOperations } from './TaskDescription';
import { commentDescription, commentOperations } from './CommentDescription';
import { invoiceDescription, invoiceOperations } from './InvoiceDescription';
import { projectDescription, projectOperations } from './ProjectDescription';
import { companiesDescription, companiesOperations } from './CompaniesDescription';
import { peopleDescription, peopleOperations } from './PeopleDescription';
export {
taskOperations,
@ -12,4 +14,8 @@ export {
invoiceDescription,
projectOperations,
projectDescription,
companiesOperations,
companiesDescription,
peopleOperations,
peopleDescription,
};

View file

@ -0,0 +1,318 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const peopleOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
required: true,
displayOptions: {
show: {
resource: [
'people',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new people',
action: 'Create a people',
},
{
name: 'Get',
value: 'get',
description: 'Get people',
action: 'Get a people',
},
{
name: 'Update',
value: 'update',
description: 'Update a people',
action: 'Update a people',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a people',
action: 'Delete a people',
},
],
default: 'create',
},
];
export const peopleDescription: INodeProperties[] = [
{
displayName: 'ID',
name: '_id',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'people',
],
operation: [
'update',
'delete',
'get',
],
},
},
description: 'ID of Person',
},
{
displayName: 'Name',
name: 'name',
type: 'fixedCollection',
placeholder: 'Enter Name',
typeOptions: {
multipleValues: false,
},
description: 'Enter First name & Last name',
default: [],
displayOptions: {
show: {
resource: [
'people',
],
operation: [
'create',
'update',
],
},
},
options: [
{
displayName: 'Name',
name: 'customName',
values: [
{
displayName: 'First Name',
name: 'first',
type: 'string',
description: 'Enter First Name',
default: '',
},
{
displayName: 'Last Name',
name: 'last',
type: 'string',
default: '',
description: 'Enter Last Name',
},
],
},
],
},
{
displayName: 'Role',
name: 'role',
type: 'string',
default: '',
description: 'Enter Role',
displayOptions: {
show: {
resource: [
'people',
],
operation: [
'create',
'update',
'get',
],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: [
'people',
],
operation: [
'create',
'update',
],
},
},
options: [
{
displayName: 'Company',
name: 'company',
type: 'string',
default: '',
description: 'Company Name',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
description: 'Enter Status',
default: 'active',
options: [
{
name: 'Active',
value: 'active',
},
{
name: 'Inactive',
value: 'inactive',
},
{
name: 'Archive',
value: 'archive',
},
{
name: 'Pending',
value: 'pending',
},
],
},
{
displayName: 'Custom Fields',
name: 'customFields',
type: 'fixedCollection',
placeholder: 'Add Custom Field',
typeOptions: {
multipleValues: true,
},
description: 'Key value pairs containing the name and value of the custom field. Only dates in the format YYYY-MM-DD are accepted as input for custom date fields.',
default: [],
options: [
{
displayName: 'Custom Field',
name: 'customField',
values: [
{
displayName: 'Custom Field Name or ID',
name: '_id',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getPeopleCustomField',
},
},
{
displayName: 'Value Name or ID',
name: 'value',
type: 'string',
default: '',
description: 'Custom Field\'s values',
},
],
},
],
},
{
displayName: 'Contact Phones',
name: 'phones',
type: 'fixedCollection',
default: [],
placeholder: 'Add Contact Phones',
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Contact Phone',
name: 'phone',
values: [
{
displayName: 'Phone Number',
name: 'number',
type: 'string',
description: 'Enter Phone Number',
default: '',
},
{
displayName: 'Type',
name: 'type',
type: 'options',
description: 'Email Type',
default: 'phone',
options: [
{
name: 'Phone',
value: 'phone',
},
{
name: 'Work',
value: 'work',
},
{
name: 'Alternative',
value: 'alternative',
},
{
name: 'Mobile',
value: 'mobile',
},
],
},
],
},
],
description: 'Emter phone number',
},
{
displayName: 'Contact Emails',
name: 'emails',
type: 'fixedCollection',
default: [],
placeholder: 'Add Contact Emails',
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Contact Email',
name: 'email',
values: [
{
displayName: 'Email Address',
name: 'address',
type: 'string',
description: 'Enter Email Address',
default: '',
},
{
displayName: 'Type',
name: 'type',
type: 'options',
description: 'Email Type',
default: 'email',
options: [
{
name: 'Email',
value: 'email',
},
{
name: 'Work',
value: 'work',
},
{
name: 'Alternative',
value: 'alternative',
},
],
},
],
},
],
description: 'Enter Email Address',
},
],
},
];