forked from prisma/prisma1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.graphql
More file actions
31 lines (25 loc) · 795 Bytes
/
types.graphql
File metadata and controls
31 lines (25 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# The following types define the data model of the example app
# based on which the GraphQL API is generated
type User @model {
id: ID! @isUnique
firstName: String!
lastName: String!
# You can declare relations between models like this
posts: [Post!]! @relation(name: "UserPosts")
comments: [Comment!]! @relation(name: "UserComments")
}
type Post @model {
id: ID! @isUnique
title: String!
description: String!
# Every relation also required a back-relation (to determine 1:1, 1:n or n:m)
author: User! @relation(name: "UserPosts")
comments: [Comment!]! @relation(name: "PostComments")
}
type Comment @model {
id: ID! @isUnique
text: String!
isPublished: Boolean!
author: User! @relation(name: "UserComments")
post: Post! @relation(name: "PostComments")
}