Awey
11/23/2021, 7:40 AMmodel Comment {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
content String
author User @relation(fields: [authorId], references: [id])
authorId Int @map("author_id")
post Post @relation(fields: [postId], references: [id])
postId Int @map("post_id")
parent Comment? @relation("CommentToComment", fields: [parentId], references: [id])
parentId Int? @map("parent_id")
replies Comment[] @relation("CommentToComment")
@@map("comments")
}
type Comment {
id: Int!
createdAt: DateTime!
updatedAt: DateTime!
content: String!
author: User!
post: Post!
parent: Comment
replies: [Comment!]
}
Am I representing my Prisma Model correctly with GraphQL?Ryan
11/23/2021, 7:56 AM