Merge branch 'feat/0.5.0/timeline_ai' of git.backyard.segmentfault.com:opensource/answer into feat/0.5.0/timeline_ai

This commit is contained in:
aichy126 2022-12-01 18:36:26 +08:00
commit a27b0013d5
4 changed files with 10 additions and 16 deletions

View File

@ -179,21 +179,12 @@ func (ac *AnswerController) Update(ctx *gin.Context) {
handler.HandleResponse(ctx, err, nil)
return
}
info, questionInfo, has, err := ac.answerService.Get(ctx, req.ID, req.UserID)
_, _, _, err = ac.answerService.Get(ctx, req.ID, req.UserID)
if err != nil {
handler.HandleResponse(ctx, err, nil)
return
}
if !has {
// todo !has
handler.HandleResponse(ctx, nil, nil)
return
}
handler.HandleResponse(ctx, nil, &schema.AnswerUpdateResp{
AnswerInfo: info,
QuestionInfo: questionInfo,
WaitForReview: !req.NoNeedReview,
})
handler.HandleResponse(ctx, nil, &schema.AnswerUpdateResp{WaitForReview: !req.NoNeedReview})
}
// AnswerList godoc

View File

@ -266,8 +266,8 @@ func (qc *QuestionController) UpdateQuestion(ctx *gin.Context) {
return
}
resp, err := qc.questionService.UpdateQuestion(ctx, req)
handler.HandleResponse(ctx, err, resp)
_, err = qc.questionService.UpdateQuestion(ctx, req)
handler.HandleResponse(ctx, err, &schema.UpdateQuestionResp{WaitForReview: !req.NoNeedReview})
}
// CloseMsgList close question msg list

View File

@ -36,9 +36,7 @@ type AnswerUpdateReq struct {
// AnswerUpdateResp answer update resp
type AnswerUpdateResp struct {
AnswerInfo *AnswerInfo `json:"info"`
QuestionInfo *QuestionInfo `json:"question"`
WaitForReview bool `json:"wait_for_review"`
WaitForReview bool `json:"wait_for_review"`
}
type AnswerListReq struct {

View File

@ -120,6 +120,11 @@ type QuestionInfo struct {
MemberActions []*PermissionMemberAction `json:"member_actions"`
}
// UpdateQuestionResp update question resp
type UpdateQuestionResp struct {
WaitForReview bool `json:"wait_for_review"`
}
type AdminQuestionInfo struct {
ID string `json:"id"`
Title string `json:"title"`