diff --git a/packages/backend/src/apps/monday/actions/create-column/index.js b/packages/backend/src/apps/monday/actions/create-column/index.js new file mode 100644 index 00000000..2ea3d0ae --- /dev/null +++ b/packages/backend/src/apps/monday/actions/create-column/index.js @@ -0,0 +1,98 @@ +import defineAction from '../../../../helpers/define-action.js'; + +export default defineAction({ + name: 'Create column', + key: 'createColumn', + description: 'Creates a new column in a board.', + arguments: [ + { + label: 'Board', + key: 'boardId', + type: 'dropdown', + required: true, + description: '', + variables: true, + source: { + type: 'query', + name: 'getDynamicData', + arguments: [ + { + name: 'key', + value: 'listBoards', + }, + ], + }, + }, + { + label: 'Column Title', + key: 'columnTitle', + type: 'string', + required: true, + description: '', + variables: true, + }, + { + label: 'Column Type', + key: 'columnType', + type: 'dropdown', + required: true, + description: '', + variables: true, + options: [ + { label: 'Button', value: 'button' }, + { label: 'Checkbox', value: 'checkbox' }, + { label: 'Color Picker', value: 'color_picker' }, + { label: 'Connect Boards', value: 'board_relation' }, + { label: 'Country', value: 'country' }, + { label: 'Creation Log', value: 'creation_log' }, + { label: 'Date', value: 'date' }, + { label: 'Dependency', value: 'dependency' }, + { label: 'Dropdown', value: 'dropdown' }, + { label: 'Email', value: 'email' }, + { label: 'Files', value: 'file' }, + { label: 'Formula', value: 'formula' }, + { label: 'Hour', value: 'hour' }, + { label: 'Item ID', value: 'item_id' }, + { label: 'Last Updated', value: 'last_updated' }, + { label: 'Link', value: 'link' }, + { label: 'Location', value: 'location' }, + { label: 'Long Text', value: 'long_text' }, + { label: 'Mirror', value: 'mirror' }, + { label: 'monday Doc', value: 'doc' }, + { label: 'Name', value: 'name' }, + { label: 'Numbers', value: 'numbers' }, + { label: 'People', value: 'people' }, + { label: 'Phone', value: 'phone' }, + { label: 'Rating', value: 'rating' }, + { label: 'Status', value: 'status' }, + { label: 'Tags', value: 'tags' }, + { label: 'Text', value: 'text' }, + { label: 'Timeline', value: 'timeline' }, + { label: 'Time Tracking', value: 'time_tracking' }, + { label: 'Vote', value: 'vote' }, + { label: 'Week', value: 'week' }, + { label: 'World Clock', value: 'world_clock' }, + ], + }, + ], + + async run($) { + const { boardId, columnTitle, columnType } = $.step.parameters; + + const body = { + query: ` + mutation{ + create_column (board_id: ${boardId}, title: "${columnTitle}", column_type: ${columnType}) { + id + title + } + }`, + }; + + const { data } = await $.http.post('/', body); + + $.setActionItem({ + raw: data, + }); + }, +}); diff --git a/packages/backend/src/apps/monday/actions/index.js b/packages/backend/src/apps/monday/actions/index.js index ea519d7d..8f12938e 100644 --- a/packages/backend/src/apps/monday/actions/index.js +++ b/packages/backend/src/apps/monday/actions/index.js @@ -1,4 +1,5 @@ import createBoard from './create-board/index.js'; +import createColumn from './create-column/index.js'; import createItem from './create-item/index.js'; -export default [createBoard, createItem]; +export default [createBoard, createColumn, createItem]; diff --git a/packages/docs/pages/apps/monday/actions.md b/packages/docs/pages/apps/monday/actions.md index 09f09a81..f2034ed2 100644 --- a/packages/docs/pages/apps/monday/actions.md +++ b/packages/docs/pages/apps/monday/actions.md @@ -3,6 +3,8 @@ favicon: /favicons/monday.svg items: - name: Create board desc: Creates a new board. + - name: Create column + desc: Creates a new column in a board. - name: Create item desc: Creates a new item in a board. ---