1
0
Fork 0
forked from forgejo/forgejo

Move createrepository from module to service layer (#26927)

Repository creation depends on many models, so moving it to service
layer is better.
This commit is contained in:
Lunny Xiao 2023-09-06 20:08:51 +08:00 committed by GitHub
parent b3d88ada01
commit b9df9fa2e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 510 additions and 482 deletions

View file

@ -40,8 +40,8 @@ type WebSearchResults struct {
}
// CreateRepository creates a repository for the user/organization.
func CreateRepository(ctx context.Context, doer, owner *user_model.User, opts repo_module.CreateRepoOptions) (*repo_model.Repository, error) {
repo, err := repo_module.CreateRepository(doer, owner, opts)
func CreateRepository(ctx context.Context, doer, owner *user_model.User, opts CreateRepoOptions) (*repo_model.Repository, error) {
repo, err := CreateRepositoryDirectly(doer, owner, opts)
if err != nil {
// No need to rollback here we should do this in CreateRepository...
return nil, err
@ -84,7 +84,7 @@ func PushCreateRepo(ctx context.Context, authUser, owner *user_model.User, repoN
}
}
repo, err := CreateRepository(ctx, authUser, owner, repo_module.CreateRepoOptions{
repo, err := CreateRepository(ctx, authUser, owner, CreateRepoOptions{
Name: repoName,
IsPrivate: setting.Repository.DefaultPushCreatePrivate,
})