summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/migrate.go4
-rw-r--r--routers/api/v1/repo/teams.go8
2 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/v1/repo/migrate.go b/routers/api/v1/repo/migrate.go
index 41374831de..4ddd452372 100644
--- a/routers/api/v1/repo/migrate.go
+++ b/routers/api/v1/repo/migrate.go
@@ -170,7 +170,7 @@ func Migrate(ctx *context.APIContext) {
opts.Releases = false
}
- repo, err := repo_service.CreateRepositoryDirectly(ctx.Doer, repoOwner, repo_service.CreateRepoOptions{
+ repo, err := repo_service.CreateRepositoryDirectly(ctx, ctx.Doer, repoOwner, repo_service.CreateRepoOptions{
Name: opts.RepoName,
Description: opts.Description,
OriginalURL: form.CloneAddr,
@@ -200,7 +200,7 @@ func Migrate(ctx *context.APIContext) {
}
if repo != nil {
- if errDelete := models.DeleteRepository(ctx.Doer, repoOwner.ID, repo.ID); errDelete != nil {
+ if errDelete := repo_service.DeleteRepositoryDirectly(ctx, ctx.Doer, repoOwner.ID, repo.ID); errDelete != nil {
log.Error("DeleteRepository: %v", errDelete)
}
}
diff --git a/routers/api/v1/repo/teams.go b/routers/api/v1/repo/teams.go
index 01292f18d8..d1be619cac 100644
--- a/routers/api/v1/repo/teams.go
+++ b/routers/api/v1/repo/teams.go
@@ -7,11 +7,11 @@ import (
"fmt"
"net/http"
- "code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/services/convert"
org_service "code.gitea.io/gitea/services/org"
+ repo_service "code.gitea.io/gitea/services/repository"
)
// ListTeams list a repository's teams
@@ -97,7 +97,7 @@ func IsTeam(ctx *context.APIContext) {
return
}
- if models.HasRepository(team, ctx.Repo.Repository.ID) {
+ if repo_service.HasRepository(team, ctx.Repo.Repository.ID) {
apiTeam, err := convert.ToTeam(ctx, team)
if err != nil {
ctx.InternalServerError(err)
@@ -192,7 +192,7 @@ func changeRepoTeam(ctx *context.APIContext, add bool) {
return
}
- repoHasTeam := models.HasRepository(team, ctx.Repo.Repository.ID)
+ repoHasTeam := repo_service.HasRepository(team, ctx.Repo.Repository.ID)
var err error
if add {
if repoHasTeam {
@@ -205,7 +205,7 @@ func changeRepoTeam(ctx *context.APIContext, add bool) {
ctx.Error(http.StatusUnprocessableEntity, "notAdded", fmt.Errorf("team '%s' was not added to repo", team.Name))
return
}
- err = models.RemoveRepository(team, ctx.Repo.Repository.ID)
+ err = repo_service.RemoveRepositoryFromTeam(ctx, team, ctx.Repo.Repository.ID)
}
if err != nil {
ctx.InternalServerError(err)