aboutsummaryrefslogtreecommitdiffstats
path: root/models/organization/team_repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-12-17 19:44:16 -0800
committerGitHub <noreply@github.com>2024-12-18 11:44:16 +0800
commite4c4629465f4e45ffdb9ef5eff6ef17e15ee4c2d (patch)
tree14ac77bb922dfdb9883630f6b2769973becb6f7e /models/organization/team_repo.go
parentb9457422934f33a37e0285d100007aae12e87ff7 (diff)
downloadgitea-e4c4629465f4e45ffdb9ef5eff6ef17e15ee4c2d.tar.gz
gitea-e4c4629465f4e45ffdb9ef5eff6ef17e15ee4c2d.zip
Move RepoTransfer from models to models/repo sub package (#32506)
`RepoTransfer` now is at models, but if we want to move it into `repo` model, it will depend on `Team`. So this PR also makes repo model depend on org model to make it possible. Just refactor, no code change. - [x] Move `DeleteOrganization` from `models/organization` to service layer - [x] Move `AccessibleTeamReposEnv` to `models/repo` - [x] Move `RepoTransfer` from `models` to `models/repo` - [x] Merge `getUserTeamIDs` and `GetUserTeamIDs`, Merge `GetUserTeams` and `getUserTeams`. - [x] Remove `Team`'s `Repos []*repo_model.Repository` to avoid dependency recycle.
Diffstat (limited to 'models/organization/team_repo.go')
-rw-r--r--models/organization/team_repo.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/models/organization/team_repo.go b/models/organization/team_repo.go
index c90dfdeda0..53edd203a8 100644
--- a/models/organization/team_repo.go
+++ b/models/organization/team_repo.go
@@ -8,10 +8,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/perm"
- repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
-
- "xorm.io/builder"
)
// TeamRepo represents an team-repository relation.
@@ -32,29 +29,6 @@ func HasTeamRepo(ctx context.Context, orgID, teamID, repoID int64) bool {
return has
}
-type SearchTeamRepoOptions struct {
- db.ListOptions
- TeamID int64
-}
-
-// GetRepositories returns paginated repositories in team of organization.
-func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (repo_model.RepositoryList, error) {
- sess := db.GetEngine(ctx)
- if opts.TeamID > 0 {
- sess = sess.In("id",
- builder.Select("repo_id").
- From("team_repo").
- Where(builder.Eq{"team_id": opts.TeamID}),
- )
- }
- if opts.PageSize > 0 {
- sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
- }
- var repos []*repo_model.Repository
- return repos, sess.OrderBy("repository.name").
- Find(&repos)
-}
-
// AddTeamRepo adds a repo for an organization's team
func AddTeamRepo(ctx context.Context, orgID, teamID, repoID int64) error {
_, err := db.GetEngine(ctx).Insert(&TeamRepo{