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.

feat(review): update flag api add answer count

LinkinStars371eaf118ea9
diff --git a/docs/docs.go b/docs/docs.go
index 9db1f742..6f19753b 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -39,7 +39,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "ObjectStatus:[available,deleted,pending]",
+ "description": "Status:[available,deleted,pending]",
"consumes": [
"application/json"
],
@@ -370,7 +370,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "ObjectStatus:[available,closed,deleted,pending]",
+ "description": "Status:[available,closed,deleted,pending]",
"consumes": [
"application/json"
],
@@ -7822,6 +7822,9 @@ const docTemplate = `{
"schema.GetReportListPageResp": {
"type": "object",
"properties": {
+ "answer_count": {
+ "type": "integer"
+ },
"answer_id": {
"type": "string"
},
@@ -8955,7 +8958,7 @@ const docTemplate = `{
"type": "string"
},
"status": {
- "description": "ObjectStatus",
+ "description": "Status",
"type": "string"
},
"tags": {
@@ -9636,6 +9639,9 @@ const docTemplate = `{
"schema.UnreviewedRevisionInfoInfo": {
"type": "object",
"properties": {
+ "answer_count": {
+ "type": "integer"
+ },
"answer_id": {
"type": "string"
},
diff --git a/docs/swagger.json b/docs/swagger.json
index d7bf136c..dab51960 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -27,7 +27,7 @@
"ApiKeyAuth": []
}
],
- "description": "ObjectStatus:[available,deleted,pending]",
+ "description": "Status:[available,deleted,pending]",
"consumes": [
"application/json"
],
@@ -358,7 +358,7 @@
"ApiKeyAuth": []
}
],
- "description": "ObjectStatus:[available,closed,deleted,pending]",
+ "description": "Status:[available,closed,deleted,pending]",
"consumes": [
"application/json"
],
@@ -7810,6 +7810,9 @@
"schema.GetReportListPageResp": {
"type": "object",
"properties": {
+ "answer_count": {
+ "type": "integer"
+ },
"answer_id": {
"type": "string"
},
@@ -8943,7 +8946,7 @@
"type": "string"
},
"status": {
- "description": "ObjectStatus",
+ "description": "Status",
"type": "string"
},
"tags": {
@@ -9624,6 +9627,9 @@
"schema.UnreviewedRevisionInfoInfo": {
"type": "object",
"properties": {
+ "answer_count": {
+ "type": "integer"
+ },
"answer_id": {
"type": "string"
},
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 937cd78e..5a8de316 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -821,6 +821,8 @@ definitions:
type: object
schema.GetReportListPageResp:
properties:
+ answer_count:
+ type: integer
answer_id:
type: string
author_user_info:
@@ -1605,7 +1607,7 @@ definitions:
question_id:
type: string
status:
- description: ObjectStatus
+ description: Status
type: string
tags:
description: tags
@@ -2069,6 +2071,8 @@ definitions:
type: object
schema.UnreviewedRevisionInfoInfo:
properties:
+ answer_count:
+ type: integer
answer_id:
type: string
comment_id:
@@ -2639,7 +2643,7 @@ paths:
get:
consumes:
- application/json
- description: ObjectStatus:[available,deleted,pending]
+ description: Status:[available,deleted,pending]
parameters:
- description: page size
in: query
@@ -2841,7 +2845,7 @@ paths:
get:
consumes:
- application/json
- description: ObjectStatus:[available,closed,deleted,pending]
+ description: Status:[available,closed,deleted,pending]
parameters:
- description: page size
in: query
diff --git a/internal/schema/report_schema.go b/internal/schema/report_schema.go
index 6b15a1e0..eadcde84 100644
--- a/internal/schema/report_schema.go
+++ b/internal/schema/report_schema.go
@@ -80,6 +80,7 @@ type GetReportListPageResp struct {
ObjectType string `json:"object_type" enums:"question,answer,comment"`
Title string `json:"title"`
OriginalText string `json:"original_text"`
+ AnswerCount int `json:"answer_count"`
Tags []*TagResp `json:"tags"`
ObjectStatus int `json:"object_status"`
ObjectShowStatus int `json:"object_show_status"`
diff --git a/internal/schema/simple_obj_info_schema.go b/internal/schema/simple_obj_info_schema.go
index 56eb5549..ffd5b97b 100644
--- a/internal/schema/simple_obj_info_schema.go
+++ b/internal/schema/simple_obj_info_schema.go
@@ -44,6 +44,7 @@ type UnreviewedRevisionInfoInfo struct {
Title string `json:"title"`
Content string `json:"content"`
Html string `json:"html"`
+ AnswerCount int `json:"answer_count"`
Tags []*TagResp `json:"tags"`
Status int `json:"status"`
ShowStatus int `json:"show_status"`
diff --git a/internal/service/object_info/object_info.go b/internal/service/object_info/object_info.go
index 719335de..9369c425 100644
--- a/internal/service/object_info/object_info.go
+++ b/internal/service/object_info/object_info.go
@@ -95,6 +95,7 @@ func (os *ObjService) GetUnreviewedRevisionInfo(ctx context.Context, objectID st
Title: questionInfo.Title,
Content: questionInfo.OriginalText,
Html: questionInfo.ParsedText,
+ AnswerCount: questionInfo.AnswerCount,
Tags: tags,
Status: questionInfo.Status,
ShowStatus: questionInfo.Show,
diff --git a/internal/service/report/report_service.go b/internal/service/report/report_service.go
index b5af3211..0d82aa77 100644
--- a/internal/service/report/report_service.go
+++ b/internal/service/report/report_service.go
@@ -134,6 +134,7 @@ func (rs *ReportService) GetUnreviewedReportPostPage(ctx context.Context, req *s
CommentID: info.CommentID,
Title: info.Title,
OriginalText: info.Content,
+ AnswerCount: info.AnswerCount,
Tags: info.Tags,
SubmitAt: report.CreatedAt.Unix(),
ObjectStatus: info.Status,