Follow-up from "Add totalCount field as an option to the results"
The following discussions from !327 (merged) should be addressed:
-
@MichalLytek started a discussion: Ambigous name
😛 It should be something like
isTotalCountFieldRequested
as it returns boolean and acceptsGraphQLResolveInfo
-
@MichalLytek started a discussion: I would model the response in a different way.
hasMorePages
as well as theaggregationResult
are metadata used for building the graphql connection response. So I think we should return{ data, connectionInfo }
whereconnectionInfo
consist ofhasMorePages
andtotalCount
. -
@MichalLytek started a discussion: That sounds overengineered. It uses
prismaCountFunction
so it won't return more aggregations nor statistics. It could be simplified bygetTotalCount(): number
. -
@MichalLytek started a discussion: (+1 comment) I'm not sure if I quite follow:
- we enrich
args
by addingaggregationInput
property - we reuse GraphQL Input type as type of argument of repository method
And because of that, you have added
aggregationInput
field to all inputs? Shouldn't that be replaced with some dedicated interfaces or generic type to enrich inputs used as args?The problem is that now TS reports you can use
args.aggregationInput
in resolver. - we enrich