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.

swagger

aichy126ba46d08e0476
diff --git a/docs/docs.go b/docs/docs.go
index 18be2dd5..c37e68ef 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -1005,6 +1005,69 @@ const docTemplate = `{
}
}
},
+ "/answer/api/v1/activity/timeline": {
+ "get": {
+ "description": "get object timeline",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Comment"
+ ],
+ "summary": "get object timeline",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "object id",
+ "name": "object_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "tag slug name",
+ "name": "tag_slug_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "question",
+ "answer",
+ "tag"
+ ],
+ "type": "string",
+ "description": "object type",
+ "name": "object_type",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "is show vote",
+ "name": "show_vote",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/answer/api/v1/answer": {
"put": {
"security": [
@@ -4468,6 +4531,61 @@ const docTemplate = `{
"list": {}
}
},
+ "schema.ActObjectInfo": {
+ "type": "object",
+ "properties": {
+ "answer_id": {
+ "type": "string"
+ },
+ "object_type": {
+ "type": "string"
+ },
+ "question_id": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.ActObjectTimeline": {
+ "type": "object",
+ "properties": {
+ "activity_id": {
+ "type": "string"
+ },
+ "activity_type": {
+ "type": "string"
+ },
+ "cancelled": {
+ "type": "boolean"
+ },
+ "cancelled_at": {
+ "type": "integer"
+ },
+ "comment": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "object_id": {
+ "type": "string"
+ },
+ "object_type": {
+ "type": "string"
+ },
+ "revision_id": {
+ "type": "string"
+ },
+ "user_display_name": {
+ "type": "string"
+ },
+ "username": {
+ "type": "string"
+ }
+ }
+ },
"schema.ActionRecordResp": {
"type": "object",
"properties": {
@@ -4874,6 +4992,20 @@ const docTemplate = `{
}
}
},
+ "schema.GetObjectTimelineResp": {
+ "type": "object",
+ "properties": {
+ "object_info": {
+ "$ref": "#/definitions/schema.ActObjectInfo"
+ },
+ "timeline": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.ActObjectTimeline"
+ }
+ }
+ }
+ },
"schema.GetOtherUserInfoByUsernameResp": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index e8d96d62..5a1c4c38 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -993,6 +993,69 @@
}
}
},
+ "/answer/api/v1/activity/timeline": {
+ "get": {
+ "description": "get object timeline",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Comment"
+ ],
+ "summary": "get object timeline",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "object id",
+ "name": "object_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "tag slug name",
+ "name": "tag_slug_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "question",
+ "answer",
+ "tag"
+ ],
+ "type": "string",
+ "description": "object type",
+ "name": "object_type",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "is show vote",
+ "name": "show_vote",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/answer/api/v1/answer": {
"put": {
"security": [
@@ -4456,6 +4519,61 @@
"list": {}
}
},
+ "schema.ActObjectInfo": {
+ "type": "object",
+ "properties": {
+ "answer_id": {
+ "type": "string"
+ },
+ "object_type": {
+ "type": "string"
+ },
+ "question_id": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.ActObjectTimeline": {
+ "type": "object",
+ "properties": {
+ "activity_id": {
+ "type": "string"
+ },
+ "activity_type": {
+ "type": "string"
+ },
+ "cancelled": {
+ "type": "boolean"
+ },
+ "cancelled_at": {
+ "type": "integer"
+ },
+ "comment": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "object_id": {
+ "type": "string"
+ },
+ "object_type": {
+ "type": "string"
+ },
+ "revision_id": {
+ "type": "string"
+ },
+ "user_display_name": {
+ "type": "string"
+ },
+ "username": {
+ "type": "string"
+ }
+ }
+ },
"schema.ActionRecordResp": {
"type": "object",
"properties": {
@@ -4862,6 +4980,20 @@
}
}
},
+ "schema.GetObjectTimelineResp": {
+ "type": "object",
+ "properties": {
+ "object_info": {
+ "$ref": "#/definitions/schema.ActObjectInfo"
+ },
+ "timeline": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.ActObjectTimeline"
+ }
+ }
+ }
+ },
"schema.GetOtherUserInfoByUsernameResp": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 0cdd69bf..86ec580d 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -89,6 +89,42 @@ definitions:
type: integer
list: {}
type: object
+ schema.ActObjectInfo:
+ properties:
+ answer_id:
+ type: string
+ object_type:
+ type: string
+ question_id:
+ type: string
+ title:
+ type: string
+ type: object
+ schema.ActObjectTimeline:
+ properties:
+ activity_id:
+ type: string
+ activity_type:
+ type: string
+ cancelled:
+ type: boolean
+ cancelled_at:
+ type: integer
+ comment:
+ type: string
+ created_at:
+ type: integer
+ object_id:
+ type: string
+ object_type:
+ type: string
+ revision_id:
+ type: string
+ user_display_name:
+ type: string
+ username:
+ type: string
+ type: object
schema.ActionRecordResp:
properties:
captcha_id:
@@ -379,6 +415,15 @@ definitions:
description: tag id
type: string
type: object
+ schema.GetObjectTimelineResp:
+ properties:
+ object_info:
+ $ref: '#/definitions/schema.ActObjectInfo'
+ timeline:
+ items:
+ $ref: '#/definitions/schema.ActObjectTimeline'
+ type: array
+ type: object
schema.GetOtherUserInfoByUsernameResp:
properties:
answer_count:
@@ -2189,6 +2234,45 @@ paths:
summary: get user page
tags:
- admin
+ /answer/api/v1/activity/timeline:
+ get:
+ description: get object timeline
+ parameters:
+ - description: object id
+ in: query
+ name: object_id
+ type: string
+ - description: tag slug name
+ in: query
+ name: tag_slug_name
+ type: string
+ - description: object type
+ enum:
+ - question
+ - answer
+ - tag
+ in: query
+ name: object_type
+ type: string
+ - description: is show vote
+ in: query
+ name: show_vote
+ type: boolean
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.GetObjectTimelineResp'
+ type: object
+ summary: get object timeline
+ tags:
+ - Comment
/answer/api/v1/answer:
delete:
consumes:
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index 04102618..19bc53cf 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -28,8 +28,8 @@ backend:
other: "Answer do not found."
cannot_deleted:
other: "No permission to delete."
- cannot_update:
- other: "No permission to update."
+ cannot_update:
+ other: "No permission to update."
comment:
edit_without_permission:
other: "Comment are not allowed to edit."
diff --git a/internal/controller/activity_controller.go b/internal/controller/activity_controller.go
index 7ce56f82..3e53a53b 100644
--- a/internal/controller/activity_controller.go
+++ b/internal/controller/activity_controller.go
@@ -29,7 +29,7 @@ func NewActivityController(
// @Param object_id query string false "object id"
// @Param tag_slug_name query string false "tag slug name"
// @Param object_type query string false "object type" Enums(question, answer, tag)
-// @Param show_vote bool false "is show vote"
+// @Param show_vote query boolean false "is show vote"
// @Success 200 {object} handler.RespBody{data=schema.GetObjectTimelineResp}
// @Router /answer/api/v1/activity/timeline [get]
func (ac *ActivityController) GetObjectTimeline(ctx *gin.Context) {
diff --git a/internal/service/question_service.go b/internal/service/question_service.go
index f167d2c7..85772f7e 100644
--- a/internal/service/question_service.go
+++ b/internal/service/question_service.go
@@ -79,7 +79,7 @@ func (qs *QuestionService) CloseQuestion(ctx context.Context, req *schema.CloseQ
return errors.BadRequest(reason.QuestionCannotClose)
}
}
- questionInfo.Status = entity.QuestionStatusclosed
+ questionInfo.Status = entity.QuestionStatusClosed
err = qs.questionRepo.UpdateQuestionStatus(ctx, questionInfo)
if err != nil {
return err