-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatamodel
83 lines (76 loc) · 2.04 KB
/
datamodel
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
77
78
79
80
81
82
83
type User {
id: ID! @id
avatar: String
@default (
value: "https://icon-library.net/images/default-user-icon/default-user-icon-4.jpg"
)
username: String! @unique
email: String! @unique
firstName: String! @default(value:"")
lastName: String
bio: String
followers: [User!]! @relation(name: "FollowRelation")
following: [User!]! @relation(name: "FollowRelation")
posts: [Post!]! @relation(name: "PostOfUser", onDelete:CASCADE)
likes: [Like!]! @relation(name: "LikeOfUser", onDelete:CASCADE)
comments: [Comment!]! @relation(name: "CommentsOfUser", onDelete:CASCADE)
rooms: [Room!]!
loginSecret: String
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Post {
id: ID! @id
location: String
caption: String!
user: User! @relation(name: "PostOfUser")
files: [File!]! @relation(name: "FileOfPost", onDelete: CASCADE)
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: "LikeOfUser")
post: Post @relation(name: "LikeOfPost")
}
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:"FileOfPost")
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
}
type FileUpload {
id: ID! @id
path: String!
filename: String!
mimetype: String!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}