Merge branch 'doc/swagger' into 'main'

doc: update admin interface swagger

See merge request opensource/answer!89
This commit is contained in:
linkinstar 2022-10-21 02:32:50 +00:00
commit 5cb3c8c055
4 changed files with 184 additions and 11 deletions

View File

@ -418,7 +418,7 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/schema.SiteInterfaceResp" "$ref": "#/definitions/schema.GetSMTPConfigResp"
} }
} }
} }
@ -443,12 +443,12 @@ const docTemplate = `{
"summary": "update smtp config", "summary": "update smtp config",
"parameters": [ "parameters": [
{ {
"description": "general", "description": "smtp config",
"name": "data", "name": "data",
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/schema.SiteInterfaceReq" "$ref": "#/definitions/schema.UpdateSMTPConfigReq"
} }
} }
], ],
@ -4618,6 +4618,33 @@ const docTemplate = `{
} }
} }
}, },
"schema.GetSMTPConfigResp": {
"type": "object",
"properties": {
"encryption": {
"description": "\"\" SSL TLS",
"type": "string"
},
"from_email_address": {
"type": "string"
},
"from_name": {
"type": "string"
},
"smtp_host": {
"type": "string"
},
"smtp_password": {
"type": "string"
},
"smtp_port": {
"type": "integer"
},
"smtp_username": {
"type": "string"
}
}
},
"schema.GetTagPageResp": { "schema.GetTagPageResp": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -5499,6 +5526,43 @@ const docTemplate = `{
} }
} }
}, },
"schema.UpdateSMTPConfigReq": {
"type": "object",
"properties": {
"encryption": {
"description": "\"\" SSL TLS",
"type": "string",
"enum": [
"SSL"
]
},
"from_email_address": {
"type": "string",
"maxLength": 256
},
"from_name": {
"type": "string",
"maxLength": 256
},
"smtp_host": {
"type": "string",
"maxLength": 256
},
"smtp_password": {
"type": "string",
"maxLength": 256
},
"smtp_port": {
"type": "integer",
"maximum": 65535,
"minimum": 1
},
"smtp_username": {
"type": "string",
"maxLength": 256
}
}
},
"schema.UpdateTagReq": { "schema.UpdateTagReq": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -406,7 +406,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/schema.SiteInterfaceResp" "$ref": "#/definitions/schema.GetSMTPConfigResp"
} }
} }
} }
@ -431,12 +431,12 @@
"summary": "update smtp config", "summary": "update smtp config",
"parameters": [ "parameters": [
{ {
"description": "general", "description": "smtp config",
"name": "data", "name": "data",
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/schema.SiteInterfaceReq" "$ref": "#/definitions/schema.UpdateSMTPConfigReq"
} }
} }
], ],
@ -4606,6 +4606,33 @@
} }
} }
}, },
"schema.GetSMTPConfigResp": {
"type": "object",
"properties": {
"encryption": {
"description": "\"\" SSL TLS",
"type": "string"
},
"from_email_address": {
"type": "string"
},
"from_name": {
"type": "string"
},
"smtp_host": {
"type": "string"
},
"smtp_password": {
"type": "string"
},
"smtp_port": {
"type": "integer"
},
"smtp_username": {
"type": "string"
}
}
},
"schema.GetTagPageResp": { "schema.GetTagPageResp": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -5487,6 +5514,43 @@
} }
} }
}, },
"schema.UpdateSMTPConfigReq": {
"type": "object",
"properties": {
"encryption": {
"description": "\"\" SSL TLS",
"type": "string",
"enum": [
"SSL"
]
},
"from_email_address": {
"type": "string",
"maxLength": 256
},
"from_name": {
"type": "string",
"maxLength": 256
},
"smtp_host": {
"type": "string",
"maxLength": 256
},
"smtp_password": {
"type": "string",
"maxLength": 256
},
"smtp_port": {
"type": "integer",
"maximum": 65535,
"minimum": 1
},
"smtp_username": {
"type": "string",
"maxLength": 256
}
}
},
"schema.UpdateTagReq": { "schema.UpdateTagReq": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -510,6 +510,24 @@ definitions:
user_info: user_info:
$ref: '#/definitions/schema.UserBasicInfo' $ref: '#/definitions/schema.UserBasicInfo'
type: object type: object
schema.GetSMTPConfigResp:
properties:
encryption:
description: '"" SSL TLS'
type: string
from_email_address:
type: string
from_name:
type: string
smtp_host:
type: string
smtp_password:
type: string
smtp_port:
type: integer
smtp_username:
type: string
type: object
schema.GetTagPageResp: schema.GetTagPageResp:
properties: properties:
created_at: created_at:
@ -1146,6 +1164,33 @@ definitions:
required: required:
- id - id
type: object type: object
schema.UpdateSMTPConfigReq:
properties:
encryption:
description: '"" SSL TLS'
enum:
- SSL
type: string
from_email_address:
maxLength: 256
type: string
from_name:
maxLength: 256
type: string
smtp_host:
maxLength: 256
type: string
smtp_password:
maxLength: 256
type: string
smtp_port:
maximum: 65535
minimum: 1
type: integer
smtp_username:
maxLength: 256
type: string
type: object
schema.UpdateTagReq: schema.UpdateTagReq:
properties: properties:
display_name: display_name:
@ -1612,7 +1657,7 @@ paths:
- $ref: '#/definitions/handler.RespBody' - $ref: '#/definitions/handler.RespBody'
- properties: - properties:
data: data:
$ref: '#/definitions/schema.SiteInterfaceResp' $ref: '#/definitions/schema.GetSMTPConfigResp'
type: object type: object
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
@ -1622,12 +1667,12 @@ paths:
put: put:
description: update smtp config description: update smtp config
parameters: parameters:
- description: general - description: smtp config
in: body in: body
name: data name: data
required: true required: true
schema: schema:
$ref: '#/definitions/schema.SiteInterfaceReq' $ref: '#/definitions/schema.UpdateSMTPConfigReq'
produces: produces:
- application/json - application/json
responses: responses:

View File

@ -87,7 +87,7 @@ func (sc *SiteInfoController) UpdateInterface(ctx *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Tags admin // @Tags admin
// @Produce json // @Produce json
// @Success 200 {object} handler.RespBody{data=schema.SiteInterfaceResp} // @Success 200 {object} handler.RespBody{data=schema.GetSMTPConfigResp}
// @Router /answer/admin/api/setting/smtp [get] // @Router /answer/admin/api/setting/smtp [get]
func (sc *SiteInfoController) GetSMTPConfig(ctx *gin.Context) { func (sc *SiteInfoController) GetSMTPConfig(ctx *gin.Context) {
resp, err := sc.siteInfoService.GetSMTPConfig(ctx) resp, err := sc.siteInfoService.GetSMTPConfig(ctx)
@ -100,7 +100,7 @@ func (sc *SiteInfoController) GetSMTPConfig(ctx *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Tags admin // @Tags admin
// @Produce json // @Produce json
// @Param data body schema.SiteInterfaceReq true "general" // @Param data body schema.UpdateSMTPConfigReq true "smtp config"
// @Success 200 {object} handler.RespBody{} // @Success 200 {object} handler.RespBody{}
// @Router /answer/admin/api/setting/smtp [put] // @Router /answer/admin/api/setting/smtp [put]
func (sc *SiteInfoController) UpdateSMTPConfig(ctx *gin.Context) { func (sc *SiteInfoController) UpdateSMTPConfig(ctx *gin.Context) {