After updating my project, when I tried amplify push
I got the error below
Song must have a relationship with Post in order to use @belongsTo.
from my graphql schema code.
What can I add to create the relationship to connect Song to Post? Because I am lost, I don’t know what else to do because all my efforts did not work, and I am still getting the same error.
Here’s my graphql schema code:
type User @model {
id: ID!
username: String!
email: String!
posts: [Post] @hasMany(indexName: "byUser", fields: ["id"])
}
type Post @model {
id: ID! @index(name: "byUser", sortKeyFields: ["userID"])
videoUri: String!
description: String!
userID: ID!
user: User @belongsTo(fields: ["userID"])
songID: ID!
song: Song @belongsTo(fields: ["songID"])
}
type Song @model @auth(rules: [{ allow: public, operations: [read] }, { allow: owner }]) {
id: ID!
name: String!
imageUri: String
}