Open multimeric opened 2 years ago
This would also require generating a few new Query subtypes like countByRepresentative
.
Ideally this would be implemented as a @count
directive on the individual index fields. It should check if they also have the @index
directive and fail if they do not.
I believe I have added a way to use @count
on Fields as well, its in a fork at the moment as I'm not what the next steps are, I am unable to install it in my area as I get an npm error. If you could take a look and let me know what I need to do to test this and or get it in here.
I have also added a variable to the Directive called CountType as there is a DISTINCT
query on DynamoDB that might be quite useful
Can you open a pull request please?
This would speed up the count function for users who have GSIs.
Implementers should look into how Amplify performs the conditional logic using VTL: https://github.com/aws-amplify/amplify-cli/blob/fcf9100c778e98e16f0ed695112f2a7251aca06a/packages/amplify-graphql-model-transformer/src/resolvers/query.ts#L141-L155.