mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Add boadItem:move ooperation (Monday.com) (#1533)
Thanks a lot. Got merged.
This commit is contained in:
parent
f7bd3060bd
commit
ac4e4cd17d
|
@ -55,6 +55,11 @@ export const boardItemOperations = [
|
||||||
value: 'getByColumnValue',
|
value: 'getByColumnValue',
|
||||||
description: 'Get items by column value',
|
description: 'Get items by column value',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Move',
|
||||||
|
value: 'move',
|
||||||
|
description: 'Move item to group',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
default: 'create',
|
default: 'create',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
|
@ -63,9 +68,9 @@ export const boardItemOperations = [
|
||||||
|
|
||||||
export const boardItemFields = [
|
export const boardItemFields = [
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:addUpdate */
|
/* boardItem:addUpdate */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Item ID',
|
displayName: 'Item ID',
|
||||||
name: 'itemId',
|
name: 'itemId',
|
||||||
|
@ -102,9 +107,9 @@ export const boardItemFields = [
|
||||||
},
|
},
|
||||||
description: 'The update text to add.',
|
description: 'The update text to add.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:changeColumnValue */
|
/* boardItem:changeColumnValue */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Board ID',
|
displayName: 'Board ID',
|
||||||
name: 'boardId',
|
name: 'boardId',
|
||||||
|
@ -186,9 +191,9 @@ export const boardItemFields = [
|
||||||
},
|
},
|
||||||
description: 'The column value in JSON format. Documentation can be found <a href="https://monday.com/developers/v2#mutations-section-columns-change-column-value" target="_blank">here</a>.',
|
description: 'The column value in JSON format. Documentation can be found <a href="https://monday.com/developers/v2#mutations-section-columns-change-column-value" target="_blank">here</a>.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:changeMultipleColumnValues */
|
/* boardItem:changeMultipleColumnValues */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Board ID',
|
displayName: 'Board ID',
|
||||||
name: 'boardId',
|
name: 'boardId',
|
||||||
|
@ -249,9 +254,9 @@ export const boardItemFields = [
|
||||||
alwaysOpenEditWindow: true,
|
alwaysOpenEditWindow: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:create */
|
/* boardItem:create */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Board ID',
|
displayName: 'Board ID',
|
||||||
name: 'boardId',
|
name: 'boardId',
|
||||||
|
@ -342,9 +347,9 @@ export const boardItemFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:delete */
|
/* boardItem:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Item ID',
|
displayName: 'Item ID',
|
||||||
name: 'itemId',
|
name: 'itemId',
|
||||||
|
@ -363,9 +368,9 @@ export const boardItemFields = [
|
||||||
},
|
},
|
||||||
description: `Item's ID`,
|
description: `Item's ID`,
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:get */
|
/* boardItem:get */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Item ID',
|
displayName: 'Item ID',
|
||||||
name: 'itemId',
|
name: 'itemId',
|
||||||
|
@ -384,9 +389,9 @@ export const boardItemFields = [
|
||||||
},
|
},
|
||||||
description: `Item's ID (Multiple can be added separated by comma)`,
|
description: `Item's ID (Multiple can be added separated by comma)`,
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:getAll */
|
/* boardItem:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Board ID',
|
displayName: 'Board ID',
|
||||||
name: 'boardId',
|
name: 'boardId',
|
||||||
|
@ -471,9 +476,9 @@ export const boardItemFields = [
|
||||||
default: 50,
|
default: 50,
|
||||||
description: 'How many results to return.',
|
description: 'How many results to return.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:getByColumnValue */
|
/* boardItem:getByColumnValue */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Board ID',
|
displayName: 'Board ID',
|
||||||
name: 'boardId',
|
name: 'boardId',
|
||||||
|
@ -578,4 +583,68 @@ export const boardItemFields = [
|
||||||
default: 50,
|
default: 50,
|
||||||
description: 'How many results to return.',
|
description: 'How many results to return.',
|
||||||
},
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* boardItem:move */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Board ID',
|
||||||
|
name: 'boardId',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getBoards',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'move',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Item ID',
|
||||||
|
name: 'itemId',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'move',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: `The item's ID`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Group ID',
|
||||||
|
name: 'groupId',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getGroups',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'boardId',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'move',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
|
@ -38,7 +38,7 @@ import {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
snakeCase,
|
snakeCase,
|
||||||
} from 'change-case';
|
} from 'change-case';
|
||||||
|
|
||||||
interface IGraphqlBody {
|
interface IGraphqlBody {
|
||||||
query: string;
|
query: string;
|
||||||
|
@ -322,7 +322,7 @@ export class MondayCom implements INodeType {
|
||||||
if (returnAll === true) {
|
if (returnAll === true) {
|
||||||
responseData = await mondayComApiRequestAllItems.call(this, 'data.boards', body);
|
responseData = await mondayComApiRequestAllItems.call(this, 'data.boards', body);
|
||||||
} else {
|
} else {
|
||||||
body.variables.limit = this.getNodeParameter('limit', i) as number;
|
body.variables.limit = this.getNodeParameter('limit', i) as number;
|
||||||
responseData = await mondayComApiRequest.call(this, body);
|
responseData = await mondayComApiRequest.call(this, body);
|
||||||
responseData = responseData.data.boards;
|
responseData = responseData.data.boards;
|
||||||
}
|
}
|
||||||
|
@ -695,6 +695,26 @@ export class MondayCom implements INodeType {
|
||||||
responseData = responseData.data.items_by_column_values;
|
responseData = responseData.data.items_by_column_values;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (operation === 'move') {
|
||||||
|
const groupId = this.getNodeParameter('groupId', i) as string;
|
||||||
|
const itemId = parseInt(this.getNodeParameter('itemId', i) as string, 10);
|
||||||
|
|
||||||
|
const body: IGraphqlBody = {
|
||||||
|
query:
|
||||||
|
`mutation ($groupId: String!, $itemId: Int!) {
|
||||||
|
move_item_to_group (group_id: $groupId, item_id: $itemId) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
variables: {
|
||||||
|
groupId,
|
||||||
|
itemId,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
responseData = await mondayComApiRequest.call(this, body);
|
||||||
|
responseData = responseData.data.move_item_to_group;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData)) {
|
if (Array.isArray(responseData)) {
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||||
|
|
Loading…
Reference in a new issue