Hi,
I'm trying to build a custom query backed by a lambda function that queries some data from dynamodb (my tables are defined by the datastore), applies some ad hoc filters to it then returns the result to my frontend.
I'm basically following these two doc pages:
- https://docs.amplify.aws/react-native/build-a-backend/data/customize-authz/grant-lambda-function-access-to-api/
- https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/
Code for the query in the schema:
getCalendarEvents: a
.query()
.arguments({ from: a.datetime(), to: a.datetime() })
.returns(a.ref(<Model_Name>).required().array())
.authorization((allow) => [allow.authenticated()])
.handler(a.handler.function(<function_name>)),
My issue: since <Model_Name> has a belongsTo field, typescript is mad that I'm returning the results of a list graphql operation. Is there a way to either populate this field in the list operation graphql schema generated by npx ampx generate graphql-client-code or only select some fields when writing .returns(a.ref(<Model_Name>).required().array())?