playing around with amplify and datastore with nodejs and react.
I have model for message
type Message
@model
@auth(rules: [{allow: owner, operations: [read, create, update, delete]}]) {
id: ID!
content: String!
}
I want to fetch all messages and sort in desceding order. What I am trying to do
const messages = await DataStore.query(Message, Predicates.ALL, {
sort: s => s.createdAt(SortDirection.DESCENDING),
page: 0,
limit: 20
});
My solution doesn't seem to affect the sorting at all. What am I missing?