diff options
Diffstat (limited to 'graphql/resolvers/repo.go')
-rw-r--r-- | graphql/resolvers/repo.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/graphql/resolvers/repo.go b/graphql/resolvers/repo.go index 7922256f..c696ff34 100644 --- a/graphql/resolvers/repo.go +++ b/graphql/resolvers/repo.go @@ -11,7 +11,7 @@ import ( type repoResolver struct{} -func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (models.BugConnection, error) { +func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int, queryStr *string) (models.BugConnection, error) { input := models.ConnectionInput{ Before: before, After: after, @@ -19,11 +19,19 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after * Last: last, } + var query *cache.Query + if queryStr != nil { + query2, err := cache.ParseQuery(*queryStr) + if err != nil { + return models.BugConnection{}, err + } + query = query2 + } else { + query = cache.NewQuery() + } + // Simply pass a []string with the ids to the pagination algorithm - source := obj.Repo.QueryBugs(&cache.Query{ - OrderBy: cache.OrderByCreation, - OrderDirection: cache.OrderAscending, - }) + source := obj.Repo.QueryBugs(query) // The edger create a custom edge holding just the id edger := func(id string, offset int) connections.Edge { |