mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-18 23:47:50 +00:00
chore: split AddRepository and AddTeamMember to return the inserted value (#11342)
Split [AddRepository][0] and [AddTeamMember][1] to functions that return the inserted value. These can be used by the F3 driver to obtain the ID of the TeamRepo and TeamUser rows inserted in the database. Add test coverage for both functions and remove a duplicated test. Integration tests also already [make use of AddRepository and AddTeamMember][2] indirectly. [0]:f8bee35e77/models/org_team.go (L26)[1]:f8bee35e77/models/org_team.go (L359)[2]:f8bee35e77/tests/integration/api_helper_for_declarative_test.go (L461-L483)Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11342 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: limiting-factor <limiting-factor@posteo.com> Co-committed-by: limiting-factor <limiting-factor@posteo.com>
This commit is contained in:
parent
a581059606
commit
d2acd4f14c
3 changed files with 125 additions and 42 deletions
|
|
@ -59,16 +59,6 @@ func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (repo
|
|||
Find(&repos)
|
||||
}
|
||||
|
||||
// AddTeamRepo adds a repo for an organization's team
|
||||
func AddTeamRepo(ctx context.Context, orgID, teamID, repoID int64) error {
|
||||
_, err := db.GetEngine(ctx).Insert(&TeamRepo{
|
||||
OrgID: orgID,
|
||||
TeamID: teamID,
|
||||
RepoID: repoID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// RemoveTeamRepo remove repository from team
|
||||
func RemoveTeamRepo(ctx context.Context, teamID, repoID int64) error {
|
||||
_, err := db.DeleteByBean(ctx, &TeamRepo{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue