Merge branch 'feat/1.0.6/object-not-found' into test

This commit is contained in:
LinkinStars 2023-03-06 12:27:32 +08:00
commit 7dd3715ff3
2 changed files with 2 additions and 1 deletions

View File

@ -207,7 +207,7 @@ func (ar *answerRepo) SearchList(ctx context.Context, search *entity.AnswerSearc
session = session.OrderBy("adopted desc,vote_count desc,created_at asc")
}
if !search.IncludeDeleted {
session = session.And("status = ? OR user_id = ?", entity.AnswerStatusAvailable, search.UserID)
session = session.And("status = ? OR user_id = ?", entity.AnswerStatusAvailable, search.LoginUserID)
}
session = session.Limit(search.PageSize, offset)

View File

@ -479,6 +479,7 @@ func (as *AnswerService) SearchList(ctx context.Context, req *schema.AnswerListR
dbSearch.PageSize = req.PageSize
dbSearch.Order = req.Order
dbSearch.IncludeDeleted = req.CanDelete
dbSearch.LoginUserID = req.UserID
answerOriginalList, count, err := as.answerRepo.SearchList(ctx, &dbSearch)
if err != nil {
return list, count, err