From 37249cbeb46efff4f2d81442e36af94226ddeecf Mon Sep 17 00:00:00 2001 From: iwanghc Date: Fri, 27 Sep 2024 18:20:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add=EF=BC=9Aadd=20error=20code=20for=20sql?= =?UTF-8?q?=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqle/errors/errors.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqle/errors/errors.go b/sqle/errors/errors.go index 03e8af6f1..0d10ed674 100644 --- a/sqle/errors/errors.go +++ b/sqle/errors/errors.go @@ -45,6 +45,8 @@ const ( SQLOptimizationCommunityNotSupported = 8004 + SQLVersionNotAllTasksExecutedSuccess = 8005 + // 需要隐藏所有错误细节或不确定时使用 GenericError ErrorCode = 9999 ) From 6e63727a33e49d22cd6a306011a86b9b78d6d645 Mon Sep 17 00:00:00 2001 From: iwanghc Date: Fri, 27 Sep 2024 18:23:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?modify=EF=BC=9Arename=20sql=20version=20api?= =?UTF-8?q?=20definition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqle/api/app.go | 3 ++- sqle/api/controller/v1/sql_version.go | 12 ++++++------ sqle/api/controller/v1/sql_version_ce.go | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sqle/api/app.go b/sqle/api/app.go index 1cdfd5eeb..7d31d83ab 100644 --- a/sqle/api/app.go +++ b/sqle/api/app.go @@ -11,6 +11,7 @@ import ( "github.com/actiontech/dms/pkg/dms-common/i18nPkg" "github.com/actiontech/sqle/sqle/dms" "github.com/actiontech/sqle/sqle/locale" + // "github.com/actiontech/sqle/sqle/api/cloudbeaver_wrapper" "github.com/actiontech/sqle/sqle/api/controller" v1 "github.com/actiontech/sqle/sqle/api/controller/v1" @@ -260,7 +261,7 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti v1ProjectRouter.POST("/:project_name/sql_versions/:sql_version_id/lock", v1.LockSqlVersion) v1ProjectRouter.GET("/:project_name/sql_versions/:sql_version_id/sql_version_stages/:sql_version_stage_id/dependencies", v1.GetDependenciesBetweenStageInstance) v1ProjectRouter.POST("/:project_name/sql_versions/:sql_version_id/batch_release_workflows", v1.BatchReleaseWorkflows) - v1ProjectRouter.POST("/:project_name/sql_versions/:sql_version_id/batch_execute_workflows", v1.BatchExecuteTasksOnWorkflow) + v1ProjectRouter.POST("/:project_name/sql_versions/:sql_version_id/batch_execute_workflows", v1.BatchExecuteWorkflows) v1ProjectRouter.POST("/:project_name/sql_versions/:sql_version_id/retry_workflow ", v1.RetryExecWorkflow) v1ProjectRouter.POST("/:project_name/sql_versions/:sql_version_id/sql_version_stages/:sql_version_stage_id/associate_workflows", v1.BatchAssociateWorkflowsWithVersion) v1ProjectRouter.GET("/:project_name/sql_versions/:sql_version_id/sql_version_stages/:sql_version_stage_id/associate_workflows", v1.GetWorkflowsThatCanBeAssociatedToVersion) diff --git a/sqle/api/controller/v1/sql_version.go b/sqle/api/controller/v1/sql_version.go index 702046c0e..b5daae6c1 100644 --- a/sqle/api/controller/v1/sql_version.go +++ b/sqle/api/controller/v1/sql_version.go @@ -292,26 +292,26 @@ func BatchReleaseWorkflows(c echo.Context) error { return batchReleaseWorkflows(c) } -type BatchExecuteTasksOnWorkflowReqV1 struct { +type BatchExecuteWorkflowsReqV1 struct { WorkflowIDs []string `json:"workflow_ids" valid:"required"` } // @Summary 工单批量上线 -// @Description batch execute tasks on workflow +// @Description batch execute workflows // @Tags sql_version -// @Id batchExecuteTasksOnWorkflowV1 +// @Id batchExecuteWorkflowsV1 // @Security ApiKeyAuth // @Param project_name path string true "project name" // @Param sql_version_id path string true "sql version id" -// @Param data body v1.BatchExecuteTasksOnWorkflowReqV1 true "batch execute tasks on workflow request" +// @Param data body v1.BatchExecuteWorkflowsReqV1 true "batch execute workflows request" // @Success 200 {object} controller.BaseRes // @router /v1/projects/{project_name}/sql_versions/{sql_version_id}/batch_execute_workflows [post] -func BatchExecuteTasksOnWorkflow(c echo.Context) error { +func BatchExecuteWorkflows(c echo.Context) error { /** 1、遍历workflow id,获取workflow信息 2、参考func ExecuteTasksOnWorkflowV2(c echo.Context) error 执行上线 **/ - return batchExecuteTasksOnWorkflow(c) + return batchExecuteWorkflows(c) } type RetryExecWorkflowReqV1 struct { diff --git a/sqle/api/controller/v1/sql_version_ce.go b/sqle/api/controller/v1/sql_version_ce.go index dc36dcf70..75d5d35f8 100644 --- a/sqle/api/controller/v1/sql_version_ce.go +++ b/sqle/api/controller/v1/sql_version_ce.go @@ -37,7 +37,7 @@ func batchReleaseWorkflows(c echo.Context) error { return ErrCommunityEditionNotSupportSqlManage } -func batchExecuteTasksOnWorkflow(c echo.Context) error { +func batchExecuteWorkflows(c echo.Context) error { return ErrCommunityEditionNotSupportSqlManage } func retryExecWorkflow(c echo.Context) error { From 589b53f8f6c0941ceeb1b09ec9e0cd7188f0c491 Mon Sep 17 00:00:00 2001 From: iwanghc Date: Fri, 27 Sep 2024 18:24:07 +0800 Subject: [PATCH 3/3] gen swagger: sql version api rename --- sqle/docs/docs.go | 10 +++++----- sqle/docs/swagger.json | 10 +++++----- sqle/docs/swagger.yaml | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index 6548cafb6..24a3d1003 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -5471,12 +5471,12 @@ var doc = `{ "ApiKeyAuth": [] } ], - "description": "batch execute tasks on workflow", + "description": "batch execute workflows", "tags": [ "sql_version" ], "summary": "工单批量上线", - "operationId": "batchExecuteTasksOnWorkflowV1", + "operationId": "batchExecuteWorkflowsV1", "parameters": [ { "type": "string", @@ -5493,12 +5493,12 @@ var doc = `{ "required": true }, { - "description": "batch execute tasks on workflow request", + "description": "batch execute workflows request", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.BatchExecuteTasksOnWorkflowReqV1" + "$ref": "#/definitions/v1.BatchExecuteWorkflowsReqV1" } } ], @@ -11193,7 +11193,7 @@ var doc = `{ } } }, - "v1.BatchExecuteTasksOnWorkflowReqV1": { + "v1.BatchExecuteWorkflowsReqV1": { "type": "object", "properties": { "workflow_ids": { diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index 0eaf697d3..19c9d7851 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -5455,12 +5455,12 @@ "ApiKeyAuth": [] } ], - "description": "batch execute tasks on workflow", + "description": "batch execute workflows", "tags": [ "sql_version" ], "summary": "工单批量上线", - "operationId": "batchExecuteTasksOnWorkflowV1", + "operationId": "batchExecuteWorkflowsV1", "parameters": [ { "type": "string", @@ -5477,12 +5477,12 @@ "required": true }, { - "description": "batch execute tasks on workflow request", + "description": "batch execute workflows request", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.BatchExecuteTasksOnWorkflowReqV1" + "$ref": "#/definitions/v1.BatchExecuteWorkflowsReqV1" } } ], @@ -11177,7 +11177,7 @@ } } }, - "v1.BatchExecuteTasksOnWorkflowReqV1": { + "v1.BatchExecuteWorkflowsReqV1": { "type": "object", "properties": { "workflow_ids": { diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index 0d130f8a7..411a12292 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -498,7 +498,7 @@ definitions: type: string type: array type: object - v1.BatchExecuteTasksOnWorkflowReqV1: + v1.BatchExecuteWorkflowsReqV1: properties: workflow_ids: items: @@ -9002,8 +9002,8 @@ paths: - sql_version /v1/projects/{project_name}/sql_versions/{sql_version_id}/batch_execute_workflows: post: - description: batch execute tasks on workflow - operationId: batchExecuteTasksOnWorkflowV1 + description: batch execute workflows + operationId: batchExecuteWorkflowsV1 parameters: - description: project name in: path @@ -9015,12 +9015,12 @@ paths: name: sql_version_id required: true type: string - - description: batch execute tasks on workflow request + - description: batch execute workflows request in: body name: data required: true schema: - $ref: '#/definitions/v1.BatchExecuteTasksOnWorkflowReqV1' + $ref: '#/definitions/v1.BatchExecuteWorkflowsReqV1' responses: "200": description: OK