1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Move team related functions to service layer (#32537)

There are still some functions under `models` after last big refactor
about `models`. This change will move all team related functions to
service layer with no code change.
This commit is contained in:
Lunny Xiao
2024-11-27 13:12:26 -08:00
committed by GitHub
parent 5a50b271e7
commit f62f68cbdd
26 changed files with 452 additions and 483 deletions

View File

@@ -10,7 +10,6 @@ import (
"code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/services/context"
"code.gitea.io/gitea/services/convert"
org_service "code.gitea.io/gitea/services/org"
repo_service "code.gitea.io/gitea/services/repository"
)
@@ -205,7 +204,7 @@ func changeRepoTeam(ctx *context.APIContext, add bool) {
ctx.Error(http.StatusUnprocessableEntity, "alreadyAdded", fmt.Errorf("team '%s' is already added to repo", team.Name))
return
}
err = org_service.TeamAddRepository(ctx, team, ctx.Repo.Repository)
err = repo_service.TeamAddRepository(ctx, team, ctx.Repo.Repository)
} else {
if !repoHasTeam {
ctx.Error(http.StatusUnprocessableEntity, "notAdded", fmt.Errorf("team '%s' was not added to repo", team.Name))