Move some functions to service layer (#26969)

This commit is contained in:
Lunny Xiao 2023-09-09 05:09:23 +08:00 committed by GitHub
parent b8ad558c93
commit e3ed67859a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 733 additions and 748 deletions

View file

@ -8,7 +8,6 @@ import (
"errors"
"net/http"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/perm"
access_model "code.gitea.io/gitea/models/perm/access"
repo_model "code.gitea.io/gitea/models/repo"
@ -19,6 +18,7 @@ import (
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/api/v1/utils"
"code.gitea.io/gitea/services/convert"
repo_service "code.gitea.io/gitea/services/repository"
)
// ListCollaborators list a repository's collaborators
@ -228,7 +228,7 @@ func DeleteCollaborator(ctx *context.APIContext) {
return
}
if err := models.DeleteCollaboration(ctx.Repo.Repository, collaborator.ID); err != nil {
if err := repo_service.DeleteCollaboration(ctx.Repo.Repository, collaborator.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteCollaboration", err)
return
}