mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-02 23:41:05 +00:00 
			
		
		
		
	- Massive replacement of changing `code.gitea.io/gitea` to `forgejo.org`. - Resolves forgejo/discussions#258 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7337 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: Beowulf <beowulf@beocode.eu> Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			736 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			736 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2022 The Gitea Authors. All rights reserved.
 | 
						|
// SPDX-License-Identifier: MIT
 | 
						|
 | 
						|
package organization
 | 
						|
 | 
						|
import (
 | 
						|
	"context"
 | 
						|
 | 
						|
	"forgejo.org/models/db"
 | 
						|
	"forgejo.org/models/perm"
 | 
						|
	"forgejo.org/models/unit"
 | 
						|
)
 | 
						|
 | 
						|
// TeamUnit describes all units of a repository
 | 
						|
type TeamUnit struct {
 | 
						|
	ID         int64     `xorm:"pk autoincr"`
 | 
						|
	OrgID      int64     `xorm:"INDEX"`
 | 
						|
	TeamID     int64     `xorm:"UNIQUE(s)"`
 | 
						|
	Type       unit.Type `xorm:"UNIQUE(s)"`
 | 
						|
	AccessMode perm.AccessMode
 | 
						|
}
 | 
						|
 | 
						|
// Unit returns Unit
 | 
						|
func (t *TeamUnit) Unit() unit.Unit {
 | 
						|
	return unit.Units[t.Type]
 | 
						|
}
 | 
						|
 | 
						|
func getUnitsByTeamID(ctx context.Context, teamID int64) (units []*TeamUnit, err error) {
 | 
						|
	return units, db.GetEngine(ctx).Where("team_id = ?", teamID).Find(&units)
 | 
						|
}
 |