Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

add AcceptedAnswerItem

aichy126ff69966e8285
diff --git a/internal/controller/question_controller.go b/internal/controller/question_controller.go
index 089abce5..e972ddac 100644
--- a/internal/controller/question_controller.go
+++ b/internal/controller/question_controller.go
@@ -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)
diff --git a/internal/schema/template_schema.go b/internal/schema/template_schema.go
index 5f67d57f..0e498702 100644
--- a/internal/schema/template_schema.go
+++ b/internal/schema/template_schema.go
@@ -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"`