forked from forgejo/forgejo
Use db.Find instead of writing methods for every object (#28084)
For those simple objects, it's unnecessary to write the find and count methods again and again.
This commit is contained in:
parent
d24a8223ce
commit
df1e7d0067
88 changed files with 611 additions and 685 deletions
|
@ -4,6 +4,7 @@
|
|||
package secrets
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/models/db"
|
||||
secret_model "code.gitea.io/gitea/models/secret"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -14,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func SetSecretsContext(ctx *context.Context, ownerID, repoID int64) {
|
||||
secrets, err := secret_model.FindSecrets(ctx, secret_model.FindSecretsOptions{OwnerID: ownerID, RepoID: repoID})
|
||||
secrets, err := db.Find[secret_model.Secret](ctx, secret_model.FindSecretsOptions{OwnerID: ownerID, RepoID: repoID})
|
||||
if err != nil {
|
||||
ctx.ServerError("FindSecrets", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue