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.
update question answer del
aichy126ba7891b0979c
diff --git a/docs/docs.go b/docs/docs.goindex 1dedea4d..fc2a989a 100644--- a/docs/docs.go+++ b/docs/docs.go@@ -1,5 +1,4 @@-// Package docs GENERATED BY SWAG; DO NOT EDIT-// This file was generated by swaggo/swag+// Code generated by swaggo/swag. DO NOT EDITpackage docsimport "github.com/swaggo/swag"@@ -5984,9 +5983,6 @@ const docTemplate = `{"schema.GetOtherUserInfoResp": {"type": "object","properties": {- "has": {- "type": "boolean"- },"info": {"$ref": "#/definitions/schema.GetOtherUserInfoByUsernameResp"}@@ -6986,7 +6982,11 @@ const docTemplate = `{},"user_info": {"description": "user info",- "$ref": "#/definitions/schema.UserBasicInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.UserBasicInfo"+ }+ ]},"vote_count": {"type": "integer"@@ -6998,7 +6998,11 @@ const docTemplate = `{"properties": {"object": {"description": "this object",- "$ref": "#/definitions/schema.SearchObject"+ "allOf": [+ {+ "$ref": "#/definitions/schema.SearchObject"+ }+ ]},"object_type": {"description": "object_type",@@ -7173,6 +7177,9 @@ const docTemplate = `{},"theme": {"$ref": "#/definitions/schema.SiteThemeResp"+ },+ "version": {+ "type": "string"}}},@@ -7508,7 +7515,11 @@ const docTemplate = `{"properties": {"avatar": {"description": "avatar",- "$ref": "#/definitions/schema.AvatarInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.AvatarInfo"+ }+ ]},"bio": {"description": "bio",diff --git a/docs/swagger.json b/docs/swagger.jsonindex ca8d737d..3452fa23 100644--- a/docs/swagger.json+++ b/docs/swagger.json@@ -5972,9 +5972,6 @@"schema.GetOtherUserInfoResp": {"type": "object","properties": {- "has": {- "type": "boolean"- },"info": {"$ref": "#/definitions/schema.GetOtherUserInfoByUsernameResp"}@@ -6974,7 +6971,11 @@},"user_info": {"description": "user info",- "$ref": "#/definitions/schema.UserBasicInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.UserBasicInfo"+ }+ ]},"vote_count": {"type": "integer"@@ -6986,7 +6987,11 @@"properties": {"object": {"description": "this object",- "$ref": "#/definitions/schema.SearchObject"+ "allOf": [+ {+ "$ref": "#/definitions/schema.SearchObject"+ }+ ]},"object_type": {"description": "object_type",@@ -7161,6 +7166,9 @@},"theme": {"$ref": "#/definitions/schema.SiteThemeResp"+ },+ "version": {+ "type": "string"}}},@@ -7496,7 +7504,11 @@"properties": {"avatar": {"description": "avatar",- "$ref": "#/definitions/schema.AvatarInfo"+ "allOf": [+ {+ "$ref": "#/definitions/schema.AvatarInfo"+ }+ ]},"bio": {"description": "bio",diff --git a/docs/swagger.yaml b/docs/swagger.yamlindex da69a617..77f6b495 100644--- a/docs/swagger.yaml+++ b/docs/swagger.yaml@@ -488,8 +488,6 @@ definitions:type: objectschema.GetOtherUserInfoResp:properties:- has:- type: booleaninfo:$ref: '#/definitions/schema.GetOtherUserInfoByUsernameResp'type: object@@ -1201,7 +1199,8 @@ definitions:title:type: stringuser_info:- $ref: '#/definitions/schema.UserBasicInfo'+ allOf:+ - $ref: '#/definitions/schema.UserBasicInfo'description: user infovote_count:type: integer@@ -1209,7 +1208,8 @@ definitions:schema.SearchResp:properties:object:- $ref: '#/definitions/schema.SearchObject'+ allOf:+ - $ref: '#/definitions/schema.SearchObject'description: this objectobject_type:description: object_type@@ -1335,6 +1335,8 @@ definitions:$ref: '#/definitions/schema.SiteSeoReq'theme:$ref: '#/definitions/schema.SiteThemeResp'+ version:+ type: stringtype: objectschema.SiteInterfaceReq:properties:@@ -1561,7 +1563,8 @@ definitions:schema.UpdateInfoRequest:properties:avatar:- $ref: '#/definitions/schema.AvatarInfo'+ allOf:+ - $ref: '#/definitions/schema.AvatarInfo'description: avatarbio:description: biodiff --git a/internal/service/answer_service.go b/internal/service/answer_service.goindex d4d49076..1b60ce87 100644--- a/internal/service/answer_service.go+++ b/internal/service/answer_service.go@@ -232,6 +232,11 @@ func (as *AnswerService) Update(ctx context.Context, req *schema.AnswerUpdateReqreturn "", nil}+ if answerInfo.Status == entity.AnswerStatusDeleted {+ err = errors.BadRequest(reason.AnswerCannotUpdate)+ return "", err+ }+//If the content is the same, ignore itif answerInfo.OriginalText == req.Content {return "", nildiff --git a/internal/service/question_service.go b/internal/service/question_service.goindex ccf49454..659a4d55 100644--- a/internal/service/question_service.go+++ b/internal/service/question_service.go@@ -470,6 +470,10 @@ func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.Questif !has {return}+ if dbinfo.Status == entity.QuestionStatusDeleted {+ err = errors.BadRequest(reason.QuestionCannotUpdate)+ return+ }now := time.Now()question := &entity.Question{}