I'm creating an Amplify Schema for a blog that looks something like this:
type Post @model {
id: ID!
caption: String!
src: String!
}
I want to add a new field in the Post model to calculate the number of times a Post was liked. It gets this data from a different API.
Is there a way to run a function on a model field only something like this.
type Post @model {
id: ID!
caption: String!
src: String!
likes: String @function("getLikesLambda-${dev}")
}
How would the getLikesLambda code look?
I've seen code on the official documentation on implementing resolvers but all of them tie the @function to type query which is not exactly what I'm looking for.
Let me know if you guys have any suggestions or if anything is unclear.