-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdatamodel.prisma
76 lines (70 loc) · 1.99 KB
/
datamodel.prisma
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
type User {
id: ID! @id
userName: String! @unique
avatar: String
@default(
value: "https://scontent-hkg3-1.cdninstagram.com/vp/51ea9f9……74447047_1561961433825017856_n.jpg?_nc_ht=scontent-hkg3-1.cdninstagram.com"
)
email: String! @unique
firstName: String
lastName: String
bio: String
following: [User!]! @relation(name: "FollowRelation")
followers: [User!]! @relation(name: "FollowRelation")
posts: [Post!]! @relation(name: "PostsOfUser", onDelete: CASCADE)
likes: [Like!]! @relation(name: "LikesOfUser", onDelete: CASCADE)
comments: [Comment!]! @relation(name: "CommentsOfUser", onDelete: CASCADE)
rooms: [Room!]!
loginSecret: String
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Post {
id: ID! @id
user: User @relation(name: "PostsOfUser")
files: [File!]! @relation(name: "FilesOfPost", onDelete: CASCADE)
location: String
caption: String!
likes: [Like!]! @relation(name: "LikeOfPost", onDelete: CASCADE)
comments: [Comment!]! @relation(name: "CommentsOfPost", onDelete: CASCADE)
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Like {
id: ID! @id
user: User @relation(name: "LikesOfUser")
post: Post @relation(name: "LikeOfPost")
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Comment {
id: ID! @id
text: String!
user: User @relation(name: "CommentsOfUser")
post: Post @relation(name: "CommentsOfPost")
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type File {
id: ID! @id
url: String!
post: Post @relation(name: "FilesOfPost")
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Room {
id: ID! @id
participants: [User!]!
messages: [Message!]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Message {
id: ID! @id
text: String!
from: User! @relation(name: "From")
to: User! @relation(name: "To")
room: Room!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}