Skip to content

Instantly share code, notes, and snippets.

@brandf
Created August 30, 2017 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandf/c8b06dae80b0fd994f06838d69f5437f to your computer and use it in GitHub Desktop.
Save brandf/c8b06dae80b0fd994f06838d69f5437f to your computer and use it in GitHub Desktop.
Interface example
interface SubjectOfComment {
commentedOn: [Comment!]! @relation(name: "SubjectOfComment")
}
interface ObjectOfComment {
comments: [Comment!]! @relation(name: "ObjectOfComment")
}
type User implements SubjectOfComment, ObjectOfComment {
id: ID!
name: String!
posts: [Post!]! @relation(name: "AuthorPosts")
# SubjectOfComment
commentedOn: [Comment!]! @relation(name: "SubjectOfComment")
# ObjectOfComment
comments: [Comment!]! @relation(name: "ObjectOfComment")
}
type Post implements ObjectOfComment {
id: ID!
title: String!
author: User @relation(name: "AuthorPosts")
# ObjectOfComment
comments: [Comment!]! @relation(name: "ObjectOfComment")
}
type Comment {
id: ID!
text: String!
subject: SubjectOfComment @relation(name: "SubjectOfComment")
object: ObjectOfComment @relation(name: "ObjectOfComment")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment