1
Fork 0

move repository deletion to service layer (#26948)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Lunny Xiao 2023-09-08 12:51:15 +08:00 committed by GitHub
parent 3c0c279658
commit 4f32abaf94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 567 additions and 476 deletions

View file

@ -23,6 +23,7 @@ import (
"code.gitea.io/gitea/routers/api/v1/utils"
"code.gitea.io/gitea/services/convert"
org_service "code.gitea.io/gitea/services/org"
repo_service "code.gitea.io/gitea/services/repository"
)
// ListTeams list all the teams of an organization
@ -726,7 +727,7 @@ func RemoveTeamRepository(ctx *context.APIContext) {
ctx.Error(http.StatusForbidden, "", "Must have admin-level access to the repository")
return
}
if err := models.RemoveRepository(ctx.Org.Team, repo.ID); err != nil {
if err := repo_service.RemoveRepositoryFromTeam(ctx, ctx.Org.Team, repo.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "RemoveRepository", err)
return
}