summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/asymkey/sign.go20
-rw-r--r--services/convert/repository.go7
-rw-r--r--services/migrations/gitea_uploader_test.go6
-rw-r--r--services/repository/archiver/archiver.go2
-rw-r--r--services/repository/push.go7
-rw-r--r--services/user/delete.go4
6 files changed, 35 insertions, 11 deletions
diff --git a/services/asymkey/sign.go b/services/asymkey/sign.go
index 1598f32165..0c4aac8156 100644
--- a/services/asymkey/sign.go
+++ b/services/asymkey/sign.go
@@ -143,7 +143,10 @@ Loop:
case always:
break Loop
case pubkey:
- keys, err := asymkey_model.ListGPGKeys(ctx, u.ID, db.ListOptions{})
+ keys, err := db.Find[asymkey_model.GPGKey](ctx, asymkey_model.FindGPGKeyOptions{
+ OwnerID: u.ID,
+ IncludeSubKeys: true,
+ })
if err != nil {
return false, "", nil, err
}
@@ -179,7 +182,10 @@ Loop:
case always:
break Loop
case pubkey:
- keys, err := asymkey_model.ListGPGKeys(ctx, u.ID, db.ListOptions{})
+ keys, err := db.Find[asymkey_model.GPGKey](ctx, asymkey_model.FindGPGKeyOptions{
+ OwnerID: u.ID,
+ IncludeSubKeys: true,
+ })
if err != nil {
return false, "", nil, err
}
@@ -232,7 +238,10 @@ Loop:
case always:
break Loop
case pubkey:
- keys, err := asymkey_model.ListGPGKeys(ctx, u.ID, db.ListOptions{})
+ keys, err := db.Find[asymkey_model.GPGKey](ctx, asymkey_model.FindGPGKeyOptions{
+ OwnerID: u.ID,
+ IncludeSubKeys: true,
+ })
if err != nil {
return false, "", nil, err
}
@@ -294,7 +303,10 @@ Loop:
case always:
break Loop
case pubkey:
- keys, err := asymkey_model.ListGPGKeys(ctx, u.ID, db.ListOptions{})
+ keys, err := db.Find[asymkey_model.GPGKey](ctx, asymkey_model.FindGPGKeyOptions{
+ OwnerID: u.ID,
+ IncludeSubKeys: true,
+ })
if err != nil {
return false, "", nil, err
}
diff --git a/services/convert/repository.go b/services/convert/repository.go
index 71038cd062..c16180c0af 100644
--- a/services/convert/repository.go
+++ b/services/convert/repository.go
@@ -8,6 +8,7 @@ import (
"time"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/perm"
access_model "code.gitea.io/gitea/models/perm/access"
repo_model "code.gitea.io/gitea/models/repo"
@@ -133,7 +134,11 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
return nil
}
- numReleases, _ := repo_model.GetReleaseCountByRepoID(ctx, repo.ID, repo_model.FindReleasesOptions{IncludeDrafts: false, IncludeTags: false})
+ numReleases, _ := db.Count[repo_model.Release](ctx, repo_model.FindReleasesOptions{
+ IncludeDrafts: false,
+ IncludeTags: false,
+ RepoID: repo.ID,
+ })
mirrorInterval := ""
var mirrorUpdated time.Time
diff --git a/services/migrations/gitea_uploader_test.go b/services/migrations/gitea_uploader_test.go
index 3dec3a26fc..4ec0361dfb 100644
--- a/services/migrations/gitea_uploader_test.go
+++ b/services/migrations/gitea_uploader_test.go
@@ -83,22 +83,24 @@ func TestGiteaUploadRepo(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, labels, 12)
- releases, err := repo_model.GetReleasesByRepoID(db.DefaultContext, repo.ID, repo_model.FindReleasesOptions{
+ releases, err := db.Find[repo_model.Release](db.DefaultContext, repo_model.FindReleasesOptions{
ListOptions: db.ListOptions{
PageSize: 10,
Page: 0,
},
IncludeTags: true,
+ RepoID: repo.ID,
})
assert.NoError(t, err)
assert.Len(t, releases, 8)
- releases, err = repo_model.GetReleasesByRepoID(db.DefaultContext, repo.ID, repo_model.FindReleasesOptions{
+ releases, err = db.Find[repo_model.Release](db.DefaultContext, repo_model.FindReleasesOptions{
ListOptions: db.ListOptions{
PageSize: 10,
Page: 0,
},
IncludeTags: false,
+ RepoID: repo.ID,
})
assert.NoError(t, err)
assert.Len(t, releases, 1)
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 {
diff --git a/services/user/delete.go b/services/user/delete.go
index 748f5c2d1e..0e9c866171 100644
--- a/services/user/delete.go
+++ b/services/user/delete.go
@@ -159,7 +159,9 @@ func deleteUser(ctx context.Context, u *user_model.User, purge bool) (err error)
// ***** END: PublicKey *****
// ***** START: GPGPublicKey *****
- keys, err := asymkey_model.ListGPGKeys(ctx, u.ID, db.ListOptions{})
+ keys, err := db.Find[asymkey_model.GPGKey](ctx, asymkey_model.FindGPGKeyOptions{
+ OwnerID: u.ID,
+ })
if err != nil {
return fmt.Errorf("ListGPGKeys: %w", err)
}