Add boadItem:move ooperation (Monday.com) (#1533)

Thanks a lot. Got merged.
This commit is contained in:
Ricardo Espinoza 2021-03-12 05:32:04 -05:00 committed by GitHub
parent f7bd3060bd
commit ac4e4cd17d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 115 additions and 26 deletions

View file

@ -55,6 +55,11 @@ export const boardItemOperations = [
value: 'getByColumnValue',
description: 'Get items by column value',
},
{
name: 'Move',
value: 'move',
description: 'Move item to group',
},
],
default: 'create',
description: 'The operation to perform.',
@ -578,4 +583,68 @@ export const boardItemFields = [
default: 50,
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[];

View file

@ -695,6 +695,26 @@ export class MondayCom implements INodeType {
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)) {
returnData.push.apply(returnData, responseData as IDataObject[]);