Skip to content

Commit

Permalink
fix: search engine dont takes input as duo login fold (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
42atomys authored Jul 20, 2022
1 parent 88876a8 commit 4633ef3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions internal/api/api.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,16 @@ func (r *queryResolver) Me(ctx context.Context) (*generated.User, error) {
func (r *queryResolver) SearchUser(ctx context.Context, query string) ([]*generated.User, error) {
cu, _ := CurrentUserFromContext(ctx)
return r.client.User.Query().
Where(user.Or(
user.DuoLoginContainsFold(query),
user.FirstNameContainsFold(query),
user.LastNameContainsFold(query),
user.UsualFirstNameContainsFold(query),
),
Where(
user.Or(
user.DuoLoginEqualFold(query),
user.Or(
user.DuoLoginHasPrefix(query),
user.FirstNameContainsFold(query),
user.LastNameContainsFold(query),
user.UsualFirstNameContainsFold(query),
),
),
user.IDNEQ(cu.ID),
).
Limit(10).
Expand Down

0 comments on commit 4633ef3

Please sign in to comment.