Changing users groups to just return the group id

Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
This commit is contained in:
Ethan Wellenreiter 2025-05-06 23:47:01 -04:00
parent dbd31faa6c
commit 2f328ec8ee
2 changed files with 4 additions and 9 deletions

View File

@ -48,9 +48,9 @@ func (s *SQLGroupsStore) GetByID(ctx context.Context, id int64) (*Group, error)
return s.getByID(ctx, id)
}
func (s *SQLGroupsStore) GetUserGroups(ctx context.Context, userID int64) ([]*Group, error) {
func (s *SQLGroupsStore) GetUserGroups(ctx context.Context, userID int64) ([]int64, error) {
// Implement logic to retrieve user's groups from the database
var groups []*Group
var groups []int64
ctx, cancel := context.WithTimeout(ctx, QueryTimeoutDuration)
defer cancel()
@ -68,12 +68,7 @@ func (s *SQLGroupsStore) GetUserGroups(ctx context.Context, userID int64) ([]*Gr
if err != nil {
return nil, err
}
group, err := s.getByID(ctx, groupid)
if err != nil {
return nil, err
}
groups = append(groups, group)
groups = append(groups, groupid)
}
return groups, nil
}

View File

@ -66,7 +66,7 @@ type Storage struct {
}
Groups interface {
GetByID(context.Context, int64) (*Group, error)
GetUserGroups(context.Context, int64) ([]*Group, error)
GetUserGroups(context.Context, int64) ([]int64, error)
// GetUsersInGroup(context.Context, int64) ([]*User, error)
Create(context.Context, *Group) error
Delete(context.Context, int64) error