From 3caa90174f3a6706f867010ab92118becf06d57d Mon Sep 17 00:00:00 2001 From: iwanghc Date: Fri, 11 Oct 2024 15:55:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?chore=EF=BC=9Aworkflow=20detail=20api=20add?= =?UTF-8?q?=20sql=20version=20id=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqle/api/controller/v2/workflow.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sqle/api/controller/v2/workflow.go b/sqle/api/controller/v2/workflow.go index c5d0bd756..a66c3d1d0 100644 --- a/sqle/api/controller/v2/workflow.go +++ b/sqle/api/controller/v2/workflow.go @@ -1145,7 +1145,7 @@ type WorkflowResV2 struct { ExecMode string `json:"exec_mode" enums:"sql_file,sqls"` CreateUser string `json:"create_user_name"` CreateTime *time.Time `json:"create_time"` - SqlVersionName string `json:"sql_version_name"` + SqlVersion *SqlVersion `json:"sql_version,omitempty"` Record *WorkflowRecordResV2 `json:"record"` RecordHistory []*WorkflowRecordResV2 `json:"record_history_list,omitempty"` AssociatedStageWorkflows []*AssociatedStageWorkflows `json:"associated_stage_workflows,omitempty"` @@ -1159,6 +1159,11 @@ type AssociatedStageWorkflows struct { StageSequence int `json:"stage_sequence"` } +type SqlVersion struct { + SqlVersionName string `json:"sql_version_name"` + SqlVersionId uint `json:"sql_version_id"` +} + // GetWorkflowV2 // @Summary 获取工单详情 // @Description get workflow detail @@ -1230,13 +1235,16 @@ func convertWorkflowToRes(workflow *model.Workflow, sqlVersion *model.SqlVersion WorkflowID: workflow.WorkflowId, Desc: workflow.Desc, Mode: workflow.Mode, - SqlVersionName: sqlVersion.Version, ExecMode: workflow.ExecMode, CreateUser: dms.GetUserNameWithDelTag(workflow.CreateUserId), CreateTime: &workflow.CreatedAt, AssociatedStageWorkflows: convertAssociatedWorkflowToRes(associatedWorkflows), } - + sqlVersionRes := &SqlVersion{ + SqlVersionId: sqlVersion.ID, + SqlVersionName: sqlVersion.Version, + } + workflowRes.SqlVersion = sqlVersionRes // convert workflow record workflowRecordRes := convertWorkflowRecordToRes(workflow, workflow.Record) From 4e10b5dd160431536cf5f5cfb2b1f7a04da6764c Mon Sep 17 00:00:00 2001 From: iwanghc Date: Fri, 11 Oct 2024 16:44:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=EF=BC=9Afix=20ce=20not=20support=20sql?= =?UTF-8?q?=20version=20error=20message=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqle/api/controller/v1/sql_version_ce.go | 31 +++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/sqle/api/controller/v1/sql_version_ce.go b/sqle/api/controller/v1/sql_version_ce.go index 76dc93e78..4b08fc529 100644 --- a/sqle/api/controller/v1/sql_version_ce.go +++ b/sqle/api/controller/v1/sql_version_ce.go @@ -3,48 +3,55 @@ package v1 -import "github.com/labstack/echo/v4" +import ( + e "errors" + + "github.com/actiontech/sqle/sqle/errors" + "github.com/labstack/echo/v4" +) + +var ErrCommunityEditionNotSupportSqlVersion = errors.New(errors.EnterpriseEditionFeatures, e.New("sql version is enterprise version feature")) func createSqlVersion(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func getSqlVersionList(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func getSqlVersionDetail(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func updateSqlVersion(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func lockSqlVersion(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func deleteSqlVersion(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func getDependenciesBetweenStageInstance(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func batchReleaseWorkflows(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func batchExecuteWorkflows(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func batchAssociateWorkflowsWithVersion(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } func getWorkflowsThatCanBeAssociatedToVersion(c echo.Context) error { - return ErrCommunityEditionNotSupportSqlManage + return ErrCommunityEditionNotSupportSqlVersion } From b5ee1237262264d46d14086c420a277d2c9b4b2b Mon Sep 17 00:00:00 2001 From: iwanghc Date: Fri, 11 Oct 2024 17:03:45 +0800 Subject: [PATCH 3/3] gen swagger: workflow detail add sql version id result --- sqle/docs/docs.go | 16 ++++++++++++++-- sqle/docs/swagger.json | 16 ++++++++++++++-- sqle/docs/swagger.yaml | 12 ++++++++++-- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index 6aa2b11c7..2536f18b2 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -18252,6 +18252,17 @@ var doc = `{ } } }, + "v2.SqlVersion": { + "type": "object", + "properties": { + "sql_version_id": { + "type": "integer" + }, + "sql_version_name": { + "type": "string" + } + } + }, "v2.TableMetas": { "type": "object", "properties": { @@ -18403,8 +18414,9 @@ var doc = `{ "$ref": "#/definitions/v2.WorkflowRecordResV2" } }, - "sql_version_name": { - "type": "string" + "sql_version": { + "type": "object", + "$ref": "#/definitions/v2.SqlVersion" }, "workflow_id": { "type": "string" diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index 3420bee14..dfae06f5d 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -18236,6 +18236,17 @@ } } }, + "v2.SqlVersion": { + "type": "object", + "properties": { + "sql_version_id": { + "type": "integer" + }, + "sql_version_name": { + "type": "string" + } + } + }, "v2.TableMetas": { "type": "object", "properties": { @@ -18387,8 +18398,9 @@ "$ref": "#/definitions/v2.WorkflowRecordResV2" } }, - "sql_version_name": { - "type": "string" + "sql_version": { + "type": "object", + "$ref": "#/definitions/v2.SqlVersion" }, "workflow_id": { "type": "string" diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index de0d964ba..68124ee8e 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -5332,6 +5332,13 @@ definitions: - manual_audited type: string type: object + v2.SqlVersion: + properties: + sql_version_id: + type: integer + sql_version_name: + type: string + type: object v2.TableMetas: properties: err_message: @@ -5435,8 +5442,9 @@ definitions: items: $ref: '#/definitions/v2.WorkflowRecordResV2' type: array - sql_version_name: - type: string + sql_version: + $ref: '#/definitions/v2.SqlVersion' + type: object workflow_id: type: string workflow_name: