Skip to content

Commit

Permalink
Merge pull request #1810 from actiontech/issue-ee-918
Browse files Browse the repository at this point in the history
add api for detail info
  • Loading branch information
sjjian authored Sep 12, 2023
2 parents 0747844 + 2d7b94a commit b1c11d6
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 5 deletions.
35 changes: 30 additions & 5 deletions sqle/api/controller/v1/sql_audit_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ type GetSQLAuditRecordsReqV1 struct {
}

type SQLAuditRecord struct {
CreatorUserId uint `json:"creator_user_id"`
SQLAuditRecordId uint `json:"sql_audit_record_id"`
SQLAuditStatus string `json:"sql_audit_status"`
Tags []string `json:"tags"`
Task AuditTaskResV1 `json:"task"`
CreatorUserId uint `json:"creator_user_id"`
SQLAuditRecordId uint `json:"sql_audit_record_id"`
SQLAuditStatus string `json:"sql_audit_status"`
Tags []string `json:"tags"`
Instance SQLAuditRecordInstance `json:"instance"`
Task AuditTaskResV1 `json:"task"`
}

type SQLAuditRecordInstance struct {
Host string `json:"db_host" example:"10.10.10.10"`
Port string `json:"db_port" example:"3306"`
}

type GetSQLAuditRecordsResV1 struct {
Expand Down Expand Up @@ -107,6 +113,25 @@ func GetSQLAuditRecordsV1(c echo.Context) error {
return nil
}

type GetSQLAuditRecordResV1 struct {
controller.BaseRes
Data SQLAuditRecord `json:"data"`
}

// GetSQLAuditRecordV1
// @Summary 获取SQL审核记录信息
// @Description get sql audit record info
// @Tags sql_audit_record
// @Id getSQLAuditRecordV1
// @Security ApiKeyAuth
// @Param project_name path string true "project name"
// @Param sql_audit_record_id path string true "sql audit record id"
// @Success 200 {object} v1.GetSQLAuditRecordResV1
// @router /v1/projects/{project_name}/sql_audit_record/{sql_audit_record_id} [get]
func GetSQLAuditRecordV1(c echo.Context) error {
return nil
}

type GetSQLAuditRecordTagTipsResV1 struct {
controller.BaseRes
Tags []string `json:"data"`
Expand Down
71 changes: 71 additions & 0 deletions sqle/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4542,6 +4542,43 @@ var doc = `{
}
},
"/v1/projects/{project_name}/sql_audit_record/{sql_audit_record_id}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "get sql audit record info",
"tags": [
"sql_audit_record"
],
"summary": "获取SQL审核记录信息",
"operationId": "getSQLAuditRecordV1",
"parameters": [
{
"type": "string",
"description": "project name",
"name": "project_name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "sql audit record id",
"name": "sql_audit_record_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1.GetSQLAuditRecordResV1"
}
}
}
},
"patch": {
"security": [
{
Expand Down Expand Up @@ -12015,6 +12052,23 @@ var doc = `{
}
}
},
"v1.GetSQLAuditRecordResV1": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
"data": {
"type": "object",
"$ref": "#/definitions/v1.SQLAuditRecord"
},
"message": {
"type": "string",
"example": "ok"
}
}
},
"v1.GetSQLAuditRecordTagTipsResV1": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -13815,6 +13869,10 @@ var doc = `{
"creator_user_id": {
"type": "integer"
},
"instance": {
"type": "object",
"$ref": "#/definitions/v1.SQLAuditRecordInstance"
},
"sql_audit_record_id": {
"type": "integer"
},
Expand All @@ -13833,6 +13891,19 @@ var doc = `{
}
}
},
"v1.SQLAuditRecordInstance": {
"type": "object",
"properties": {
"db_host": {
"type": "string",
"example": "10.10.10.10"
},
"db_port": {
"type": "string",
"example": "3306"
}
}
},
"v1.SQLAuditRecordResData": {
"type": "object",
"properties": {
Expand Down
71 changes: 71 additions & 0 deletions sqle/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4526,6 +4526,43 @@
}
},
"/v1/projects/{project_name}/sql_audit_record/{sql_audit_record_id}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "get sql audit record info",
"tags": [
"sql_audit_record"
],
"summary": "获取SQL审核记录信息",
"operationId": "getSQLAuditRecordV1",
"parameters": [
{
"type": "string",
"description": "project name",
"name": "project_name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "sql audit record id",
"name": "sql_audit_record_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1.GetSQLAuditRecordResV1"
}
}
}
},
"patch": {
"security": [
{
Expand Down Expand Up @@ -11999,6 +12036,23 @@
}
}
},
"v1.GetSQLAuditRecordResV1": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 0
},
"data": {
"type": "object",
"$ref": "#/definitions/v1.SQLAuditRecord"
},
"message": {
"type": "string",
"example": "ok"
}
}
},
"v1.GetSQLAuditRecordTagTipsResV1": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -13799,6 +13853,10 @@
"creator_user_id": {
"type": "integer"
},
"instance": {
"type": "object",
"$ref": "#/definitions/v1.SQLAuditRecordInstance"
},
"sql_audit_record_id": {
"type": "integer"
},
Expand All @@ -13817,6 +13875,19 @@
}
}
},
"v1.SQLAuditRecordInstance": {
"type": "object",
"properties": {
"db_host": {
"type": "string",
"example": "10.10.10.10"
},
"db_port": {
"type": "string",
"example": "3306"
}
}
},
"v1.SQLAuditRecordResData": {
"type": "object",
"properties": {
Expand Down
48 changes: 48 additions & 0 deletions sqle/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,18 @@ definitions:
$ref: '#/definitions/v1.TableMeta'
type: array
type: object
v1.GetSQLAuditRecordResV1:
properties:
code:
example: 0
type: integer
data:
$ref: '#/definitions/v1.SQLAuditRecord'
type: object
message:
example: ok
type: string
type: object
v1.GetSQLAuditRecordTagTipsResV1:
properties:
code:
Expand Down Expand Up @@ -3026,6 +3038,9 @@ definitions:
properties:
creator_user_id:
type: integer
instance:
$ref: '#/definitions/v1.SQLAuditRecordInstance'
type: object
sql_audit_record_id:
type: integer
sql_audit_status:
Expand All @@ -3038,6 +3053,15 @@ definitions:
$ref: '#/definitions/v1.AuditTaskResV1'
type: object
type: object
v1.SQLAuditRecordInstance:
properties:
db_host:
example: 10.10.10.10
type: string
db_port:
example: "3306"
type: string
type: object
v1.SQLAuditRecordResData:
properties:
sql_audit_record_id:
Expand Down Expand Up @@ -7649,6 +7673,30 @@ paths:
tags:
- sql_audit_record
/v1/projects/{project_name}/sql_audit_record/{sql_audit_record_id}:
get:
description: get sql audit record info
operationId: getSQLAuditRecordV1
parameters:
- description: project name
in: path
name: project_name
required: true
type: string
- description: sql audit record id
in: path
name: sql_audit_record_id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/v1.GetSQLAuditRecordResV1'
security:
- ApiKeyAuth: []
summary: 获取SQL审核记录信息
tags:
- sql_audit_record
patch:
consumes:
- application/json
Expand Down

0 comments on commit b1c11d6

Please sign in to comment.