From a66c90462da24a916ee62afcb5a1f79d06ed8399 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sat, 5 Nov 2022 13:12:53 +0800 Subject: refactor(db): migrate methods off `user.go` and `org.go` (#7219) (#7227) --- internal/db/user.go | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'internal/db/user.go') diff --git a/internal/db/user.go b/internal/db/user.go index ea947224..a5e4d65c 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -60,23 +60,6 @@ func (u *User) getOrganizationCount(e Engine) (int64, error) { return e.Where("uid=?", u.ID).Count(new(OrgUser)) } -// GetOrganizations returns all organizations that user belongs to. -func (u *User) GetOrganizations(showPrivate bool) error { - orgIDs, err := GetOrgIDsByUserID(u.ID, showPrivate) - if err != nil { - return fmt.Errorf("GetOrgIDsByUserID: %v", err) - } - if len(orgIDs) == 0 { - return nil - } - - u.Orgs = make([]*User, 0, len(orgIDs)) - if err = x.Where("type = ?", UserTypeOrganization).In("id", orgIDs).Find(&u.Orgs); err != nil { - return err - } - return nil -} - // IsUserExist checks if given user name exist, // the user name should be noncased unique. // If uid is presented, then check will rule out that one, -- cgit v1.2.3