update answer content

This commit is contained in:
aichy126 2023-01-31 15:13:50 +08:00
parent 4d956f59b1
commit 2395503ad8
4 changed files with 43 additions and 15 deletions

View File

@ -5574,10 +5574,15 @@ const docTemplate = `{
},
"schema.AnswerAddReq": {
"type": "object",
"required": [
"content"
],
"properties": {
"content": {
"description": "content",
"type": "string"
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"html": {
"description": "html",
@ -5591,10 +5596,15 @@ const docTemplate = `{
},
"schema.AnswerUpdateReq": {
"type": "object",
"required": [
"content"
],
"properties": {
"content": {
"description": "content",
"type": "string"
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"edit_summary": {
"description": "edit_summary",

View File

@ -5562,10 +5562,15 @@
},
"schema.AnswerAddReq": {
"type": "object",
"required": [
"content"
],
"properties": {
"content": {
"description": "content",
"type": "string"
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"html": {
"description": "html",
@ -5579,10 +5584,15 @@
},
"schema.AnswerUpdateReq": {
"type": "object",
"required": [
"content"
],
"properties": {
"content": {
"description": "content",
"type": "string"
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"edit_summary": {
"description": "edit_summary",

View File

@ -218,6 +218,8 @@ definitions:
properties:
content:
description: content
maxLength: 65535
minLength: 6
type: string
html:
description: html
@ -225,11 +227,15 @@ definitions:
question_id:
description: question_id
type: string
required:
- content
type: object
schema.AnswerUpdateReq:
properties:
content:
description: content
maxLength: 65535
minLength: 6
type: string
edit_summary:
description: edit_summary
@ -246,6 +252,8 @@ definitions:
title:
description: title
type: string
required:
- content
type: object
schema.AvatarInfo:
properties:

View File

@ -20,10 +20,10 @@ const (
)
type AnswerAddReq struct {
QuestionID string `json:"question_id" ` // question_id
Content string `json:"content" ` // content
HTML string `json:"html" ` // html
UserID string `json:"-" ` // user_id
QuestionID string `json:"question_id" ` // question_id
Content string `validate:"required,gte=6,lte=65535" json:"content" ` // content
HTML string `json:"html" ` // html
UserID string `json:"-" ` // user_id
}
func (req *AnswerAddReq) Check() (errFields []*validator.FormErrorField, err error) {
@ -32,13 +32,13 @@ func (req *AnswerAddReq) Check() (errFields []*validator.FormErrorField, err err
}
type AnswerUpdateReq struct {
ID string `json:"id"` // id
QuestionID string `json:"question_id" ` // question_id
UserID string `json:"-" ` // user_id
Title string `json:"title" ` // title
Content string `json:"content"` // content
HTML string `json:"html" ` // html
EditSummary string `validate:"omitempty" json:"edit_summary"` // edit_summary
ID string `json:"id"` // id
QuestionID string `json:"question_id" ` // question_id
UserID string `json:"-" ` // user_id
Title string `json:"title" ` // title
Content string `validate:"required,gte=6,lte=65535" json:"content"` // content
HTML string `json:"html" ` // html
EditSummary string `validate:"omitempty" json:"edit_summary"` // edit_summary
NoNeedReview bool `json:"-"`
// whether user can edit it
CanEdit bool `json:"-"`