Skip to content

Commit

Permalink
Add total count to byType and atRoot connections
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmusjp committed Sep 30, 2019
1 parent c542f9b commit 895af6d
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ private void CreateContentField<T>(ObjectGraphType<T> query, IComplexGraphType g
.Argument<StringGraphType>("culture", "The culture.")
.Bidirectional()
.Resolve(ctx =>
fetch(_publishedSnapshotAccessor.PublishedSnapshot.Content, ctx.GetArgument<string>("culture"))
.OrderBy(ctx.GetArgument<IEnumerable<OrderBy>>("orderBy"))
.ToConnection(x => x.Key, ctx.First, ctx.After, ctx.Last, ctx.Before));
{
var items = fetch(_publishedSnapshotAccessor.PublishedSnapshot.Content, ctx.GetArgument<string>("culture")).ToList();

return items.OrderBy(ctx.GetArgument<IEnumerable<OrderBy>>("orderBy"))
.ToConnection(x => x.Key, ctx.First, ctx.After, ctx.Last, ctx.Before, items.Count);
});

var connectionField = query.GetField(publishedContentType.Alias);
connectionField.ResolvedType = new ConnectionGraphType(graphType);
Expand Down

0 comments on commit 895af6d

Please sign in to comment.