aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-01-15 10:19:25 +0800
committerGitHub <noreply@github.com>2024-01-15 02:19:25 +0000
commit70c4aad8e1cbc46b049b015dcd6f2e5be5a69e72 (patch)
tree5c9f049437c1a84a402aeef3be0cb4b95dea667e /services/repository
parente5313248a8ed967a915f072d3991b6d046badf02 (diff)
downloadgitea-70c4aad8e1cbc46b049b015dcd6f2e5be5a69e72.tar.gz
gitea-70c4aad8e1cbc46b049b015dcd6f2e5be5a69e72.zip
Move more functions to db.Find (#28419)
Following #28220 This PR move more functions to use `db.Find`. --------- Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/archiver/archiver.go2
-rw-r--r--services/repository/push.go7
2 files changed, 6 insertions, 3 deletions
diff --git a/services/repository/archiver/archiver.go b/services/repository/archiver/archiver.go
index b73d0eed48..c2ad4d484a 100644
--- a/services/repository/archiver/archiver.go
+++ b/services/repository/archiver/archiver.go
@@ -324,7 +324,7 @@ func DeleteOldRepositoryArchives(ctx context.Context, olderThan time.Duration) e
log.Trace("Doing: ArchiveCleanup")
for {
- archivers, err := repo_model.FindRepoArchives(ctx, repo_model.FindRepoArchiversOption{
+ archivers, err := db.Find[repo_model.RepoArchiver](ctx, repo_model.FindRepoArchiversOption{
ListOptions: db.ListOptions{
PageSize: 100,
Page: 1,
diff --git a/services/repository/push.go b/services/repository/push.go
index 3bc7a78cb9..e86eebde81 100644
--- a/services/repository/push.go
+++ b/services/repository/push.go
@@ -327,9 +327,12 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
lowerTags = append(lowerTags, strings.ToLower(tag))
}
- releases, err := repo_model.GetReleasesByRepoIDAndNames(ctx, repo.ID, lowerTags)
+ releases, err := db.Find[repo_model.Release](ctx, repo_model.FindReleasesOptions{
+ RepoID: repo.ID,
+ TagNames: lowerTags,
+ })
if err != nil {
- return fmt.Errorf("GetReleasesByRepoIDAndNames: %w", err)
+ return fmt.Errorf("db.Find[repo_model.Release]: %w", err)
}
relMap := make(map[string]*repo_model.Release)
for _, rel := range releases {