Changing users groups to just return the group id
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
This commit is contained in:
parent
dbd31faa6c
commit
2f328ec8ee
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user