forked from mindhiveproject/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatamodel.prisma
More file actions
327 lines (303 loc) · 7.69 KB
/
datamodel.prisma
File metadata and controls
327 lines (303 loc) · 7.69 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
enum Permission {
IT
ADMIN
SCIENTIST
MENTOR
TEACHER
STUDENT
PARTICIPANT
}
enum TaskType {
TASK
SURVEY
}
type Profile {
id: ID! @id
username: String! @unique
permissions: [Permission] @scalarList(strategy: RELATION)
authEmail: [AuthEmail]!
authToken: [AuthToken]!
authInvite: [AuthInvite]! @relation(name:"Owner")
authParticipant: [AuthParticipant]!
results: [Result]!
teacherIn: [Class]! @relation(name:"Classcreator")
studentIn: [Class]! @relation(name:"Studentofclass")
participantIn: [Study]! @relation(name:"Participantofstudy")
researcherIn: [Study]! @relation(name:"Creatorofstudy")
taskCreatorIn: [Task]! @relation(name:"Creatoroftask")
consentCreatorIn: [Consent]! @relation(name:"Creatorofconsent")
collaboratorInStudy: [Study]! @relation(name:"Studycollaborator")
collaboratorInTask: [Task]! @relation(name:"Taskcollaborator")
collaboratorInConsent: [Consent]! @relation(name:"Consentcollaborator")
consentGivenFor: [Consent]! @relation(name:"Consentparticipant")
image: String
largeImage: String
info: Json
generalInfo: Json
tasksInfo: Json
studiesInfo: Json
consentsInfo: Json
publicId: String @unique
journals: [Journal]! @relation(name:"CreatorOfJournal")
posts: [Post]! @relation(name:"AuthorOfPost")
creatorOfProposal: [ProposalBoard]! @relation(name:"CreatorOfProposalTemplate")
authorOfProposal: [ProposalBoard]! @relation(name:"AuthorOfProposal")
collaboratorOnProposal: [ProposalBoard]! @relation(name:"CollaboratorOnProposal")
assignedToProposalSection: [ProposalSection]! @relation(name:"AssignedToProposalSection")
assignedToProposalCard: [ProposalCard]! @relation(name:"AssignedToProposalCard")
publicReadableId: String
reviews: [Review]! @relation(name:"AuthorOfReview")
classNetworksCreated: [ClassNetwork]! @relation(name:"Classnetworkcreator")
}
type AuthEmail {
id: ID! @id
email: String @unique
password: String!
resetToken: String
resetTokenExpiry: String
profile: Profile!
settings: Json
}
type AuthParticipant {
id: ID! @id
email: String @unique
password: String!
resetToken: String
resetTokenExpiry: String
profile: Profile!
settings: Json
}
type AuthToken {
id: ID! @id
token: String! @unique
tokenExpiry: String
profile: Profile!
email: String @unique
}
type AuthInvite {
id: ID! @id
profile: Profile! @relation(name:"Owner")
invitedIn: Class! @relation(name:"Invite")
}
type School {
id: ID! @id
title: String!
description: String
image: String
largeImage: String
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
creator: Profile!
}
type Class {
id: ID! @id
code: String! @unique
title: String!
description: String
image: String
largeImage: String
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
creator: Profile! @relation(name:"Classcreator")
students: [Profile]! @relation(name:"Studentofclass")
invites: [AuthInvite]! @relation(name:"Invite")
network: ClassNetwork @relation(name:"Classnetwork")
}
type ClassNetwork {
id: ID! @id
title: String
description: String
settings: Json
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
creator: Profile! @relation(name:"Classnetworkcreator")
classes: [Class]! @relation(name:"Classnetwork")
}
enum ResultType {
REVIEW
TEST
MAIN
}
type Result {
id: ID! @id
template: Template #relationship to Template
task: Task!
user: Profile! #relationship to Profile
quantity: Int!
data: Json
dataPolicy: String
token: String @unique
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
payload: String
study: Study #relationship to Study
info: Json
incrementalData: [Data] @relation(name:"Incrementaldata")
fullData: Data @relation(name:"Fulldata")
resultType: ResultType
testVersion: String
}
type Data {
id: ID! @id
content: String
}
type Study {
id: ID! @id
title: String!
slug: String! @unique
shortDescription: String
description: String
author: Profile! @relation(name:"Creatorofstudy")
tasks: [Task]!
settings: Json
participants: [Profile]! @relation(name:"Participantofstudy")
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
image: String
largeImage: String
info: Json
collaborators: [Profile]! @relation(name:"Studycollaborator")
consent: Consent
messages: [Message]!
public: Boolean
submitForPublishing: Boolean
components: Json
proposal: [ProposalBoard]! @relation(name:"StudyProposal")
reviews: [Review]! @relation(name:"StudyReview")
}
type Task {
id: ID! @id
title: String!
slug: String! @unique
description: String
template: Template
author: Profile! @relation(name:"Creatoroftask")
parameters: Json
settings: Json
link: String
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
collaborators: [Profile]! @relation(name:"Taskcollaborator")
consent: Consent
public: Boolean
submitForPublishing: Boolean
taskType: TaskType
isOriginal: Boolean
isExternal: Boolean
}
type Template {
id: ID! @id
title: String!
slug: String! @unique
shortDescription: String
description: String
image: String
largeImage: String
author: Profile!
parameters: Json
script: String
style: String
tasks: [Task]!
settings: Json
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Consent {
id: ID! @id
title: String!
slug: String! @unique
description: String
organization: String
info: Json
settings: Json
author: Profile! @relation(name:"Creatorofconsent")
collaborators: [Profile]! @relation(name:"Consentcollaborator")
participants: [Profile]! @relation(name:"Consentparticipant")
studies: [Study]!
tasks: [Task]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Message {
id: ID! @id
content: String!
author: Profile!
info: Json
settings: Json
expireAt: DateTime
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Journal {
id: ID! @id
title: String
description: String
creator: Profile! @relation(name:"CreatorOfJournal")
posts: [Post]!
settings: Json
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Post {
id: ID! @id
author: Profile! @relation(name:"AuthorOfPost")
title: String
content: String
journal: Journal!
settings: Json
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type ProposalBoard {
id: ID! @id
title: String!
slug: String! @unique
description: String
creator: Profile @relation(name:"CreatorOfProposalTemplate")
author: Profile @relation(name:"AuthorOfProposal")
collaborators: [Profile]! @relation(name:"CollaboratorOnProposal")
study: Study @relation(name:"StudyProposal")
isTemplate: Boolean
sections: [ProposalSection]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
isSubmitted: Boolean
checklist: Json
reviews: [Review]! @relation(name:"ProposalReview")
}
type ProposalSection {
id: ID! @id
title: String!
description: String
position: Float!
board: ProposalBoard!
assignedTo: [Profile]! @relation(name:"AssignedToProposalSection")
cards: [ProposalCard]
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type ProposalCard {
id: ID! @id
title: String!
description: String
position: Float!
content: String
section: ProposalSection!
assignedTo: [Profile]! @relation(name:"AssignedToProposalCard")
settings: Json
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
enum ReviewStage {
INDIVIDUAL
SYNTHESIS
}
type Review {
id: ID! @id
study: Study @relation(name:"StudyReview")
proposal: ProposalBoard @relation(name:"ProposalReview")
author: Profile @relation(name:"AuthorOfReview")
settings: Json
content: Json
stage: ReviewStage
}