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 } 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) 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: