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.
fix swagger
aichyd3b77e76d699
diff --git a/docs/docs.go b/docs/docs.goindex 78e53c0a..9486300e 100644--- a/docs/docs.go+++ b/docs/docs.go@@ -105,7 +105,7 @@ const docTemplate = `{"in": "body","required": true,"schema": {- "$ref": "#/definitions/entity.AdminSetAnswerStatusRequest"+ "$ref": "#/definitions/schema.AdminSetAnswerStatusRequest"}}],@@ -822,6 +822,77 @@ const docTemplate = `{}}},+ "/answer/admin/api/siteinfo/seo": {+ "get": {+ "security": [+ {+ "ApiKeyAuth": []+ }+ ],+ "description": "get site seo information",+ "produces": [+ "application/json"+ ],+ "tags": [+ "admin"+ ],+ "summary": "get site seo information",+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "allOf": [+ {+ "$ref": "#/definitions/handler.RespBody"+ },+ {+ "type": "object",+ "properties": {+ "data": {+ "$ref": "#/definitions/schema.SiteSeoResp"+ }+ }+ }+ ]+ }+ }+ }+ },+ "put": {+ "security": [+ {+ "ApiKeyAuth": []+ }+ ],+ "description": "update site seo information",+ "produces": [+ "application/json"+ ],+ "tags": [+ "admin"+ ],+ "summary": "update site seo information",+ "parameters": [+ {+ "description": "seo",+ "name": "data",+ "in": "body",+ "required": true,+ "schema": {+ "$ref": "#/definitions/schema.SiteSeoReq"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "$ref": "#/definitions/handler.RespBody"+ }+ }+ }+ }+ },"/answer/admin/api/siteinfo/write": {"get": {"security": [@@ -2746,6 +2817,45 @@ const docTemplate = `{}}},+ "/answer/api/v1/question/reopen": {+ "put": {+ "security": [+ {+ "ApiKeyAuth": []+ }+ ],+ "description": "reopen question",+ "consumes": [+ "application/json"+ ],+ "produces": [+ "application/json"+ ],+ "tags": [+ "api-question"+ ],+ "summary": "reopen question",+ "parameters": [+ {+ "description": "question",+ "name": "data",+ "in": "body",+ "required": true,+ "schema": {+ "$ref": "#/definitions/schema.ReopenQuestionReq"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "$ref": "#/definitions/handler.RespBody"+ }+ }+ }+ }+ },"/answer/api/v1/question/search": {"post": {"description": "SearchQuestionList",@@ -4672,20 +4782,29 @@ const docTemplate = `{}}}+ },+ "/robots.txt": {+ "get": {+ "description": "get site robots information",+ "produces": [+ "application/json"+ ],+ "tags": [+ "site"+ ],+ "summary": "get site robots information",+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "type": "string"+ }+ }+ }+ }}},"definitions": {- "entity.AdminSetAnswerStatusRequest": {- "type": "object",- "properties": {- "answer_id": {- "type": "string"- },- "status": {- "type": "string"- }- }- },"handler.RespBody": {"type": "object","properties": {@@ -4812,6 +4931,9 @@ const docTemplate = `{"display_name": {"type": "string"},+ "main_tag_slug_name": {+ "type": "string"+ },"object_type": {"type": "string"},@@ -4847,6 +4969,9 @@ const docTemplate = `{"created_at": {"type": "integer"},+ "id": {+ "type": "string"+ },"object_id": {"type": "string"},@@ -4934,6 +5059,17 @@ const docTemplate = `{}}},+ "schema.AdminSetAnswerStatusRequest": {+ "type": "object",+ "properties": {+ "answer_id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ }+ }+ },"schema.AdminSetQuestionStatusRequest": {"type": "object","properties": {@@ -4969,7 +5105,6 @@ const docTemplate = `{"type": "string"},"question_id": {- "description": "question_id","type": "string"}}@@ -6163,6 +6298,14 @@ const docTemplate = `{}}},+ "schema.ReopenQuestionReq": {+ "type": "object",+ "properties": {+ "question_id": {+ "type": "string"+ }+ }+ },"schema.ReportHandleReq": {"type": "object","required": [@@ -6253,7 +6396,11 @@ const docTemplate = `{},"user_info": {"description": "user info",- "$ref": "#/definitions/schema.UserBasicInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.UserBasicInfo"+ }+ ]},"vote_count": {"type": "integer"@@ -6265,7 +6412,11 @@ const docTemplate = `{"properties": {"object": {"description": "this object",- "$ref": "#/definitions/schema.SearchObject"+ "allOf": [+ {+ "$ref": "#/definitions/schema.SearchObject"+ }+ ]},"object_type": {"description": "object_type",@@ -6328,6 +6479,7 @@ const docTemplate = `{"required": ["contact_email","name",+ "permalink","site_url"],"properties": {@@ -6343,6 +6495,11 @@ const docTemplate = `{"type": "string","maxLength": 128},+ "permalink": {+ "type": "integer",+ "maximum": 3,+ "minimum": 0+ },"short_description": {"type": "string","maxLength": 255@@ -6358,6 +6515,7 @@ const docTemplate = `{"required": ["contact_email","name",+ "permalink","site_url"],"properties": {@@ -6373,6 +6531,11 @@ const docTemplate = `{"type": "string","maxLength": 128},+ "permalink": {+ "type": "integer",+ "maximum": 3,+ "minimum": 0+ },"short_description": {"type": "string","maxLength": 255@@ -6461,6 +6624,28 @@ const docTemplate = `{}}},+ "schema.SiteSeoReq": {+ "type": "object",+ "required": [+ "robots"+ ],+ "properties": {+ "robots": {+ "type": "string"+ }+ }+ },+ "schema.SiteSeoResp": {+ "type": "object",+ "required": [+ "robots"+ ],+ "properties": {+ "robots": {+ "type": "string"+ }+ }+ },"schema.SiteWriteReq": {"type": "object","properties": {@@ -6629,7 +6814,11 @@ const docTemplate = `{"properties": {"avatar": {"description": "avatar",- "$ref": "#/definitions/schema.AvatarInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.AvatarInfo"+ }+ ]},"bio": {"description": "bio",@@ -6824,6 +7013,10 @@ const docTemplate = `{"description": "display_name","type": "string"},+ "id": {+ "description": "user_id",+ "type": "string"+ },"ip_info": {"description": "ip info","type": "string"diff --git a/docs/swagger.json b/docs/swagger.jsonindex aaad0374..3ce7f923 100644--- a/docs/swagger.json+++ b/docs/swagger.json@@ -93,7 +93,7 @@"in": "body","required": true,"schema": {- "$ref": "#/definitions/entity.AdminSetAnswerStatusRequest"+ "$ref": "#/definitions/schema.AdminSetAnswerStatusRequest"}}],@@ -810,6 +810,77 @@}}},+ "/answer/admin/api/siteinfo/seo": {+ "get": {+ "security": [+ {+ "ApiKeyAuth": []+ }+ ],+ "description": "get site seo information",+ "produces": [+ "application/json"+ ],+ "tags": [+ "admin"+ ],+ "summary": "get site seo information",+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "allOf": [+ {+ "$ref": "#/definitions/handler.RespBody"+ },+ {+ "type": "object",+ "properties": {+ "data": {+ "$ref": "#/definitions/schema.SiteSeoResp"+ }+ }+ }+ ]+ }+ }+ }+ },+ "put": {+ "security": [+ {+ "ApiKeyAuth": []+ }+ ],+ "description": "update site seo information",+ "produces": [+ "application/json"+ ],+ "tags": [+ "admin"+ ],+ "summary": "update site seo information",+ "parameters": [+ {+ "description": "seo",+ "name": "data",+ "in": "body",+ "required": true,+ "schema": {+ "$ref": "#/definitions/schema.SiteSeoReq"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "$ref": "#/definitions/handler.RespBody"+ }+ }+ }+ }+ },"/answer/admin/api/siteinfo/write": {"get": {"security": [@@ -2734,6 +2805,45 @@}}},+ "/answer/api/v1/question/reopen": {+ "put": {+ "security": [+ {+ "ApiKeyAuth": []+ }+ ],+ "description": "reopen question",+ "consumes": [+ "application/json"+ ],+ "produces": [+ "application/json"+ ],+ "tags": [+ "api-question"+ ],+ "summary": "reopen question",+ "parameters": [+ {+ "description": "question",+ "name": "data",+ "in": "body",+ "required": true,+ "schema": {+ "$ref": "#/definitions/schema.ReopenQuestionReq"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "$ref": "#/definitions/handler.RespBody"+ }+ }+ }+ }+ },"/answer/api/v1/question/search": {"post": {"description": "SearchQuestionList",@@ -4660,20 +4770,29 @@}}}+ },+ "/robots.txt": {+ "get": {+ "description": "get site robots information",+ "produces": [+ "application/json"+ ],+ "tags": [+ "site"+ ],+ "summary": "get site robots information",+ "responses": {+ "200": {+ "description": "OK",+ "schema": {+ "type": "string"+ }+ }+ }+ }}},"definitions": {- "entity.AdminSetAnswerStatusRequest": {- "type": "object",- "properties": {- "answer_id": {- "type": "string"- },- "status": {- "type": "string"- }- }- },"handler.RespBody": {"type": "object","properties": {@@ -4800,6 +4919,9 @@"display_name": {"type": "string"},+ "main_tag_slug_name": {+ "type": "string"+ },"object_type": {"type": "string"},@@ -4835,6 +4957,9 @@"created_at": {"type": "integer"},+ "id": {+ "type": "string"+ },"object_id": {"type": "string"},@@ -4922,6 +5047,17 @@}}},+ "schema.AdminSetAnswerStatusRequest": {+ "type": "object",+ "properties": {+ "answer_id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ }+ }+ },"schema.AdminSetQuestionStatusRequest": {"type": "object","properties": {@@ -4957,7 +5093,6 @@"type": "string"},"question_id": {- "description": "question_id","type": "string"}}@@ -6151,6 +6286,14 @@}}},+ "schema.ReopenQuestionReq": {+ "type": "object",+ "properties": {+ "question_id": {+ "type": "string"+ }+ }+ },"schema.ReportHandleReq": {"type": "object","required": [@@ -6241,7 +6384,11 @@},"user_info": {"description": "user info",- "$ref": "#/definitions/schema.UserBasicInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.UserBasicInfo"+ }+ ]},"vote_count": {"type": "integer"@@ -6253,7 +6400,11 @@"properties": {"object": {"description": "this object",- "$ref": "#/definitions/schema.SearchObject"+ "allOf": [+ {+ "$ref": "#/definitions/schema.SearchObject"+ }+ ]},"object_type": {"description": "object_type",@@ -6316,6 +6467,7 @@"required": ["contact_email","name",+ "permalink","site_url"],"properties": {@@ -6331,6 +6483,11 @@"type": "string","maxLength": 128},+ "permalink": {+ "type": "integer",+ "maximum": 3,+ "minimum": 0+ },"short_description": {"type": "string","maxLength": 255@@ -6346,6 +6503,7 @@"required": ["contact_email","name",+ "permalink","site_url"],"properties": {@@ -6361,6 +6519,11 @@"type": "string","maxLength": 128},+ "permalink": {+ "type": "integer",+ "maximum": 3,+ "minimum": 0+ },"short_description": {"type": "string","maxLength": 255@@ -6449,6 +6612,28 @@}}},+ "schema.SiteSeoReq": {+ "type": "object",+ "required": [+ "robots"+ ],+ "properties": {+ "robots": {+ "type": "string"+ }+ }+ },+ "schema.SiteSeoResp": {+ "type": "object",+ "required": [+ "robots"+ ],+ "properties": {+ "robots": {+ "type": "string"+ }+ }+ },"schema.SiteWriteReq": {"type": "object","properties": {@@ -6617,7 +6802,11 @@"properties": {"avatar": {"description": "avatar",- "$ref": "#/definitions/schema.AvatarInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.AvatarInfo"+ }+ ]},"bio": {"description": "bio",@@ -6812,6 +7001,10 @@"description": "display_name","type": "string"},+ "id": {+ "description": "user_id",+ "type": "string"+ },"ip_info": {"description": "ip info","type": "string"diff --git a/docs/swagger.yaml b/docs/swagger.yamlindex 58aec495..d68df764 100644--- a/docs/swagger.yaml+++ b/docs/swagger.yaml@@ -1,11 +1,4 @@definitions:- entity.AdminSetAnswerStatusRequest:- properties:- answer_id:- type: string- status:- type: string- type: objecthandler.RespBody:properties:code:@@ -95,6 +88,8 @@ definitions:type: stringdisplay_name:type: string+ main_tag_slug_name:+ type: stringobject_type:type: stringquestion_id:@@ -118,6 +113,8 @@ definitions:type: stringcreated_at:type: integer+ id:+ type: stringobject_id:type: stringobject_type:@@ -179,6 +176,13 @@ definitions:- object_id- report_typetype: object+ schema.AdminSetAnswerStatusRequest:+ properties:+ answer_id:+ type: string+ status:+ type: string+ type: objectschema.AdminSetQuestionStatusRequest:properties:question_id:@@ -203,7 +207,6 @@ definitions:answer_id:type: stringquestion_id:- description: question_idtype: stringtype: objectschema.AnswerUpdateReq:@@ -1067,6 +1070,11 @@ definitions:required:- tag_idtype: object+ schema.ReopenQuestionReq:+ properties:+ question_id:+ type: string+ type: objectschema.ReportHandleReq:properties:flagged_content:@@ -1128,7 +1136,8 @@ definitions:title:type: stringuser_info:- $ref: '#/definitions/schema.UserBasicInfo'+ allOf:+ - $ref: '#/definitions/schema.UserBasicInfo'description: user infovote_count:type: integer@@ -1136,7 +1145,8 @@ definitions:schema.SearchResp:properties:object:- $ref: '#/definitions/schema.SearchObject'+ allOf:+ - $ref: '#/definitions/schema.SearchObject'description: this objectobject_type:description: object_type@@ -1189,6 +1199,10 @@ definitions:name:maxLength: 128type: string+ permalink:+ maximum: 3+ minimum: 0+ type: integershort_description:maxLength: 255type: string@@ -1198,6 +1212,7 @@ definitions:required:- contact_email- name+ - permalink- site_urltype: objectschema.SiteGeneralResp:@@ -1211,6 +1226,10 @@ definitions:name:maxLength: 128type: string+ permalink:+ maximum: 3+ minimum: 0+ type: integershort_description:maxLength: 255type: string@@ -1220,6 +1239,7 @@ definitions:required:- contact_email- name+ - permalink- site_urltype: objectschema.SiteInterfaceReq:@@ -1276,6 +1296,20 @@ definitions:terms_of_service_parsed_text:type: stringtype: object+ schema.SiteSeoReq:+ properties:+ robots:+ type: string+ required:+ - robots+ type: object+ schema.SiteSeoResp:+ properties:+ robots:+ type: string+ required:+ - robots+ type: objectschema.SiteWriteReq:properties:recommend_tags:@@ -1390,7 +1424,8 @@ definitions:schema.UpdateInfoRequest:properties:avatar:- $ref: '#/definitions/schema.AvatarInfo'+ allOf:+ - $ref: '#/definitions/schema.AvatarInfo'description: avatarbio:description: bio@@ -1535,6 +1570,9 @@ definitions:display_name:description: display_nametype: string+ id:+ description: user_id+ type: stringip_info:description: ip infotype: string@@ -1749,7 +1787,7 @@ paths:name: datarequired: trueschema:- $ref: '#/definitions/entity.AdminSetAnswerStatusRequest'+ $ref: '#/definitions/schema.AdminSetAnswerStatusRequest'produces:- application/jsonresponses:@@ -2187,6 +2225,47 @@ paths:summary: update site legal infotags:- admin+ /answer/admin/api/siteinfo/seo:+ get:+ description: get site seo information+ produces:+ - application/json+ responses:+ "200":+ description: OK+ schema:+ allOf:+ - $ref: '#/definitions/handler.RespBody'+ - properties:+ data:+ $ref: '#/definitions/schema.SiteSeoResp'+ type: object+ security:+ - ApiKeyAuth: []+ summary: get site seo information+ tags:+ - admin+ put:+ description: update site seo information+ parameters:+ - description: seo+ in: body+ name: data+ required: true+ schema:+ $ref: '#/definitions/schema.SiteSeoReq'+ produces:+ - application/json+ responses:+ "200":+ description: OK+ schema:+ $ref: '#/definitions/handler.RespBody'+ security:+ - ApiKeyAuth: []+ summary: update site seo information+ tags:+ - admin/answer/admin/api/siteinfo/write:get:description: get site interface@@ -3354,6 +3433,30 @@ paths:summary: SearchQuestionListtags:- api-question+ /answer/api/v1/question/reopen:+ put:+ consumes:+ - application/json+ description: reopen question+ parameters:+ - description: question+ in: body+ name: data+ required: true+ schema:+ $ref: '#/definitions/schema.ReopenQuestionReq'+ produces:+ - application/json+ responses:+ "200":+ description: OK+ schema:+ $ref: '#/definitions/handler.RespBody'+ security:+ - ApiKeyAuth: []+ summary: reopen question+ tags:+ - api-question/answer/api/v1/question/search:post:consumes:@@ -4528,6 +4631,19 @@ paths:summary: UserListtags:- api-question+ /robots.txt:+ get:+ description: get site robots information+ produces:+ - application/json+ responses:+ "200":+ description: OK+ schema:+ type: string+ summary: get site robots information+ tags:+ - sitesecurityDefinitions:ApiKeyAuth:in: headerdiff --git a/internal/controller/answer_controller.go b/internal/controller/answer_controller.goindex d089d509..d3d1c478 100644--- a/internal/controller/answer_controller.go+++ b/internal/controller/answer_controller.go@@ -268,7 +268,7 @@ func (ac *AnswerController) Adopted(ctx *gin.Context) {// @Accept json// @Produce json// @Security ApiKeyAuth-// @Param data body entity.AdminSetAnswerStatusRequest true "AdminSetAnswerStatusRequest"+// @Param data body schema.AdminSetAnswerStatusRequest true "AdminSetAnswerStatusRequest"// @Router /answer/admin/api/answer/status [put]// @Success 200 {object} handler.RespBodyfunc (ac *AnswerController) AdminSetAnswerStatus(ctx *gin.Context) {