1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Second part of refactor db.Find (#28194)

Continue of #27798 and move more functions to `db.Find` and `db.Count`.
This commit is contained in:
Lunny Xiao
2023-12-11 16:56:48 +08:00
committed by GitHub
parent 0abb5633e3
commit 537fa69962
14 changed files with 149 additions and 222 deletions

View File

@@ -212,13 +212,26 @@ func Milestones(ctx *context.Context) {
}
}
counts, err := issues_model.CountMilestonesByRepoCondAndKw(ctx, userRepoCond, keyword, isShowClosed)
counts, err := issues_model.CountMilestonesMap(ctx, issues_model.FindMilestoneOptions{
RepoCond: userRepoCond,
Name: keyword,
IsClosed: util.OptionalBoolOf(isShowClosed),
})
if err != nil {
ctx.ServerError("CountMilestonesByRepoIDs", err)
return
}
milestones, err := issues_model.SearchMilestones(ctx, repoCond, page, isShowClosed, sortType, keyword)
milestones, err := db.Find[issues_model.Milestone](ctx, issues_model.FindMilestoneOptions{
ListOptions: db.ListOptions{
Page: page,
PageSize: setting.UI.IssuePagingNum,
},
RepoCond: repoCond,
IsClosed: util.OptionalBoolOf(isShowClosed),
SortType: sortType,
Name: keyword,
})
if err != nil {
ctx.ServerError("SearchMilestones", err)
return