aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/shared
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/shared')
-rw-r--r--routers/web/shared/actions/runners.go18
-rw-r--r--routers/web/shared/actions/variables.go2
-rw-r--r--routers/web/shared/secrets/secrets.go3
-rw-r--r--routers/web/shared/user/header.go4
4 files changed, 9 insertions, 18 deletions
diff --git a/routers/web/shared/actions/runners.go b/routers/web/shared/actions/runners.go
index 1da4ddf14f..ae9a376724 100644
--- a/routers/web/shared/actions/runners.go
+++ b/routers/web/shared/actions/runners.go
@@ -17,18 +17,13 @@ import (
// RunnersList prepares data for runners list
func RunnersList(ctx *context.Context, opts actions_model.FindRunnerOptions) {
- count, err := actions_model.CountRunners(ctx, opts)
+ runners, count, err := db.FindAndCount[actions_model.ActionRunner](ctx, opts)
if err != nil {
ctx.ServerError("CountRunners", err)
return
}
- runners, err := actions_model.FindRunners(ctx, opts)
- if err != nil {
- ctx.ServerError("FindRunners", err)
- return
- }
- if err := runners.LoadAttributes(ctx); err != nil {
+ if err := actions_model.RunnerList(runners).LoadAttributes(ctx); err != nil {
ctx.ServerError("LoadAttributes", err)
return
}
@@ -89,18 +84,13 @@ func RunnerDetails(ctx *context.Context, page int, runnerID, ownerID, repoID int
RunnerID: runner.ID,
}
- count, err := actions_model.CountTasks(ctx, opts)
+ tasks, count, err := db.FindAndCount[actions_model.ActionTask](ctx, opts)
if err != nil {
ctx.ServerError("CountTasks", err)
return
}
- tasks, err := actions_model.FindTasks(ctx, opts)
- if err != nil {
- ctx.ServerError("FindTasks", err)
- return
- }
- if err = tasks.LoadAttributes(ctx); err != nil {
+ if err = actions_model.TaskList(tasks).LoadAttributes(ctx); err != nil {
ctx.ServerError("TasksLoadAttributes", err)
return
}
diff --git a/routers/web/shared/actions/variables.go b/routers/web/shared/actions/variables.go
index 341c18f589..07a0575207 100644
--- a/routers/web/shared/actions/variables.go
+++ b/routers/web/shared/actions/variables.go
@@ -18,7 +18,7 @@ import (
)
func SetVariablesContext(ctx *context.Context, ownerID, repoID int64) {
- variables, err := actions_model.FindVariables(ctx, actions_model.FindVariablesOpts{
+ variables, err := db.Find[actions_model.ActionVariable](ctx, actions_model.FindVariablesOpts{
OwnerID: ownerID,
RepoID: repoID,
})
diff --git a/routers/web/shared/secrets/secrets.go b/routers/web/shared/secrets/secrets.go
index 875cb0cfec..c805da734a 100644
--- a/routers/web/shared/secrets/secrets.go
+++ b/routers/web/shared/secrets/secrets.go
@@ -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
diff --git a/routers/web/shared/user/header.go b/routers/web/shared/user/header.go
index 998a0c896b..411d499eb4 100644
--- a/routers/web/shared/user/header.go
+++ b/routers/web/shared/user/header.go
@@ -60,7 +60,7 @@ func PrepareContextForProfileBigAvatar(ctx *context.Context) {
}
showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
- orgs, err := organization.FindOrgs(ctx, organization.FindOrgOptions{
+ orgs, err := db.Find[organization.Organization](ctx, organization.FindOrgOptions{
UserID: ctx.ContextUser.ID,
IncludePrivate: showPrivate,
})
@@ -141,7 +141,7 @@ func LoadHeaderCount(ctx *context.Context) error {
} else {
projectType = project_model.TypeIndividual
}
- projectCount, err := project_model.CountProjects(ctx, project_model.SearchOptions{
+ projectCount, err := db.Count[project_model.Project](ctx, project_model.SearchOptions{
OwnerID: ctx.ContextUser.ID,
IsClosed: util.OptionalBoolOf(false),
Type: projectType,