Move some files into models' sub packages (#20262)

* Move some files into models' sub packages

* Move functions

* merge main branch

* Fix check

* fix check

* Fix some tests

* Fix lint

* Fix lint

* Revert lint changes

* Fix error comments

* Fix lint

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
Lunny Xiao 2022-08-25 10:31:57 +08:00 committed by GitHub
parent 4a4bfafa23
commit 1d8543e7db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
154 changed files with 1763 additions and 1738 deletions

View file

@ -25,7 +25,7 @@ import (
)
// CreateRepository creates a repository for the user/organization.
func CreateRepository(doer, owner *user_model.User, opts models.CreateRepoOptions) (*repo_model.Repository, error) {
func CreateRepository(doer, owner *user_model.User, opts repo_module.CreateRepoOptions) (*repo_model.Repository, error) {
repo, err := repo_module.CreateRepository(doer, owner, opts)
if err != nil {
// No need to rollback here we should do this in CreateRepository...
@ -69,7 +69,7 @@ func PushCreateRepo(authUser, owner *user_model.User, repoName string) (*repo_mo
}
}
repo, err := CreateRepository(authUser, owner, models.CreateRepoOptions{
repo, err := CreateRepository(authUser, owner, repo_module.CreateRepoOptions{
Name: repoName,
IsPrivate: setting.Repository.DefaultPushCreatePrivate,
})
@ -117,7 +117,7 @@ func LinkedRepository(a *repo_model.Attachment) (*repo_model.Repository, unit.Ty
}
return repo, unitType, err
} else if a.ReleaseID != 0 {
rel, err := models.GetReleaseByID(db.DefaultContext, a.ReleaseID)
rel, err := repo_model.GetReleaseByID(db.DefaultContext, a.ReleaseID)
if err != nil {
return nil, unit.TypeReleases, err
}