mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-21 16:40:52 +00:00
Move unit into models/unit/ (#17576)
* Move unit into models/unit/ * Rename unit.UnitType as unit.Type
This commit is contained in:
parent
b6b1e71665
commit
99b2858e62
68 changed files with 556 additions and 491 deletions
|
@ -22,6 +22,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/login"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -559,7 +560,7 @@ func (u *User) GetRepositories(listOpts db.ListOptions, names ...string) (err er
|
|||
|
||||
// GetRepositoryIDs returns repositories IDs where user owned and has unittypes
|
||||
// Caller shall check that units is not globally disabled
|
||||
func (u *User) GetRepositoryIDs(units ...UnitType) ([]int64, error) {
|
||||
func (u *User) GetRepositoryIDs(units ...unit.Type) ([]int64, error) {
|
||||
var ids []int64
|
||||
|
||||
sess := db.GetEngine(db.DefaultContext).Table("repository").Cols("repository.id")
|
||||
|
@ -574,7 +575,7 @@ func (u *User) GetRepositoryIDs(units ...UnitType) ([]int64, error) {
|
|||
|
||||
// GetActiveRepositoryIDs returns non-archived repositories IDs where user owned and has unittypes
|
||||
// Caller shall check that units is not globally disabled
|
||||
func (u *User) GetActiveRepositoryIDs(units ...UnitType) ([]int64, error) {
|
||||
func (u *User) GetActiveRepositoryIDs(units ...unit.Type) ([]int64, error) {
|
||||
var ids []int64
|
||||
|
||||
sess := db.GetEngine(db.DefaultContext).Table("repository").Cols("repository.id")
|
||||
|
@ -591,7 +592,7 @@ func (u *User) GetActiveRepositoryIDs(units ...UnitType) ([]int64, error) {
|
|||
|
||||
// GetOrgRepositoryIDs returns repositories IDs where user's team owned and has unittypes
|
||||
// Caller shall check that units is not globally disabled
|
||||
func (u *User) GetOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
|
||||
func (u *User) GetOrgRepositoryIDs(units ...unit.Type) ([]int64, error) {
|
||||
var ids []int64
|
||||
|
||||
if err := db.GetEngine(db.DefaultContext).Table("repository").
|
||||
|
@ -612,7 +613,7 @@ func (u *User) GetOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
|
|||
|
||||
// GetActiveOrgRepositoryIDs returns non-archived repositories IDs where user's team owned and has unittypes
|
||||
// Caller shall check that units is not globally disabled
|
||||
func (u *User) GetActiveOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
|
||||
func (u *User) GetActiveOrgRepositoryIDs(units ...unit.Type) ([]int64, error) {
|
||||
var ids []int64
|
||||
|
||||
if err := db.GetEngine(db.DefaultContext).Table("repository").
|
||||
|
@ -634,7 +635,7 @@ func (u *User) GetActiveOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
|
|||
|
||||
// GetAccessRepoIDs returns all repositories IDs where user's or user is a team member organizations
|
||||
// Caller shall check that units is not globally disabled
|
||||
func (u *User) GetAccessRepoIDs(units ...UnitType) ([]int64, error) {
|
||||
func (u *User) GetAccessRepoIDs(units ...unit.Type) ([]int64, error) {
|
||||
ids, err := u.GetRepositoryIDs(units...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -648,7 +649,7 @@ func (u *User) GetAccessRepoIDs(units ...UnitType) ([]int64, error) {
|
|||
|
||||
// GetActiveAccessRepoIDs returns all non-archived repositories IDs where user's or user is a team member organizations
|
||||
// Caller shall check that units is not globally disabled
|
||||
func (u *User) GetActiveAccessRepoIDs(units ...UnitType) ([]int64, error) {
|
||||
func (u *User) GetActiveAccessRepoIDs(units ...unit.Type) ([]int64, error) {
|
||||
ids, err := u.GetActiveRepositoryIDs(units...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue