add AcceptedAnswerItem

This commit is contained in:
aichy126 2022-12-09 11:12:25 +08:00
parent 0954b5ff11
commit ff69966e82
2 changed files with 18 additions and 0 deletions

View File

@ -316,6 +316,16 @@ func (qc *QuestionController) UpdateQuestion(ctx *gin.Context) {
// TODO: pass errFields and return errors
log.Info(errFields)
// errMsg := fmt.Sprintf(`The reserved tag "%s" must be present.`,
// strings.Join(CheckOldTaglist, ","))
// errorlist := make([]*validator.FormErrorField, 0)
// errorlist = append(errorlist, &validator.FormErrorField{
// ErrorField: "tags",
// ErrorMsg: errMsg,
// })
// err = errors.BadRequest(reason.RequestFormatError).WithMsg(errMsg)
// return errorlist, err
resp, err := qc.questionService.UpdateQuestion(ctx, req)
if err != nil {
handler.HandleResponse(ctx, err, resp)

View File

@ -24,10 +24,18 @@ type QAPageJsonLD struct {
Type string `json:"@type"`
Name string `json:"name"`
} `json:"author"`
AcceptedAnswer AcceptedAnswerItem `json:"acceptedAnswer"`
SuggestedAnswer []*SuggestedAnswerItem `json:"suggestedAnswer"`
} `json:"mainEntity"`
}
type AcceptedAnswerItem struct {
Type string `json:"@type"`
Text string `json:"text"`
UpvoteCount int `json:"upvoteCount"`
URL string `json:"url"`
}
type SuggestedAnswerItem struct {
Type string `json:"@type"`
Text string `json:"text"`