Skip to content

Commit 96c0baa

Browse files
committed
update answer
1 parent 74c473d commit 96c0baa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

internal/service/answer_service.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,14 @@ func (as *AnswerService) RemoveAnswer(ctx context.Context, req *schema.RemoveAns
9292
if answerInfo.Accepted == schema.AnswerAcceptedEnable {
9393
return errors.BadRequest(reason.AnswerCannotDeleted)
9494
}
95-
questionInfo, exist, err := as.questionRepo.GetQuestion(ctx, answerInfo.QuestionID)
95+
_, exist, err := as.questionRepo.GetQuestion(ctx, answerInfo.QuestionID)
9696
if err != nil {
9797
return errors.BadRequest(reason.AnswerCannotDeleted)
9898
}
9999
if !exist {
100100
return errors.BadRequest(reason.AnswerCannotDeleted)
101101
}
102-
if questionInfo.AcceptedAnswerID != "" {
103-
return errors.BadRequest(reason.AnswerCannotDeleted)
104-
}
102+
105103
}
106104

107105
// user add question count

0 commit comments

Comments
 (0)