feat: add time zone config

This commit is contained in:
LinkinStar 2022-11-02 15:02:27 +08:00
parent 79cc30355a
commit 18e880b9c8
5 changed files with 75 additions and 46 deletions

View File

@ -487,14 +487,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo general",
"description": "get site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo general",
"summary": "get site general information",
"responses": {
"200": {
"description": "OK",
@ -522,14 +522,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site general information",
"parameters": [
{
"description": "general",
@ -558,14 +558,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "get site interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "get site interface",
"parameters": [
{
"description": "general",
@ -604,14 +604,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site info interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site info interface",
"parameters": [
{
"description": "general",
@ -5326,7 +5326,8 @@ const docTemplate = `{
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5340,6 +5341,10 @@ const docTemplate = `{
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},
@ -5347,7 +5352,8 @@ const docTemplate = `{
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5361,6 +5367,10 @@ const docTemplate = `{
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},

View File

@ -475,14 +475,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo general",
"description": "get site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo general",
"summary": "get site general information",
"responses": {
"200": {
"description": "OK",
@ -510,14 +510,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site general information",
"parameters": [
{
"description": "general",
@ -546,14 +546,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "get site interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "get site interface",
"parameters": [
{
"description": "general",
@ -592,14 +592,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site info interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site info interface",
"parameters": [
{
"description": "general",
@ -5314,7 +5314,8 @@
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5328,6 +5329,10 @@
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},
@ -5335,7 +5340,8 @@
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5349,6 +5355,10 @@
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},

View File

@ -1024,9 +1024,13 @@ definitions:
theme:
maxLength: 128
type: string
time_zone:
maxLength: 128
type: string
required:
- language
- theme
- time_zone
type: object
schema.SiteInterfaceResp:
properties:
@ -1039,9 +1043,13 @@ definitions:
theme:
maxLength: 128
type: string
time_zone:
maxLength: 128
type: string
required:
- language
- theme
- time_zone
type: object
schema.TagItem:
properties:
@ -1662,7 +1670,7 @@ paths:
- admin
/answer/admin/api/siteinfo/general:
get:
description: Get siteinfo general
description: get site general information
produces:
- application/json
responses:
@ -1677,11 +1685,11 @@ paths:
type: object
security:
- ApiKeyAuth: []
summary: Get siteinfo general
summary: get site general information
tags:
- admin
put:
description: Get siteinfo interface
description: update site general information
parameters:
- description: general
in: body
@ -1698,12 +1706,12 @@ paths:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: Get siteinfo interface
summary: update site general information
tags:
- admin
/answer/admin/api/siteinfo/interface:
get:
description: Get siteinfo interface
description: get site interface
parameters:
- description: general
in: body
@ -1725,11 +1733,11 @@ paths:
type: object
security:
- ApiKeyAuth: []
summary: Get siteinfo interface
summary: get site interface
tags:
- admin
put:
description: Get siteinfo interface
description: update site info interface
parameters:
- description: general
in: body
@ -1746,7 +1754,7 @@ paths:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: Get siteinfo interface
summary: update site info interface
tags:
- admin
/answer/admin/api/theme/options:

View File

@ -18,9 +18,9 @@ func NewSiteInfoController(siteInfoService *service.SiteInfoService) *SiteInfoCo
}
}
// GetGeneral godoc
// @Summary Get siteinfo general
// @Description Get siteinfo general
// GetGeneral get site general information
// @Summary get site general information
// @Description get site general information
// @Security ApiKeyAuth
// @Tags admin
// @Produce json
@ -31,9 +31,9 @@ func (sc *SiteInfoController) GetGeneral(ctx *gin.Context) {
handler.HandleResponse(ctx, err, resp)
}
// GetInterface godoc
// @Summary Get siteinfo interface
// @Description Get siteinfo interface
// GetInterface get site interface
// @Summary get site interface
// @Description get site interface
// @Security ApiKeyAuth
// @Tags admin
// @Produce json
@ -45,9 +45,9 @@ func (sc *SiteInfoController) GetInterface(ctx *gin.Context) {
handler.HandleResponse(ctx, err, resp)
}
// UpdateGeneral godoc
// @Summary Get siteinfo interface
// @Description Get siteinfo interface
// UpdateGeneral update site general information
// @Summary update site general information
// @Description update site general information
// @Security ApiKeyAuth
// @Tags admin
// @Produce json
@ -63,9 +63,9 @@ func (sc *SiteInfoController) UpdateGeneral(ctx *gin.Context) {
handler.HandleResponse(ctx, err, nil)
}
// UpdateInterface godoc
// @Summary Get siteinfo interface
// @Description Get siteinfo interface
// UpdateInterface update site interface
// @Summary update site info interface
// @Description update site info interface
// @Security ApiKeyAuth
// @Tags admin
// @Produce json

View File

@ -2,16 +2,17 @@ package schema
// SiteGeneralReq site general request
type SiteGeneralReq struct {
Name string `validate:"required,gt=1,lte=128" comment:"site name" form:"name" json:"name"`
ShortDescription string `validate:"required,gt=3,lte=255" comment:"short site description" form:"short_description" json:"short_description"`
Description string `validate:"required,gt=3,lte=2000" comment:"site description" form:"description" json:"description"`
Name string `validate:"required,gt=1,lte=128" form:"name" json:"name"`
ShortDescription string `validate:"required,gt=3,lte=255" form:"short_description" json:"short_description"`
Description string `validate:"required,gt=3,lte=2000" form:"description" json:"description"`
}
// SiteInterfaceReq site interface request
type SiteInterfaceReq struct {
Logo string `validate:"omitempty,gt=0,lte=256" comment:"logo" form:"logo" json:"logo"`
Theme string `validate:"required,gt=1,lte=128" comment:"theme" form:"theme" json:"theme"`
Language string `validate:"required,gt=1,lte=128" comment:"interface language" form:"language" json:"language"`
Logo string `validate:"omitempty,gt=0,lte=256" form:"logo" json:"logo"`
Theme string `validate:"required,gt=1,lte=128" form:"theme" json:"theme"`
Language string `validate:"required,gt=1,lte=128" form:"language" json:"language"`
TimeZone string `validate:"required,gt=1,lte=128" form:"time_zone" json:"time_zone"`
}
// SiteGeneralResp site general response