From 5599a8caa246f59bbdd7841325557c10d801c273 Mon Sep 17 00:00:00 2001 From: Muhsin Shah C P Date: Mon, 7 Jul 2025 18:11:17 +0530 Subject: [PATCH] [workflow-migration] Fixed the Loop node not saving issue. (#13229) * feat: implement workflow query validation guard and add static data source retrieval method * chore: update subproject commits for frontend and server * refactor: remove ValidateWorkflowQuerySourceGuard as part of code cleanup * fix: correct data_source_id property assignment in createWorkflowQuery function * fix: update endpoint for createWorkflowQuery to use correct URL for workflow nodes --- frontend/ee | 2 +- frontend/src/_services/dataquery.service.js | 18 ++++++++++++++++++ server/ee | 2 +- server/src/modules/data-sources/repository.ts | 10 +++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/frontend/ee b/frontend/ee index b8bb0fdd28..2eeda8ae9a 160000 --- a/frontend/ee +++ b/frontend/ee @@ -1 +1 @@ -Subproject commit b8bb0fdd287f4cf52d044a02be8b8d4777abfbe6 +Subproject commit 2eeda8ae9a78ad82cd996ce4307f257268036cb7 diff --git a/frontend/src/_services/dataquery.service.js b/frontend/src/_services/dataquery.service.js index 3919a6b0f3..7a0114d85e 100644 --- a/frontend/src/_services/dataquery.service.js +++ b/frontend/src/_services/dataquery.service.js @@ -11,6 +11,7 @@ export const dataqueryService = { changeQueryDataSource, updateStatus, bulkUpdateQueryOptions, + createWorkflowQuery, }; function getAll(appVersionId) { @@ -36,6 +37,23 @@ function create(app_id, app_version_id, name, kind, options, data_source_id, plu ).then(handleResponse); } +function createWorkflowQuery(app_id, app_version_id, name, kind, options, data_source_id, plugin_id) { + const body = { + app_id, + app_version_id, + name, + kind, + options, + data_source_id, + plugin_id, + }; + + const requestOptions = { method: 'POST', headers: authHeader(), credentials: 'include', body: JSON.stringify(body) }; + return fetch(`${config.apiUrl}/data-queries/workflow-node/versions/${app_version_id}`, requestOptions).then( + handleResponse + ); +} + function update(id, versionId, name, options, dataSourceId) { const body = { options, diff --git a/server/ee b/server/ee index d5eb650e9c..5edf1e4b08 160000 --- a/server/ee +++ b/server/ee @@ -1 +1 @@ -Subproject commit d5eb650e9c5dc62c4a3db1a29f6216315871f195 +Subproject commit 5edf1e4b0851cec1d06a14f9984c681e53ebbe77 diff --git a/server/src/modules/data-sources/repository.ts b/server/src/modules/data-sources/repository.ts index a14f3dbe90..746a5a18b7 100644 --- a/server/src/modules/data-sources/repository.ts +++ b/server/src/modules/data-sources/repository.ts @@ -5,7 +5,7 @@ import { UserPermissions } from '@modules/ability/types'; import { MODULES } from '@modules/app/constants/modules'; import { dbTransactionWrap } from '@helpers/database.helper'; import { DataSourceScopes, DataSourceTypes } from './constants'; -import { GetQueryVariables } from './types'; +import { DefaultDataSourceKind, GetQueryVariables } from './types'; import { decode } from 'js-base64'; @Injectable() @@ -162,6 +162,14 @@ export class DataSourcesRepository extends Repository { }); } + async getStaticDataSourceByKind(organizationId: string, kind: DefaultDataSourceKind, manager?: EntityManager): Promise { + return dbTransactionWrap((manager: EntityManager) => { + return manager.findOneOrFail(DataSource, { + where: { organizationId, type: DataSourceTypes.STATIC, kind }, + }); + }, manager || this.manager); + } + findByQuery(dataQueryId: string, organizationId: string, dataSourceId?: string, manager?: EntityManager) { return dbTransactionWrap((manager: EntityManager) => { return manager.findOne(DataSource, {