Prisma GraphQL属于并且有很多关系

时间:2018-11-11 00:06:47

标签: graphql prisma

我正在学习Prisma GraphQL,并尝试创建一个属于和具有很多关系的对象,但是在部署它时失败了。

场景:

  • 用户将具有已创建评论的列表
  • 用户将获得评论列表
  • 评论将属于作者(用户)
  • 评论将有一个用户(有评论的用户)

我尝试过的事情:

main

但是在尝试部署它时,出现错误,无法解决mainInput: 5 10 Output: Result of 5+10 equals 15 之间的歧义。那么,您能帮我正确定义关系吗? dplyrdf %>% group_by(subject, condition) %>% filter(row_number() < 3) %>% ungroup() # A tibble: 8 x 3 subject condition value <chr> <chr> <dbl> 1 01 A 12 2 01 A 6 3 01 B 10 4 01 B 2 5 02 A 5 6 02 A 11 7 02 B 3 8 02 B 5 甚至type User { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! email: String! @unique password: String! roles: [Role!]! profile: Profile! @relation(name: "Profile", onDelete: CASCADE) addresses: [Address!]! @relation(name: "AddressAuthor", onDelete: CASCADE) posts: [Post!]! @relation(name: "PostAuthor", onDelete: CASCADE) topics: [Topic!]! @relation(name: "TopicAuthor", onDelete: CASCADE) subjects: [Subject!]! @relation(name: "SubjectAuthor", onDelete: CASCADE) votes: [Vote!]! @relatiion(name: "VoteAuthor", onDelete: CASCADE) notifications: [Notification!]! @relation(name: "Notification", onDelete: CASCADE) createdFollows: [Follow!]! @relation(name: "FollowAuthor", onDelete: CASCADE) followers: [Follow!]! @relation(name: "FollowedUser", onDelete: CASCADE) createdComments: [Comment!]! @relation(name: "CommentAuthor", onDelete: CASCADE) comments: [Comment!]! @relation(name: "CommentedUser") } type Comment { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! author: User! @relation(name: "CommentAuthor") type: String! body: String! attachments: [Attachment!]! @relation(name: "CommentAttachment", onDelete: CASCADE) comments: [Comment!]! @relation(name: "CommentComment", onDelete: CASCADE) likes: [Like!]! followers: [Follow!]! user: User @relation(name: "CommentedUser", onDelete: CASCADE) post: Post topic: Topic subject: Subject comment: Comment @relation(name: "CommentComment") } 可以有很多评论。

谢谢!

0 个答案:

没有答案