From 2396f58aafce4aa8217f961fe2af43123d924084 Mon Sep 17 00:00:00 2001 From: littleniannian Date: Thu, 5 Dec 2024 14:23:41 +0800 Subject: [PATCH 1/6] feat: coding api definition feat: coding api definition fix: add request body for test coding api fix: add request body for test coding api --- sqle/api/app.go | 4 + sqle/api/controller/v1/configuration.go | 71 ++++++ sqle/api/controller/v1/configuration_ce.go | 12 + sqle/api/controller/v1/sql_manage.go | 30 +++ sqle/api/controller/v1/sql_manager_ce.go | 4 + sqle/docs/docs.go | 256 +++++++++++++++++++++ sqle/docs/swagger.json | 256 +++++++++++++++++++++ sqle/docs/swagger.yaml | 165 +++++++++++++ 8 files changed, 798 insertions(+) diff --git a/sqle/api/app.go b/sqle/api/app.go index 666851e5cd..4f7a259d9d 100644 --- a/sqle/api/app.go +++ b/sqle/api/app.go @@ -146,6 +146,9 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti v1Router.PATCH("/configurations/wechat_audit", v1.UpdateWechatAuditConfigurationV1, sqleMiddleware.OpGlobalAllowed()) v1Router.GET("/configurations/wechat_audit", v1.GetWechatAuditConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) v1Router.POST("/configurations/wechat_audit/test", v1.TestWechatAuditConfigV1, sqleMiddleware.OpGlobalAllowed()) + v1Router.PATCH("/configurations/coding_audit", v1.UpdateCodingAuditConfigurationV1, sqleMiddleware.OpGlobalAllowed()) + v1Router.GET("/configurations/coding_audit", v1.GetCodingAuditConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) + v1Router.POST("/configurations/coding_audit/test", v1.TestCodingAuditConfigV1, sqleMiddleware.OpGlobalAllowed()) // statistic v1Router.GET("/statistic/instances/type_percent", v1.GetInstancesTypePercentV1, sqleMiddleware.ViewGlobalAllowed()) @@ -353,6 +356,7 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti v1ProjectViewRouter.GET("/:project_name/sql_manages/exports", v1.ExportSqlManagesV1) v1ProjectViewRouter.GET("/:project_name/sql_manages/rule_tips", v1.GetSqlManageRuleTips) v1ProjectViewRouter.GET("/:project_name/sql_manages/:sql_manage_id/sql_analysis", v1.GetSqlManageSqlAnalysisV1) + v1ProjectViewRouter.POST("/:project_name/sql_manages/coding", v1.PostSqlManageToCoding) // sql dev records v1ProjectViewRouter.GET("/:project_name/sql_dev_records", v1.GetSqlDEVRecordList) diff --git a/sqle/api/controller/v1/configuration.go b/sqle/api/controller/v1/configuration.go index 71aad0bfc7..68ac3e56d0 100644 --- a/sqle/api/controller/v1/configuration.go +++ b/sqle/api/controller/v1/configuration.go @@ -285,6 +285,17 @@ type WechatConfigurationV1 struct { IsWechatNotificationEnabled bool `json:"is_wechat_notification_enabled"` } +type GetCodingAuditConfigurationResV1 struct { + controller.BaseRes + Data CodingConfigurationV1 `json:"data"` +} + +type CodingConfigurationV1 struct { + CodingUrl string `json:"coding_url"` + + IsCodingNotificationEnabled bool `json:"is_coding_notification_enabled"` +} + // GetWechatAuditConfigurationV1 // @Summary 获取微信审核配置 // @Description get wechat audit configuration @@ -297,6 +308,18 @@ func GetWechatAuditConfigurationV1(c echo.Context) error { return getWechatAuditConfigurationV1(c) } +// GetCodingAuditConfigurationV1 +// @Summary 获取Coding审核配置 +// @Description get coding audit configuration +// @Id getCodingAuditConfigurationV1 +// @Tags configuration +// @Security ApiKeyAuth +// @Success 200 {object} v1.GetCodingAuditConfigurationResV1 +// @router /v1/configurations/coding_audit [get] +func GetCodingAuditConfigurationV1(c echo.Context) error { + return getCodingAuditConfigurationV1(c) +} + type UpdateWechatConfigurationReqV1 struct { CorpID *string `json:"corp_id" from:"corp_id" description:"微信企业号ID"` CorpSecret *string `json:"corp_secret" from:"corp_secret" description:"企业微信ID对应密码"` @@ -317,6 +340,26 @@ func UpdateWechatAuditConfigurationV1(c echo.Context) error { return updateWechatAuditConfigurationV1(c) } +type UpdateCodingAuditConfigurationReqV1 struct { + CodingUrl *string `json:"coding_url" from:"coding_url" description:"Coding平台的地址"` + Token *string `json:"token" from:"token" description:"访问令牌"` + IsCodingNotificationEnabled *bool `json:"is_coding_notification_enabled" from:"is_coding_notification_enabled" description:"是否启用Coding对接流程"` +} + +// UpdateCodingAuditConfigurationV1 +// @Summary 添加或更新Coding配置 +// @Description update coding audit configuration +// @Accept json +// @Id UpdateCodingAuditConfigurationV1 +// @Tags configuration +// @Security ApiKeyAuth +// @Param param body v1.UpdateCodingAuditConfigurationReqV1 true "update coding audit configuration req" +// @Success 200 {object} controller.BaseRes +// @router /v1/configurations/coding_audit [patch] +func UpdateCodingAuditConfigurationV1(c echo.Context) error { + return updateCodingAuditConfigurationV1(c) +} + type TestWechatConfigResDataV1 struct { IsMessageSentNormally bool `json:"is_message_sent_normally"` ErrorMessage string `json:"error_message,omitempty"` @@ -327,6 +370,16 @@ type TestWechatConfigResV1 struct { Data TestWechatConfigResDataV1 `json:"data"` } +type TestCodingConfigResV1 struct { + controller.BaseRes + Data TestCodingConfigResDataV1 `json:"data"` +} + +type TestCodingConfigResDataV1 struct { + IsMessageSentNormally bool `json:"is_message_sent_normally"` + ErrorMessage string `json:"error_message,omitempty"` +} + type TestWechatConfigurationReqV1 struct { WechatId string `json:"wechat_id" form:"wechat_id" valid:"required" description:"用户个人企业微信ID"` } @@ -345,6 +398,24 @@ func TestWechatAuditConfigV1(c echo.Context) error { return testWechatAuditConfigV1(c) } +type TestCodingConfigurationReqV1 struct { + ProjectName string `json:"project_name" form:"project_name" valid:"required" description:"项目名称"` +} + +// TestCodingAuditConfigV1 +// @Summary 测试Coding审批配置 +// @Description test coding audit configuration +// @Accept json +// @Id testCodingAuditConfigV1 +// @Tags configuration +// @Param req body v1.TestCodingConfigurationReqV1 true "test coding configuration req" +// @Security ApiKeyAuth +// @Success 200 {object} v1.TestCodingConfigResV1 +// @router /v1/configurations/coding_audit/test [post] +func TestCodingAuditConfigV1(c echo.Context) error { + return testCodingAuditConfigV1(c) +} + type ScheduleTaskDefaultOption struct { DefaultSelector string `json:"default_selector" enums:"wechat,feishu"` } diff --git a/sqle/api/controller/v1/configuration_ce.go b/sqle/api/controller/v1/configuration_ce.go index 93adc5d14d..594ce81ed1 100644 --- a/sqle/api/controller/v1/configuration_ce.go +++ b/sqle/api/controller/v1/configuration_ce.go @@ -55,6 +55,18 @@ func testWechatAuditConfigV1(c echo.Context) error { return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportWechatAudit) } +func getCodingAuditConfigurationV1(c echo.Context) error { + return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportWechatAudit) +} + +func updateCodingAuditConfigurationV1(c echo.Context) error { + return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportWechatAudit) +} + +func testCodingAuditConfigV1(c echo.Context) error { + return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportWechatAudit) +} + func getScheduledTaskDefaultOptionV1(c echo.Context) error { return controller.JSONBaseErrorReq(c, errCommunityEditionDoesNotSupportScheduledNotify) } diff --git a/sqle/api/controller/v1/sql_manage.go b/sqle/api/controller/v1/sql_manage.go index 4013af8229..c5062f9269 100644 --- a/sqle/api/controller/v1/sql_manage.go +++ b/sqle/api/controller/v1/sql_manage.go @@ -107,6 +107,12 @@ type BatchUpdateSqlManageReq struct { Remark *string `json:"remark"` } +type SqlManageCodingReq struct { + Priority *string `json:"priority"` + ProjectName *string `json:"project_name"` + Type *string `json:"type"` +} + // BatchUpdateSqlManage batch update sql manage // @Summary 批量更新SQL管控 // @Description batch update sql manage @@ -223,6 +229,16 @@ type GetSqlManageSqlAnalysisResp struct { Data *SqlAnalysis `json:"data"` } +type PostSqlManageCodingResp struct { + controller.BaseRes + Data *CodingResp `json:"data"` +} + +type CodingResp struct { + Message string `json:"message"` + Code string `json:"code"` +} + // GetSqlManageSqlAnalysisV1 // @Summary 获取SQL管控SQL分析 // @Description get sql manage analysis @@ -237,6 +253,20 @@ func GetSqlManageSqlAnalysisV1(c echo.Context) error { return getSqlManageSqlAnalysisV1(c) } +// PostSqlManageToCoding +// @Summary 推送SQL管控结果到Coding +// @Description get sql manage analysis +// @Id PostSqlManageToCoding +// @Tags SqlManage +// @Param project_name path string true "project name" +// @Param SqlManageCodingReq body SqlManageCodingReq true "batch update sql manage request" +// @Security ApiKeyAuth +// @Success 200 {object} PostSqlManageCodingResp +// @Router /v1/projects/{project_name}/sql_manages/coding [post] +func PostSqlManageToCoding(c echo.Context) error { + return postSqlManageToCoding(c) +} + func convertSQLAnalysisResultToRes(ctx context.Context, res *AnalysisResult, rawSQL string) *SqlAnalysis { data := &SqlAnalysis{} diff --git a/sqle/api/controller/v1/sql_manager_ce.go b/sqle/api/controller/v1/sql_manager_ce.go index 49226e35cb..9b030eaa46 100644 --- a/sqle/api/controller/v1/sql_manager_ce.go +++ b/sqle/api/controller/v1/sql_manager_ce.go @@ -20,6 +20,10 @@ func batchUpdateSqlManage(c echo.Context) error { return ErrCommunityEditionNotSupportSqlManage } +func postSqlManageToCoding(c echo.Context) error { + return ErrCommunityEditionNotSupportSqlManage +} + func exportSqlManagesV1(c echo.Context) error { return ErrCommunityEditionNotSupportSqlManage } diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index 94aefdba21..cd615bf4d3 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -180,6 +180,101 @@ var doc = `{ } } }, + "/v1/configurations/coding_audit": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get coding audit configuration", + "tags": [ + "configuration" + ], + "summary": "获取Coding审核配置", + "operationId": "getCodingAuditConfigurationV1", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.GetCodingAuditConfigurationResV1" + } + } + } + }, + "patch": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "update coding audit configuration", + "consumes": [ + "application/json" + ], + "tags": [ + "configuration" + ], + "summary": "添加或更新Coding配置", + "operationId": "UpdateCodingAuditConfigurationV1", + "parameters": [ + { + "description": "update coding audit configuration req", + "name": "param", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.UpdateCodingAuditConfigurationReqV1" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/controller.BaseRes" + } + } + } + } + }, + "/v1/configurations/coding_audit/test": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "test coding audit configuration", + "consumes": [ + "application/json" + ], + "tags": [ + "configuration" + ], + "summary": "测试Coding审批配置", + "operationId": "testCodingAuditConfigV1", + "parameters": [ + { + "description": "test coding configuration req", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.TestCodingConfigurationReqV1" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.TestCodingConfigResV1" + } + } + } + } + }, "/v1/configurations/ding_talk": { "get": { "security": [ @@ -5068,6 +5163,47 @@ var doc = `{ } } }, + "/v1/projects/{project_name}/sql_manages/coding": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get sql manage analysis", + "tags": [ + "SqlManage" + ], + "summary": "推送SQL管控结果到Coding", + "operationId": "PostSqlManageToCoding", + "parameters": [ + { + "type": "string", + "description": "project name", + "name": "project_name", + "in": "path", + "required": true + }, + { + "description": "batch update sql manage request", + "name": "SqlManageCodingReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.SqlManageCodingReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.PostSqlManageCodingResp" + } + } + } + } + }, "/v1/projects/{project_name}/sql_manages/exports": { "get": { "security": [ @@ -12047,6 +12183,28 @@ var doc = `{ } } }, + "v1.CodingConfigurationV1": { + "type": "object", + "properties": { + "coding_url": { + "type": "string" + }, + "is_coding_notification_enabled": { + "type": "boolean" + } + } + }, + "v1.CodingResp": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, "v1.CompanyNotice": { "type": "object", "properties": { @@ -13483,6 +13641,23 @@ var doc = `{ } } }, + "v1.GetCodingAuditConfigurationResV1": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "example": 0 + }, + "data": { + "type": "object", + "$ref": "#/definitions/v1.CodingConfigurationV1" + }, + "message": { + "type": "string", + "example": "ok" + } + } + }, "v1.GetCompanyNoticeResp": { "type": "object", "properties": { @@ -16015,6 +16190,23 @@ var doc = `{ } } }, + "v1.PostSqlManageCodingResp": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "example": 0 + }, + "data": { + "type": "object", + "$ref": "#/definitions/v1.CodingResp" + }, + "message": { + "type": "string", + "example": "ok" + } + } + }, "v1.ProjectRuleTemplateResV1": { "type": "object", "properties": { @@ -16826,6 +17018,20 @@ var doc = `{ } } }, + "v1.SqlManageCodingReq": { + "type": "object", + "properties": { + "priority": { + "type": "string" + }, + "project_name": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, "v1.SqlVersionDetailResV1": { "type": "object", "properties": { @@ -17127,6 +17333,42 @@ var doc = `{ } } }, + "v1.TestCodingConfigResDataV1": { + "type": "object", + "properties": { + "error_message": { + "type": "string" + }, + "is_message_sent_normally": { + "type": "boolean" + } + } + }, + "v1.TestCodingConfigResV1": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "example": 0 + }, + "data": { + "type": "object", + "$ref": "#/definitions/v1.TestCodingConfigResDataV1" + }, + "message": { + "type": "string", + "example": "ok" + } + } + }, + "v1.TestCodingConfigurationReqV1": { + "type": "object", + "properties": { + "project_name": { + "type": "string" + } + } + }, "v1.TestDingTalkConfigResDataV1": { "type": "object", "properties": { @@ -17387,6 +17629,20 @@ var doc = `{ } } }, + "v1.UpdateCodingAuditConfigurationReqV1": { + "type": "object", + "properties": { + "coding_url": { + "type": "string" + }, + "is_coding_notification_enabled": { + "type": "boolean" + }, + "token": { + "type": "string" + } + } + }, "v1.UpdateCompanyNoticeReq": { "type": "object", "properties": { diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index abcdd02ae1..bf5731c260 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -164,6 +164,101 @@ } } }, + "/v1/configurations/coding_audit": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get coding audit configuration", + "tags": [ + "configuration" + ], + "summary": "获取Coding审核配置", + "operationId": "getCodingAuditConfigurationV1", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.GetCodingAuditConfigurationResV1" + } + } + } + }, + "patch": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "update coding audit configuration", + "consumes": [ + "application/json" + ], + "tags": [ + "configuration" + ], + "summary": "添加或更新Coding配置", + "operationId": "UpdateCodingAuditConfigurationV1", + "parameters": [ + { + "description": "update coding audit configuration req", + "name": "param", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.UpdateCodingAuditConfigurationReqV1" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/controller.BaseRes" + } + } + } + } + }, + "/v1/configurations/coding_audit/test": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "test coding audit configuration", + "consumes": [ + "application/json" + ], + "tags": [ + "configuration" + ], + "summary": "测试Coding审批配置", + "operationId": "testCodingAuditConfigV1", + "parameters": [ + { + "description": "test coding configuration req", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.TestCodingConfigurationReqV1" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.TestCodingConfigResV1" + } + } + } + } + }, "/v1/configurations/ding_talk": { "get": { "security": [ @@ -5052,6 +5147,47 @@ } } }, + "/v1/projects/{project_name}/sql_manages/coding": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get sql manage analysis", + "tags": [ + "SqlManage" + ], + "summary": "推送SQL管控结果到Coding", + "operationId": "PostSqlManageToCoding", + "parameters": [ + { + "type": "string", + "description": "project name", + "name": "project_name", + "in": "path", + "required": true + }, + { + "description": "batch update sql manage request", + "name": "SqlManageCodingReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.SqlManageCodingReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.PostSqlManageCodingResp" + } + } + } + } + }, "/v1/projects/{project_name}/sql_manages/exports": { "get": { "security": [ @@ -12031,6 +12167,28 @@ } } }, + "v1.CodingConfigurationV1": { + "type": "object", + "properties": { + "coding_url": { + "type": "string" + }, + "is_coding_notification_enabled": { + "type": "boolean" + } + } + }, + "v1.CodingResp": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, "v1.CompanyNotice": { "type": "object", "properties": { @@ -13467,6 +13625,23 @@ } } }, + "v1.GetCodingAuditConfigurationResV1": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "example": 0 + }, + "data": { + "type": "object", + "$ref": "#/definitions/v1.CodingConfigurationV1" + }, + "message": { + "type": "string", + "example": "ok" + } + } + }, "v1.GetCompanyNoticeResp": { "type": "object", "properties": { @@ -15999,6 +16174,23 @@ } } }, + "v1.PostSqlManageCodingResp": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "example": 0 + }, + "data": { + "type": "object", + "$ref": "#/definitions/v1.CodingResp" + }, + "message": { + "type": "string", + "example": "ok" + } + } + }, "v1.ProjectRuleTemplateResV1": { "type": "object", "properties": { @@ -16810,6 +17002,20 @@ } } }, + "v1.SqlManageCodingReq": { + "type": "object", + "properties": { + "priority": { + "type": "string" + }, + "project_name": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, "v1.SqlVersionDetailResV1": { "type": "object", "properties": { @@ -17111,6 +17317,42 @@ } } }, + "v1.TestCodingConfigResDataV1": { + "type": "object", + "properties": { + "error_message": { + "type": "string" + }, + "is_message_sent_normally": { + "type": "boolean" + } + } + }, + "v1.TestCodingConfigResV1": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "example": 0 + }, + "data": { + "type": "object", + "$ref": "#/definitions/v1.TestCodingConfigResDataV1" + }, + "message": { + "type": "string", + "example": "ok" + } + } + }, + "v1.TestCodingConfigurationReqV1": { + "type": "object", + "properties": { + "project_name": { + "type": "string" + } + } + }, "v1.TestDingTalkConfigResDataV1": { "type": "object", "properties": { @@ -17371,6 +17613,20 @@ } } }, + "v1.UpdateCodingAuditConfigurationReqV1": { + "type": "object", + "properties": { + "coding_url": { + "type": "string" + }, + "is_coding_notification_enabled": { + "type": "boolean" + }, + "token": { + "type": "string" + } + } + }, "v1.UpdateCompanyNoticeReq": { "type": "object", "properties": { diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index 99311fd12c..4a899cc7df 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -664,6 +664,20 @@ definitions: new_rule_template_name: type: string type: object + v1.CodingConfigurationV1: + properties: + coding_url: + type: string + is_coding_notification_enabled: + type: boolean + type: object + v1.CodingResp: + properties: + code: + type: string + message: + type: string + type: object v1.CompanyNotice: properties: notice_str: @@ -1649,6 +1663,18 @@ definitions: total_nums: type: integer type: object + v1.GetCodingAuditConfigurationResV1: + properties: + code: + example: 0 + type: integer + data: + $ref: '#/definitions/v1.CodingConfigurationV1' + type: object + message: + example: ok + type: string + type: object v1.GetCompanyNoticeResp: properties: code: @@ -3388,6 +3414,18 @@ definitions: $ref: '#/definitions/v1.AffectRows' type: object type: object + v1.PostSqlManageCodingResp: + properties: + code: + example: 0 + type: integer + data: + $ref: '#/definitions/v1.CodingResp' + type: object + message: + example: ok + type: string + type: object v1.ProjectRuleTemplateResV1: properties: db_type: @@ -3930,6 +3968,15 @@ definitions: - manual_audited type: string type: object + v1.SqlManageCodingReq: + properties: + priority: + type: string + project_name: + type: string + type: + type: string + type: object v1.SqlVersionDetailResV1: properties: desc: @@ -4130,6 +4177,30 @@ definitions: example: ok type: string type: object + v1.TestCodingConfigResDataV1: + properties: + error_message: + type: string + is_message_sent_normally: + type: boolean + type: object + v1.TestCodingConfigResV1: + properties: + code: + example: 0 + type: integer + data: + $ref: '#/definitions/v1.TestCodingConfigResDataV1' + type: object + message: + example: ok + type: string + type: object + v1.TestCodingConfigurationReqV1: + properties: + project_name: + type: string + type: object v1.TestDingTalkConfigResDataV1: properties: is_ding_talk_send_normal: @@ -4310,6 +4381,15 @@ definitions: example: sql type: string type: object + v1.UpdateCodingAuditConfigurationReqV1: + properties: + coding_url: + type: string + is_coding_notification_enabled: + type: boolean + token: + type: string + type: object v1.UpdateCompanyNoticeReq: properties: notice_str: @@ -6072,6 +6152,65 @@ paths: summary: 更新企业公告 tags: - companyNotice + /v1/configurations/coding_audit: + get: + description: get coding audit configuration + operationId: getCodingAuditConfigurationV1 + responses: + "200": + description: OK + schema: + $ref: '#/definitions/v1.GetCodingAuditConfigurationResV1' + security: + - ApiKeyAuth: [] + summary: 获取Coding审核配置 + tags: + - configuration + patch: + consumes: + - application/json + description: update coding audit configuration + operationId: UpdateCodingAuditConfigurationV1 + parameters: + - description: update coding audit configuration req + in: body + name: param + required: true + schema: + $ref: '#/definitions/v1.UpdateCodingAuditConfigurationReqV1' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/controller.BaseRes' + security: + - ApiKeyAuth: [] + summary: 添加或更新Coding配置 + tags: + - configuration + /v1/configurations/coding_audit/test: + post: + consumes: + - application/json + description: test coding audit configuration + operationId: testCodingAuditConfigV1 + parameters: + - description: test coding configuration req + in: body + name: req + required: true + schema: + $ref: '#/definitions/v1.TestCodingConfigurationReqV1' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/v1.TestCodingConfigResV1' + security: + - ApiKeyAuth: [] + summary: 测试Coding审批配置 + tags: + - configuration /v1/configurations/ding_talk: get: description: get dingTalk configuration @@ -9274,6 +9413,32 @@ paths: summary: 批量更新SQL管控 tags: - SqlManage + /v1/projects/{project_name}/sql_manages/coding: + post: + description: get sql manage analysis + operationId: PostSqlManageToCoding + parameters: + - description: project name + in: path + name: project_name + required: true + type: string + - description: batch update sql manage request + in: body + name: SqlManageCodingReq + required: true + schema: + $ref: '#/definitions/v1.SqlManageCodingReq' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/v1.PostSqlManageCodingResp' + security: + - ApiKeyAuth: [] + summary: 推送SQL管控结果到Coding + tags: + - SqlManage /v1/projects/{project_name}/sql_manages/exports: get: description: export sql manage From 4127779ed9b34a1035d1eb7940a538891135d24c Mon Sep 17 00:00:00 2001 From: littleniannian Date: Tue, 10 Dec 2024 11:19:20 +0800 Subject: [PATCH 2/6] fix: add coding api enums and params --- sqle/api/controller/v1/configuration.go | 6 +++--- sqle/api/controller/v1/sql_manage.go | 26 ++++++++++++++++++++++--- sqle/docs/docs.go | 25 +++++++++++++++++++++--- sqle/docs/swagger.json | 25 +++++++++++++++++++++--- sqle/docs/swagger.yaml | 17 +++++++++++++++- 5 files changed, 86 insertions(+), 13 deletions(-) diff --git a/sqle/api/controller/v1/configuration.go b/sqle/api/controller/v1/configuration.go index 68ac3e56d0..0313f2543a 100644 --- a/sqle/api/controller/v1/configuration.go +++ b/sqle/api/controller/v1/configuration.go @@ -341,9 +341,9 @@ func UpdateWechatAuditConfigurationV1(c echo.Context) error { } type UpdateCodingAuditConfigurationReqV1 struct { - CodingUrl *string `json:"coding_url" from:"coding_url" description:"Coding平台的地址"` - Token *string `json:"token" from:"token" description:"访问令牌"` - IsCodingNotificationEnabled *bool `json:"is_coding_notification_enabled" from:"is_coding_notification_enabled" description:"是否启用Coding对接流程"` + CodingUrl *string `json:"coding_url" from:"coding_url" description:"Coding平台的地址"` + Token *string `json:"token" from:"token" description:"访问令牌"` + IsCodingEnabled *bool `json:"is_coding_enabled" from:"is_coding_enabled" description:"是否启用Coding对接流程"` } // UpdateCodingAuditConfigurationV1 diff --git a/sqle/api/controller/v1/sql_manage.go b/sqle/api/controller/v1/sql_manage.go index c5062f9269..e453599376 100644 --- a/sqle/api/controller/v1/sql_manage.go +++ b/sqle/api/controller/v1/sql_manage.go @@ -108,11 +108,31 @@ type BatchUpdateSqlManageReq struct { } type SqlManageCodingReq struct { - Priority *string `json:"priority"` - ProjectName *string `json:"project_name"` - Type *string `json:"type"` + SqlManageIdList []*uint64 `json:"sql_manage_id_list"` + Priority *CodingPriority `json:"priority" enums:"LOW,MEDIUM,HIGH,EMERGENCY"` + CodingProjectName *string `json:"project_name"` + Type *CodingType `json:"type" enums:"DEFECT,MISSION,REQUIREMENT,EPIC,SUB_TASK"` } +type CodingType string + +const ( + CodingTypeDefect CodingType = "DEFECT" + CodingTypeMission CodingType = "MISSION" + CodingTypeRequirement CodingType = "REQUIREMENT" + CodingTypeEpic CodingType = "EPIC" + CodingTypeSubTask CodingType = "SUB_TASK" +) + +type CodingPriority string + +const ( + CodingPriorityLow CodingPriority = "LOW" + CodingPriorityMedium CodingPriority = "MEDIUM" + CodingPriorityHigh CodingPriority = "HIGH" + CodingPriorityEmergency CodingPriority = "EMERGENCY" +) + // BatchUpdateSqlManage batch update sql manage // @Summary 批量更新SQL管控 // @Description batch update sql manage diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index cd615bf4d3..4a9fe7e719 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -17022,13 +17022,32 @@ var doc = `{ "type": "object", "properties": { "priority": { - "type": "string" + "type": "string", + "enum": [ + "LOW", + "MEDIUM", + "HIGH", + "EMERGENCY" + ] }, "project_name": { "type": "string" }, + "sql_manage_id_list": { + "type": "array", + "items": { + "type": "integer" + } + }, "type": { - "type": "string" + "type": "string", + "enum": [ + "DEFECT", + "MISSION", + "REQUIREMENT", + "EPIC", + "SUB_TASK" + ] } } }, @@ -17635,7 +17654,7 @@ var doc = `{ "coding_url": { "type": "string" }, - "is_coding_notification_enabled": { + "is_coding_enabled": { "type": "boolean" }, "token": { diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index bf5731c260..91fb6e3a0c 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -17006,13 +17006,32 @@ "type": "object", "properties": { "priority": { - "type": "string" + "type": "string", + "enum": [ + "LOW", + "MEDIUM", + "HIGH", + "EMERGENCY" + ] }, "project_name": { "type": "string" }, + "sql_manage_id_list": { + "type": "array", + "items": { + "type": "integer" + } + }, "type": { - "type": "string" + "type": "string", + "enum": [ + "DEFECT", + "MISSION", + "REQUIREMENT", + "EPIC", + "SUB_TASK" + ] } } }, @@ -17619,7 +17638,7 @@ "coding_url": { "type": "string" }, - "is_coding_notification_enabled": { + "is_coding_enabled": { "type": "boolean" }, "token": { diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index 4a899cc7df..e120da7018 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -3971,10 +3971,25 @@ definitions: v1.SqlManageCodingReq: properties: priority: + enum: + - LOW + - MEDIUM + - HIGH + - EMERGENCY type: string project_name: type: string + sql_manage_id_list: + items: + type: integer + type: array type: + enum: + - DEFECT + - MISSION + - REQUIREMENT + - EPIC + - SUB_TASK type: string type: object v1.SqlVersionDetailResV1: @@ -4385,7 +4400,7 @@ definitions: properties: coding_url: type: string - is_coding_notification_enabled: + is_coding_enabled: type: boolean token: type: string From ce39003a19fe50605b24ea6e81e8f10509f1f26a Mon Sep 17 00:00:00 2001 From: littleniannian Date: Tue, 10 Dec 2024 11:21:05 +0800 Subject: [PATCH 3/6] fix: rename to coding project name --- sqle/api/controller/v1/sql_manage.go | 2 +- sqle/docs/docs.go | 6 +++--- sqle/docs/swagger.json | 6 +++--- sqle/docs/swagger.yaml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sqle/api/controller/v1/sql_manage.go b/sqle/api/controller/v1/sql_manage.go index e453599376..3410e5b740 100644 --- a/sqle/api/controller/v1/sql_manage.go +++ b/sqle/api/controller/v1/sql_manage.go @@ -110,7 +110,7 @@ type BatchUpdateSqlManageReq struct { type SqlManageCodingReq struct { SqlManageIdList []*uint64 `json:"sql_manage_id_list"` Priority *CodingPriority `json:"priority" enums:"LOW,MEDIUM,HIGH,EMERGENCY"` - CodingProjectName *string `json:"project_name"` + CodingProjectName *string `json:"coding_project_name"` Type *CodingType `json:"type" enums:"DEFECT,MISSION,REQUIREMENT,EPIC,SUB_TASK"` } diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index 4a9fe7e719..fe8950f19d 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -17021,6 +17021,9 @@ var doc = `{ "v1.SqlManageCodingReq": { "type": "object", "properties": { + "coding_project_name": { + "type": "string" + }, "priority": { "type": "string", "enum": [ @@ -17030,9 +17033,6 @@ var doc = `{ "EMERGENCY" ] }, - "project_name": { - "type": "string" - }, "sql_manage_id_list": { "type": "array", "items": { diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index 91fb6e3a0c..8d295b5023 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -17005,6 +17005,9 @@ "v1.SqlManageCodingReq": { "type": "object", "properties": { + "coding_project_name": { + "type": "string" + }, "priority": { "type": "string", "enum": [ @@ -17014,9 +17017,6 @@ "EMERGENCY" ] }, - "project_name": { - "type": "string" - }, "sql_manage_id_list": { "type": "array", "items": { diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index e120da7018..5f9ac32ddb 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -3970,6 +3970,8 @@ definitions: type: object v1.SqlManageCodingReq: properties: + coding_project_name: + type: string priority: enum: - LOW @@ -3977,8 +3979,6 @@ definitions: - HIGH - EMERGENCY type: string - project_name: - type: string sql_manage_id_list: items: type: integer From 216bdea4d6f23aeed90bc86845e532885ebf3991 Mon Sep 17 00:00:00 2001 From: littleniannian Date: Tue, 10 Dec 2024 11:53:40 +0800 Subject: [PATCH 4/6] fix: rename codingAudit to coding --- sqle/api/app.go | 6 ++-- sqle/api/controller/v1/configuration.go | 40 +++++++++++----------- sqle/api/controller/v1/configuration_ce.go | 4 +-- sqle/docs/docs.go | 24 ++++++------- sqle/docs/swagger.json | 24 ++++++------- sqle/docs/swagger.yaml | 24 ++++++------- 6 files changed, 61 insertions(+), 61 deletions(-) diff --git a/sqle/api/app.go b/sqle/api/app.go index 4f7a259d9d..d5c91fe760 100644 --- a/sqle/api/app.go +++ b/sqle/api/app.go @@ -146,9 +146,9 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti v1Router.PATCH("/configurations/wechat_audit", v1.UpdateWechatAuditConfigurationV1, sqleMiddleware.OpGlobalAllowed()) v1Router.GET("/configurations/wechat_audit", v1.GetWechatAuditConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) v1Router.POST("/configurations/wechat_audit/test", v1.TestWechatAuditConfigV1, sqleMiddleware.OpGlobalAllowed()) - v1Router.PATCH("/configurations/coding_audit", v1.UpdateCodingAuditConfigurationV1, sqleMiddleware.OpGlobalAllowed()) - v1Router.GET("/configurations/coding_audit", v1.GetCodingAuditConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) - v1Router.POST("/configurations/coding_audit/test", v1.TestCodingAuditConfigV1, sqleMiddleware.OpGlobalAllowed()) + v1Router.PATCH("/configurations/coding_audit", v1.UpdateCodingConfigurationV1, sqleMiddleware.OpGlobalAllowed()) + v1Router.GET("/configurations/coding_audit", v1.GetCodingConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) + v1Router.POST("/configurations/coding_audit/test", v1.TestCodingConfigV1, sqleMiddleware.OpGlobalAllowed()) // statistic v1Router.GET("/statistic/instances/type_percent", v1.GetInstancesTypePercentV1, sqleMiddleware.ViewGlobalAllowed()) diff --git a/sqle/api/controller/v1/configuration.go b/sqle/api/controller/v1/configuration.go index 0313f2543a..d6011e3abd 100644 --- a/sqle/api/controller/v1/configuration.go +++ b/sqle/api/controller/v1/configuration.go @@ -285,7 +285,7 @@ type WechatConfigurationV1 struct { IsWechatNotificationEnabled bool `json:"is_wechat_notification_enabled"` } -type GetCodingAuditConfigurationResV1 struct { +type GetCodingConfigurationResV1 struct { controller.BaseRes Data CodingConfigurationV1 `json:"data"` } @@ -308,16 +308,16 @@ func GetWechatAuditConfigurationV1(c echo.Context) error { return getWechatAuditConfigurationV1(c) } -// GetCodingAuditConfigurationV1 +// GetCodingConfigurationV1 // @Summary 获取Coding审核配置 -// @Description get coding audit configuration -// @Id getCodingAuditConfigurationV1 +// @Description get coding configuration +// @Id getCodingConfigurationV1 // @Tags configuration // @Security ApiKeyAuth -// @Success 200 {object} v1.GetCodingAuditConfigurationResV1 -// @router /v1/configurations/coding_audit [get] -func GetCodingAuditConfigurationV1(c echo.Context) error { - return getCodingAuditConfigurationV1(c) +// @Success 200 {object} v1.GetCodingConfigurationResV1 +// @router /v1/configurations/coding [get] +func GetCodingConfigurationV1(c echo.Context) error { + return getCodingConfigurationV1(c) } type UpdateWechatConfigurationReqV1 struct { @@ -340,24 +340,24 @@ func UpdateWechatAuditConfigurationV1(c echo.Context) error { return updateWechatAuditConfigurationV1(c) } -type UpdateCodingAuditConfigurationReqV1 struct { +type UpdateCodingConfigurationReqV1 struct { CodingUrl *string `json:"coding_url" from:"coding_url" description:"Coding平台的地址"` Token *string `json:"token" from:"token" description:"访问令牌"` IsCodingEnabled *bool `json:"is_coding_enabled" from:"is_coding_enabled" description:"是否启用Coding对接流程"` } -// UpdateCodingAuditConfigurationV1 +// UpdateCodingConfigurationV1 // @Summary 添加或更新Coding配置 -// @Description update coding audit configuration +// @Description update coding configuration // @Accept json -// @Id UpdateCodingAuditConfigurationV1 +// @Id UpdateCodingConfigurationV1 // @Tags configuration // @Security ApiKeyAuth -// @Param param body v1.UpdateCodingAuditConfigurationReqV1 true "update coding audit configuration req" +// @Param param body v1.UpdateCodingConfigurationReqV1 true "update coding configuration req" // @Success 200 {object} controller.BaseRes -// @router /v1/configurations/coding_audit [patch] -func UpdateCodingAuditConfigurationV1(c echo.Context) error { - return updateCodingAuditConfigurationV1(c) +// @router /v1/configurations/coding [patch] +func UpdateCodingConfigurationV1(c echo.Context) error { + return updateCodingConfigurationV1(c) } type TestWechatConfigResDataV1 struct { @@ -402,17 +402,17 @@ type TestCodingConfigurationReqV1 struct { ProjectName string `json:"project_name" form:"project_name" valid:"required" description:"项目名称"` } -// TestCodingAuditConfigV1 +// TestCodingConfigV1 // @Summary 测试Coding审批配置 -// @Description test coding audit configuration +// @Description test coding configuration // @Accept json -// @Id testCodingAuditConfigV1 +// @Id testCodingConfigV1 // @Tags configuration // @Param req body v1.TestCodingConfigurationReqV1 true "test coding configuration req" // @Security ApiKeyAuth // @Success 200 {object} v1.TestCodingConfigResV1 // @router /v1/configurations/coding_audit/test [post] -func TestCodingAuditConfigV1(c echo.Context) error { +func TestCodingConfigV1(c echo.Context) error { return testCodingAuditConfigV1(c) } diff --git a/sqle/api/controller/v1/configuration_ce.go b/sqle/api/controller/v1/configuration_ce.go index 594ce81ed1..73c52015d2 100644 --- a/sqle/api/controller/v1/configuration_ce.go +++ b/sqle/api/controller/v1/configuration_ce.go @@ -55,11 +55,11 @@ func testWechatAuditConfigV1(c echo.Context) error { return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportWechatAudit) } -func getCodingAuditConfigurationV1(c echo.Context) error { +func getCodingConfigurationV1(c echo.Context) error { return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportWechatAudit) } -func updateCodingAuditConfigurationV1(c echo.Context) error { +func updateCodingConfigurationV1(c echo.Context) error { return controller.JSONBaseErrorReq(c, errCommunityEditionNotSupportWechatAudit) } diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index fe8950f19d..777df014ec 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -180,24 +180,24 @@ var doc = `{ } } }, - "/v1/configurations/coding_audit": { + "/v1/configurations/coding": { "get": { "security": [ { "ApiKeyAuth": [] } ], - "description": "get coding audit configuration", + "description": "get coding configuration", "tags": [ "configuration" ], "summary": "获取Coding审核配置", - "operationId": "getCodingAuditConfigurationV1", + "operationId": "getCodingConfigurationV1", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.GetCodingAuditConfigurationResV1" + "$ref": "#/definitions/v1.GetCodingConfigurationResV1" } } } @@ -208,7 +208,7 @@ var doc = `{ "ApiKeyAuth": [] } ], - "description": "update coding audit configuration", + "description": "update coding configuration", "consumes": [ "application/json" ], @@ -216,15 +216,15 @@ var doc = `{ "configuration" ], "summary": "添加或更新Coding配置", - "operationId": "UpdateCodingAuditConfigurationV1", + "operationId": "UpdateCodingConfigurationV1", "parameters": [ { - "description": "update coding audit configuration req", + "description": "update coding configuration req", "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.UpdateCodingAuditConfigurationReqV1" + "$ref": "#/definitions/v1.UpdateCodingConfigurationReqV1" } } ], @@ -245,7 +245,7 @@ var doc = `{ "ApiKeyAuth": [] } ], - "description": "test coding audit configuration", + "description": "test coding configuration", "consumes": [ "application/json" ], @@ -253,7 +253,7 @@ var doc = `{ "configuration" ], "summary": "测试Coding审批配置", - "operationId": "testCodingAuditConfigV1", + "operationId": "testCodingConfigV1", "parameters": [ { "description": "test coding configuration req", @@ -13641,7 +13641,7 @@ var doc = `{ } } }, - "v1.GetCodingAuditConfigurationResV1": { + "v1.GetCodingConfigurationResV1": { "type": "object", "properties": { "code": { @@ -17648,7 +17648,7 @@ var doc = `{ } } }, - "v1.UpdateCodingAuditConfigurationReqV1": { + "v1.UpdateCodingConfigurationReqV1": { "type": "object", "properties": { "coding_url": { diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index 8d295b5023..c219bc8d5c 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -164,24 +164,24 @@ } } }, - "/v1/configurations/coding_audit": { + "/v1/configurations/coding": { "get": { "security": [ { "ApiKeyAuth": [] } ], - "description": "get coding audit configuration", + "description": "get coding configuration", "tags": [ "configuration" ], "summary": "获取Coding审核配置", - "operationId": "getCodingAuditConfigurationV1", + "operationId": "getCodingConfigurationV1", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.GetCodingAuditConfigurationResV1" + "$ref": "#/definitions/v1.GetCodingConfigurationResV1" } } } @@ -192,7 +192,7 @@ "ApiKeyAuth": [] } ], - "description": "update coding audit configuration", + "description": "update coding configuration", "consumes": [ "application/json" ], @@ -200,15 +200,15 @@ "configuration" ], "summary": "添加或更新Coding配置", - "operationId": "UpdateCodingAuditConfigurationV1", + "operationId": "UpdateCodingConfigurationV1", "parameters": [ { - "description": "update coding audit configuration req", + "description": "update coding configuration req", "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.UpdateCodingAuditConfigurationReqV1" + "$ref": "#/definitions/v1.UpdateCodingConfigurationReqV1" } } ], @@ -229,7 +229,7 @@ "ApiKeyAuth": [] } ], - "description": "test coding audit configuration", + "description": "test coding configuration", "consumes": [ "application/json" ], @@ -237,7 +237,7 @@ "configuration" ], "summary": "测试Coding审批配置", - "operationId": "testCodingAuditConfigV1", + "operationId": "testCodingConfigV1", "parameters": [ { "description": "test coding configuration req", @@ -13625,7 +13625,7 @@ } } }, - "v1.GetCodingAuditConfigurationResV1": { + "v1.GetCodingConfigurationResV1": { "type": "object", "properties": { "code": { @@ -17632,7 +17632,7 @@ } } }, - "v1.UpdateCodingAuditConfigurationReqV1": { + "v1.UpdateCodingConfigurationReqV1": { "type": "object", "properties": { "coding_url": { diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index 5f9ac32ddb..aedb0bc31b 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -1663,7 +1663,7 @@ definitions: total_nums: type: integer type: object - v1.GetCodingAuditConfigurationResV1: + v1.GetCodingConfigurationResV1: properties: code: example: 0 @@ -4396,7 +4396,7 @@ definitions: example: sql type: string type: object - v1.UpdateCodingAuditConfigurationReqV1: + v1.UpdateCodingConfigurationReqV1: properties: coding_url: type: string @@ -6167,15 +6167,15 @@ paths: summary: 更新企业公告 tags: - companyNotice - /v1/configurations/coding_audit: + /v1/configurations/coding: get: - description: get coding audit configuration - operationId: getCodingAuditConfigurationV1 + description: get coding configuration + operationId: getCodingConfigurationV1 responses: "200": description: OK schema: - $ref: '#/definitions/v1.GetCodingAuditConfigurationResV1' + $ref: '#/definitions/v1.GetCodingConfigurationResV1' security: - ApiKeyAuth: [] summary: 获取Coding审核配置 @@ -6184,15 +6184,15 @@ paths: patch: consumes: - application/json - description: update coding audit configuration - operationId: UpdateCodingAuditConfigurationV1 + description: update coding configuration + operationId: UpdateCodingConfigurationV1 parameters: - - description: update coding audit configuration req + - description: update coding configuration req in: body name: param required: true schema: - $ref: '#/definitions/v1.UpdateCodingAuditConfigurationReqV1' + $ref: '#/definitions/v1.UpdateCodingConfigurationReqV1' responses: "200": description: OK @@ -6207,8 +6207,8 @@ paths: post: consumes: - application/json - description: test coding audit configuration - operationId: testCodingAuditConfigV1 + description: test coding configuration + operationId: testCodingConfigV1 parameters: - description: test coding configuration req in: body From 9a80cebc70d97b6914c55ed061bd055d320cced7 Mon Sep 17 00:00:00 2001 From: littleniannian Date: Tue, 10 Dec 2024 11:56:09 +0800 Subject: [PATCH 5/6] fix: echo route --- sqle/api/app.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sqle/api/app.go b/sqle/api/app.go index d5c91fe760..fae28d8828 100644 --- a/sqle/api/app.go +++ b/sqle/api/app.go @@ -146,9 +146,9 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti v1Router.PATCH("/configurations/wechat_audit", v1.UpdateWechatAuditConfigurationV1, sqleMiddleware.OpGlobalAllowed()) v1Router.GET("/configurations/wechat_audit", v1.GetWechatAuditConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) v1Router.POST("/configurations/wechat_audit/test", v1.TestWechatAuditConfigV1, sqleMiddleware.OpGlobalAllowed()) - v1Router.PATCH("/configurations/coding_audit", v1.UpdateCodingConfigurationV1, sqleMiddleware.OpGlobalAllowed()) - v1Router.GET("/configurations/coding_audit", v1.GetCodingConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) - v1Router.POST("/configurations/coding_audit/test", v1.TestCodingConfigV1, sqleMiddleware.OpGlobalAllowed()) + v1Router.PATCH("/configurations/coding", v1.UpdateCodingConfigurationV1, sqleMiddleware.OpGlobalAllowed()) + v1Router.GET("/configurations/coding", v1.GetCodingConfigurationV1, sqleMiddleware.ViewGlobalAllowed()) + v1Router.POST("/configurations/coding/test", v1.TestCodingConfigV1, sqleMiddleware.OpGlobalAllowed()) // statistic v1Router.GET("/statistic/instances/type_percent", v1.GetInstancesTypePercentV1, sqleMiddleware.ViewGlobalAllowed()) From ff06c170c52a097fece75d1c773205d8ad7d0f60 Mon Sep 17 00:00:00 2001 From: littleniannian Date: Tue, 10 Dec 2024 13:19:52 +0800 Subject: [PATCH 6/6] fix: test coding api coding project name --- sqle/api/controller/v1/configuration.go | 2 +- sqle/docs/docs.go | 2 +- sqle/docs/swagger.json | 2 +- sqle/docs/swagger.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sqle/api/controller/v1/configuration.go b/sqle/api/controller/v1/configuration.go index d6011e3abd..a65bc44429 100644 --- a/sqle/api/controller/v1/configuration.go +++ b/sqle/api/controller/v1/configuration.go @@ -399,7 +399,7 @@ func TestWechatAuditConfigV1(c echo.Context) error { } type TestCodingConfigurationReqV1 struct { - ProjectName string `json:"project_name" form:"project_name" valid:"required" description:"项目名称"` + CodingProjectName string `json:"coding_project_name" form:"coding_project_name" valid:"required" description:"coding项目名称"` } // TestCodingConfigV1 diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index 777df014ec..ea7741a10c 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -17383,7 +17383,7 @@ var doc = `{ "v1.TestCodingConfigurationReqV1": { "type": "object", "properties": { - "project_name": { + "coding_project_name": { "type": "string" } } diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index c219bc8d5c..d6d08cb843 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -17367,7 +17367,7 @@ "v1.TestCodingConfigurationReqV1": { "type": "object", "properties": { - "project_name": { + "coding_project_name": { "type": "string" } } diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index aedb0bc31b..0db3bf0657 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -4213,7 +4213,7 @@ definitions: type: object v1.TestCodingConfigurationReqV1: properties: - project_name: + coding_project_name: type: string type: object v1.TestDingTalkConfigResDataV1: