Skip to content

Commit

Permalink
default favorites first
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyTVu committed Feb 22, 2024
1 parent b645b32 commit da55e92
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
12 changes: 1 addition & 11 deletions graphql2/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion graphql2/graph/destinations.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ input DestinationFieldSearchInput {
omit: [String!] # values/ids to omit from results
after: String # cursor to start search from
first: Int = 15 # number of results to return
favoritesFirst: Boolean = false # sort favorite rotations first
}

# Destination represents a destination that can be used for notifications.
Expand Down
8 changes: 5 additions & 3 deletions graphql2/graphqlapp/destinationtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ func (q *Query) DestinationFieldValueName(ctx context.Context, input graphql2.De
}

func (q *Query) DestinationFieldSearch(ctx context.Context, input graphql2.DestinationFieldSearchInput) (*graphql2.FieldValueConnection, error) {
favFirst := true

switch input.FieldID {
case fieldSlackChanID:
res, err := q.SlackChannels(ctx, &graphql2.SlackChannelSearchOptions{
Expand Down Expand Up @@ -180,7 +182,7 @@ func (q *Query) DestinationFieldSearch(ctx context.Context, input graphql2.Desti
First: input.First,
Search: input.Search,
After: input.After,
FavoritesFirst: input.FavoritesFirst,
FavoritesFirst: &favFirst,
})
if err != nil {
return nil, err
Expand All @@ -206,7 +208,7 @@ func (q *Query) DestinationFieldSearch(ctx context.Context, input graphql2.Desti
First: input.First,
Search: input.Search,
After: input.After,
FavoritesFirst: input.FavoritesFirst,
FavoritesFirst: &favFirst,
})
if err != nil {
return nil, err
Expand All @@ -232,7 +234,7 @@ func (q *Query) DestinationFieldSearch(ctx context.Context, input graphql2.Desti
First: input.First,
Search: input.Search,
After: input.After,
FavoritesFirst: input.FavoritesFirst,
FavoritesFirst: &favFirst,
}, input.First, input.After, input.Search)
if err != nil {
return nil, err
Expand Down
13 changes: 6 additions & 7 deletions graphql2/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da55e92

Please sign in to comment.