Skip to content

Commit

Permalink
fix: use org_id filter only when id is not blank
Browse files Browse the repository at this point in the history
  • Loading branch information
krtkvrm committed Feb 18, 2022
1 parent c798200 commit ccbef28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions store/postgres/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ func (s Store) ListGroups(ctx context.Context, org model.Organization) ([]model.

query := listGroupsQuery
if org.Id != "" {
query = query + `WHERE org_id=$1`
query = query + fmt.Sprintf("WHERE org_id='%s'", org.Id)
}

query = query + ";"
err := s.DB.WithTimeout(ctx, func(ctx context.Context) error {
return s.DB.SelectContext(ctx, &fetchedGroups, query, org.Id)
return s.DB.SelectContext(ctx, &fetchedGroups, query)
})

if errors.Is(err, sql.ErrNoRows) {
Expand Down

0 comments on commit ccbef28

Please sign in to comment.