Open mauriciomassaia opened 5 months ago
Hi @mauriciomassaia , this is expected behavior. Any fields used as sort keys or referenced through the schema builder functions must be defined on the model. The createdAt/updatedAt fields are added at the time of transformation.
However, we might be able to improve this by making it available in the types ahead of time.
I'll mark this as a feature request for the team to consider as it sounds like it could be a potential DX improvement.
Environment information
Data packages
Description
In the docs: https://docs.amplify.aws/react/build-a-backend/data/mutate-data/#create-an-item says:
Note: You do not need to specify createdAt or updatedAt fields because Amplify automatically populates these fields for you.
But if you don't declare them, the lint breaks if you want to use them as sortKeys, so I had to declare both of them to be able to use as sortKeys. and it also broke the auto complete for my models list methods.
for example:
So it auto generated the following query so to be used in the frontend:
It shows this error:
To by pass this I had to add updatedAt and created to my model:
So it auto generated the following query so to be used in the frontend:
And then it works as intended.
Just wanna check if this is the intended behaviour or if im missing something.