How would I add a gatsby-image type to a field on a graphQL model like below?
type PortfolioItem @model {
id: ID!
name: String
Image: ?????
......other fields
}
I know im supposed to create a foreign key with another object, but how do I make another model for gatsby-image to attach as a foreign key?!?!
The json for the image is generated by this:
file(relativePath: { eq: "websites.jpg" }) {
childImageSharp {
fixed(width: 650) {
...GatsbyImageSharpFixed
}
}
}
How on earth, do I add this as a field on a graphQL model so I can perform gatsby page queryies like below:
gql`query MyQuery {
getPortfolioItem(id: "12314") {
image: file(relativePath: { eq: "websites.jpg" }) {
childImageSharp {
fixed(width: 650) {
...GatsbyImageSharpFixed
}
}
}
}
}
So the returned JSON would look like:
{
name: 'something',
image: {
...whatever JSON is returned by the gatsby-image function above
}
}