@studious-lms/server 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/middleware/security.d.ts.map +1 -1
- package/dist/middleware/security.js +3 -3
- package/dist/middleware/security.js.map +1 -1
- package/dist/models/access.d.ts +21 -66
- package/dist/models/access.d.ts.map +1 -1
- package/dist/models/access.js +10 -26
- package/dist/models/access.js.map +1 -1
- package/dist/models/agenda.d.ts +4 -2
- package/dist/models/agenda.d.ts.map +1 -1
- package/dist/models/announcement.d.ts +4 -3
- package/dist/models/announcement.d.ts.map +1 -1
- package/dist/models/announcement.js +2 -3
- package/dist/models/announcement.js.map +1 -1
- package/dist/models/assignment.d.ts +40 -33
- package/dist/models/assignment.d.ts.map +1 -1
- package/dist/models/auth.d.ts +2 -4
- package/dist/models/auth.d.ts.map +1 -1
- package/dist/models/auth.js +2 -3
- package/dist/models/auth.js.map +1 -1
- package/dist/models/class.d.ts +34 -6
- package/dist/models/class.d.ts.map +1 -1
- package/dist/models/class.js +15 -2
- package/dist/models/class.js.map +1 -1
- package/dist/models/cloudStorage.d.ts +153 -0
- package/dist/models/cloudStorage.d.ts.map +1 -0
- package/dist/models/cloudStorage.js +295 -0
- package/dist/models/cloudStorage.js.map +1 -0
- package/dist/models/comment.d.ts +0 -24
- package/dist/models/comment.d.ts.map +1 -1
- package/dist/models/comment.js +2 -6
- package/dist/models/comment.js.map +1 -1
- package/dist/models/conversation.d.ts +22 -22
- package/dist/models/department.d.ts +154 -0
- package/dist/models/department.d.ts.map +1 -0
- package/dist/models/department.js +135 -0
- package/dist/models/department.js.map +1 -0
- package/dist/models/event.d.ts +10 -4
- package/dist/models/event.d.ts.map +1 -1
- package/dist/models/event.js +2 -5
- package/dist/models/event.js.map +1 -1
- package/dist/models/file.d.ts +52 -36
- package/dist/models/file.d.ts.map +1 -1
- package/dist/models/file.js +4 -42
- package/dist/models/file.js.map +1 -1
- package/dist/models/folder.d.ts +47 -0
- package/dist/models/folder.d.ts.map +1 -1
- package/dist/models/labChat.d.ts +11 -9
- package/dist/models/labChat.d.ts.map +1 -1
- package/dist/models/message.d.ts +46 -12
- package/dist/models/message.d.ts.map +1 -1
- package/dist/models/message.js +19 -10
- package/dist/models/message.js.map +1 -1
- package/dist/models/newtonChat.d.ts +2 -1
- package/dist/models/newtonChat.d.ts.map +1 -1
- package/dist/models/school.d.ts +45 -12
- package/dist/models/school.d.ts.map +1 -1
- package/dist/models/school.js +19 -2
- package/dist/models/school.js.map +1 -1
- package/dist/models/section.d.ts +2 -1
- package/dist/models/section.d.ts.map +1 -1
- package/dist/models/tag.d.ts +117 -0
- package/dist/models/tag.d.ts.map +1 -0
- package/dist/models/tag.js +113 -0
- package/dist/models/tag.js.map +1 -0
- package/dist/models/worksheet.d.ts +3 -0
- package/dist/models/worksheet.d.ts.map +1 -1
- package/dist/pipelines/aiLabChatContract.d.ts +8 -8
- package/dist/routers/_app.d.ts +6704 -5222
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/_app.js +8 -2
- package/dist/routers/_app.js.map +1 -1
- package/dist/routers/agenda.d.ts +4 -2
- package/dist/routers/agenda.d.ts.map +1 -1
- package/dist/routers/announcement.d.ts.map +1 -1
- package/dist/routers/announcement.js +3 -5
- package/dist/routers/announcement.js.map +1 -1
- package/dist/routers/assignment.d.ts +49 -40
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +2 -3
- package/dist/routers/assignment.js.map +1 -1
- package/dist/routers/class.d.ts +92 -19
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +5 -2
- package/dist/routers/class.js.map +1 -1
- package/dist/routers/conversation.d.ts +5 -5
- package/dist/routers/department.d.ts +293 -0
- package/dist/routers/department.d.ts.map +1 -0
- package/dist/routers/department.js +93 -0
- package/dist/routers/department.js.map +1 -0
- package/dist/routers/event.d.ts +4 -3
- package/dist/routers/event.d.ts.map +1 -1
- package/dist/routers/file.d.ts +10 -8
- package/dist/routers/file.d.ts.map +1 -1
- package/dist/routers/file.js +26 -17
- package/dist/routers/file.js.map +1 -1
- package/dist/routers/folder.d.ts +163 -186
- package/dist/routers/folder.d.ts.map +1 -1
- package/dist/routers/folder.js +102 -88
- package/dist/routers/folder.js.map +1 -1
- package/dist/routers/labChat.d.ts +13 -4
- package/dist/routers/labChat.d.ts.map +1 -1
- package/dist/routers/message.d.ts +20 -2
- package/dist/routers/message.d.ts.map +1 -1
- package/dist/routers/newtonChat.d.ts +10 -1
- package/dist/routers/newtonChat.d.ts.map +1 -1
- package/dist/routers/permissions.d.ts +120 -0
- package/dist/routers/permissions.d.ts.map +1 -0
- package/dist/routers/permissions.js +50 -0
- package/dist/routers/permissions.js.map +1 -0
- package/dist/routers/school.d.ts +160 -17
- package/dist/routers/school.d.ts.map +1 -1
- package/dist/routers/school.js +46 -3
- package/dist/routers/school.js.map +1 -1
- package/dist/routers/tag.d.ts +119 -0
- package/dist/routers/tag.d.ts.map +1 -0
- package/dist/routers/tag.js +52 -0
- package/dist/routers/tag.js.map +1 -0
- package/dist/routers/worksheet.d.ts +1 -0
- package/dist/routers/worksheet.d.ts.map +1 -1
- package/dist/seedDatabase.d.ts +0 -1
- package/dist/seedDatabase.d.ts.map +1 -1
- package/dist/services/agenda.d.ts +4 -2
- package/dist/services/agenda.d.ts.map +1 -1
- package/dist/services/assignment.d.ts +49 -40
- package/dist/services/assignment.d.ts.map +1 -1
- package/dist/services/class.d.ts +92 -19
- package/dist/services/class.d.ts.map +1 -1
- package/dist/services/class.js +92 -5
- package/dist/services/class.js.map +1 -1
- package/dist/services/conversation.d.ts +5 -5
- package/dist/services/department.d.ts +200 -0
- package/dist/services/department.d.ts.map +1 -0
- package/dist/services/department.js +368 -0
- package/dist/services/department.js.map +1 -0
- package/dist/services/event.d.ts +4 -3
- package/dist/services/event.d.ts.map +1 -1
- package/dist/services/file.d.ts +105 -3
- package/dist/services/file.d.ts.map +1 -1
- package/dist/services/file.js +167 -41
- package/dist/services/file.js.map +1 -1
- package/dist/services/folder.d.ts +220 -149
- package/dist/services/folder.d.ts.map +1 -1
- package/dist/services/folder.js +326 -196
- package/dist/services/folder.js.map +1 -1
- package/dist/services/labChat.d.ts +13 -4
- package/dist/services/labChat.d.ts.map +1 -1
- package/dist/services/labChat.js +4 -3
- package/dist/services/labChat.js.map +1 -1
- package/dist/services/message.d.ts +20 -2
- package/dist/services/message.d.ts.map +1 -1
- package/dist/services/message.js +7 -23
- package/dist/services/message.js.map +1 -1
- package/dist/services/newtonChat.d.ts +9 -0
- package/dist/services/newtonChat.d.ts.map +1 -1
- package/dist/services/newtonChat.js +4 -3
- package/dist/services/newtonChat.js.map +1 -1
- package/dist/services/permissions.d.ts +188 -0
- package/dist/services/permissions.d.ts.map +1 -0
- package/dist/services/permissions.js +661 -0
- package/dist/services/permissions.js.map +1 -0
- package/dist/services/school.d.ts +142 -15
- package/dist/services/school.d.ts.map +1 -1
- package/dist/services/school.js +308 -54
- package/dist/services/school.js.map +1 -1
- package/dist/services/tag.d.ts +71 -0
- package/dist/services/tag.d.ts.map +1 -0
- package/dist/services/tag.js +178 -0
- package/dist/services/tag.js.map +1 -0
- package/dist/services/worksheet.d.ts +1 -0
- package/dist/services/worksheet.d.ts.map +1 -1
- package/dist/utils/aiUser.d.ts.map +1 -1
- package/dist/utils/aiUser.js +2 -3
- package/dist/utils/aiUser.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20260509220000_institution_overhaul/migration.sql +184 -0
- package/prisma/migrations/20260510170000_add_folder_permissions/migration.sql +93 -0
- package/prisma/schema.prisma +193 -35
- package/src/middleware/security.ts +1 -1
- package/src/models/access.ts +8 -24
- package/src/models/announcement.ts +0 -1
- package/src/models/auth.ts +0 -1
- package/src/models/class.ts +13 -0
- package/src/models/cloudStorage.ts +327 -0
- package/src/models/comment.ts +0 -4
- package/src/models/department.ts +159 -0
- package/src/models/event.ts +0 -3
- package/src/models/file.ts +2 -40
- package/src/models/message.ts +19 -5
- package/src/models/school.ts +26 -0
- package/src/models/tag.ts +140 -0
- package/src/routers/_app.ts +6 -0
- package/src/routers/announcement.ts +1 -3
- package/src/routers/assignment.ts +0 -1
- package/src/routers/class.ts +3 -0
- package/src/routers/department.ts +174 -0
- package/src/routers/file.ts +29 -26
- package/src/routers/folder.ts +127 -118
- package/src/routers/permissions.ts +71 -0
- package/src/routers/school.ts +83 -0
- package/src/routers/tag.ts +78 -0
- package/src/services/class.ts +109 -4
- package/src/services/department.ts +478 -0
- package/src/services/file.ts +172 -43
- package/src/services/folder.ts +399 -237
- package/src/services/labChat.ts +2 -1
- package/src/services/message.ts +5 -21
- package/src/services/newtonChat.ts +2 -1
- package/src/services/permissions.ts +778 -0
- package/src/services/school.ts +369 -57
- package/src/services/tag.ts +229 -0
- package/src/utils/aiUser.ts +0 -1
- package/tests/unit/services/permissions.test.ts +463 -0
|
@@ -3,8 +3,8 @@ export declare function findAssignmentById(id: string): import(".prisma/client")
|
|
|
3
3
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
4
4
|
id: string;
|
|
5
5
|
createdAt: Date | null;
|
|
6
|
-
modifiedAt: Date | null;
|
|
7
6
|
classId: string;
|
|
7
|
+
modifiedAt: Date | null;
|
|
8
8
|
title: string;
|
|
9
9
|
instructions: string;
|
|
10
10
|
dueDate: Date;
|
|
@@ -85,8 +85,8 @@ export declare function findAssignmentWithDetails(id: string): import(".prisma/c
|
|
|
85
85
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
86
86
|
id: string;
|
|
87
87
|
createdAt: Date | null;
|
|
88
|
-
modifiedAt: Date | null;
|
|
89
88
|
classId: string;
|
|
89
|
+
modifiedAt: Date | null;
|
|
90
90
|
title: string;
|
|
91
91
|
instructions: string;
|
|
92
92
|
dueDate: Date;
|
|
@@ -123,6 +123,7 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
123
123
|
name: string;
|
|
124
124
|
id: string;
|
|
125
125
|
userId: string | null;
|
|
126
|
+
folderId: string | null;
|
|
126
127
|
size: number | null;
|
|
127
128
|
uploadedAt: Date | null;
|
|
128
129
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -139,7 +140,6 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
139
140
|
submissionId: string | null;
|
|
140
141
|
annotationId: string | null;
|
|
141
142
|
classDraftId: string | null;
|
|
142
|
-
folderId: string | null;
|
|
143
143
|
conversationId: string | null;
|
|
144
144
|
messageId: string | null;
|
|
145
145
|
announcementId: string | null;
|
|
@@ -151,6 +151,7 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
151
151
|
name: string;
|
|
152
152
|
id: string;
|
|
153
153
|
userId: string | null;
|
|
154
|
+
folderId: string | null;
|
|
154
155
|
size: number | null;
|
|
155
156
|
uploadedAt: Date | null;
|
|
156
157
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -167,7 +168,6 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
167
168
|
submissionId: string | null;
|
|
168
169
|
annotationId: string | null;
|
|
169
170
|
classDraftId: string | null;
|
|
170
|
-
folderId: string | null;
|
|
171
171
|
conversationId: string | null;
|
|
172
172
|
messageId: string | null;
|
|
173
173
|
announcementId: string | null;
|
|
@@ -180,6 +180,7 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
180
180
|
name: string;
|
|
181
181
|
id: string;
|
|
182
182
|
userId: string | null;
|
|
183
|
+
folderId: string | null;
|
|
183
184
|
size: number | null;
|
|
184
185
|
uploadedAt: Date | null;
|
|
185
186
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -196,7 +197,6 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
196
197
|
submissionId: string | null;
|
|
197
198
|
annotationId: string | null;
|
|
198
199
|
classDraftId: string | null;
|
|
199
|
-
folderId: string | null;
|
|
200
200
|
conversationId: string | null;
|
|
201
201
|
messageId: string | null;
|
|
202
202
|
announcementId: string | null;
|
|
@@ -208,6 +208,7 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
208
208
|
name: string;
|
|
209
209
|
id: string;
|
|
210
210
|
userId: string | null;
|
|
211
|
+
folderId: string | null;
|
|
211
212
|
size: number | null;
|
|
212
213
|
uploadedAt: Date | null;
|
|
213
214
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -224,7 +225,6 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
224
225
|
submissionId: string | null;
|
|
225
226
|
annotationId: string | null;
|
|
226
227
|
classDraftId: string | null;
|
|
227
|
-
folderId: string | null;
|
|
228
228
|
conversationId: string | null;
|
|
229
229
|
messageId: string | null;
|
|
230
230
|
announcementId: string | null;
|
|
@@ -254,6 +254,7 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
254
254
|
name: string;
|
|
255
255
|
id: string;
|
|
256
256
|
userId: string | null;
|
|
257
|
+
folderId: string | null;
|
|
257
258
|
size: number | null;
|
|
258
259
|
uploadedAt: Date | null;
|
|
259
260
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -270,7 +271,6 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
270
271
|
submissionId: string | null;
|
|
271
272
|
annotationId: string | null;
|
|
272
273
|
classDraftId: string | null;
|
|
273
|
-
folderId: string | null;
|
|
274
274
|
conversationId: string | null;
|
|
275
275
|
messageId: string | null;
|
|
276
276
|
announcementId: string | null;
|
|
@@ -282,6 +282,7 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
282
282
|
name: string;
|
|
283
283
|
id: string;
|
|
284
284
|
userId: string | null;
|
|
285
|
+
folderId: string | null;
|
|
285
286
|
size: number | null;
|
|
286
287
|
uploadedAt: Date | null;
|
|
287
288
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -298,7 +299,6 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
298
299
|
submissionId: string | null;
|
|
299
300
|
annotationId: string | null;
|
|
300
301
|
classDraftId: string | null;
|
|
301
|
-
folderId: string | null;
|
|
302
302
|
conversationId: string | null;
|
|
303
303
|
messageId: string | null;
|
|
304
304
|
announcementId: string | null;
|
|
@@ -308,8 +308,8 @@ export declare function findAssignmentForDelete(id: string, teacherId: string):
|
|
|
308
308
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
309
309
|
id: string;
|
|
310
310
|
createdAt: Date | null;
|
|
311
|
-
modifiedAt: Date | null;
|
|
312
311
|
classId: string;
|
|
312
|
+
modifiedAt: Date | null;
|
|
313
313
|
title: string;
|
|
314
314
|
instructions: string;
|
|
315
315
|
dueDate: Date;
|
|
@@ -360,6 +360,7 @@ export declare function findSubmissionByAssignmentAndStudent(assignmentId: strin
|
|
|
360
360
|
color: string | null;
|
|
361
361
|
section: string;
|
|
362
362
|
syllabus: string | null;
|
|
363
|
+
departmentId: string | null;
|
|
363
364
|
};
|
|
364
365
|
markScheme: {
|
|
365
366
|
id: string;
|
|
@@ -377,8 +378,8 @@ export declare function findSubmissionByAssignmentAndStudent(assignmentId: strin
|
|
|
377
378
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
378
379
|
id: string;
|
|
379
380
|
createdAt: Date | null;
|
|
380
|
-
modifiedAt: Date | null;
|
|
381
381
|
classId: string;
|
|
382
|
+
modifiedAt: Date | null;
|
|
382
383
|
title: string;
|
|
383
384
|
instructions: string;
|
|
384
385
|
dueDate: Date;
|
|
@@ -405,6 +406,7 @@ export declare function findSubmissionByAssignmentAndStudent(assignmentId: strin
|
|
|
405
406
|
name: string;
|
|
406
407
|
id: string;
|
|
407
408
|
userId: string | null;
|
|
409
|
+
folderId: string | null;
|
|
408
410
|
size: number | null;
|
|
409
411
|
uploadedAt: Date | null;
|
|
410
412
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -421,7 +423,6 @@ export declare function findSubmissionByAssignmentAndStudent(assignmentId: strin
|
|
|
421
423
|
submissionId: string | null;
|
|
422
424
|
annotationId: string | null;
|
|
423
425
|
classDraftId: string | null;
|
|
424
|
-
folderId: string | null;
|
|
425
426
|
conversationId: string | null;
|
|
426
427
|
messageId: string | null;
|
|
427
428
|
announcementId: string | null;
|
|
@@ -433,6 +434,7 @@ export declare function findSubmissionByAssignmentAndStudent(assignmentId: strin
|
|
|
433
434
|
name: string;
|
|
434
435
|
id: string;
|
|
435
436
|
userId: string | null;
|
|
437
|
+
folderId: string | null;
|
|
436
438
|
size: number | null;
|
|
437
439
|
uploadedAt: Date | null;
|
|
438
440
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -449,7 +451,6 @@ export declare function findSubmissionByAssignmentAndStudent(assignmentId: strin
|
|
|
449
451
|
submissionId: string | null;
|
|
450
452
|
annotationId: string | null;
|
|
451
453
|
classDraftId: string | null;
|
|
452
|
-
folderId: string | null;
|
|
453
454
|
conversationId: string | null;
|
|
454
455
|
messageId: string | null;
|
|
455
456
|
announcementId: string | null;
|
|
@@ -505,6 +506,7 @@ export declare function findSubmissionByIdForClassMember(submissionId: string, c
|
|
|
505
506
|
color: string | null;
|
|
506
507
|
section: string;
|
|
507
508
|
syllabus: string | null;
|
|
509
|
+
departmentId: string | null;
|
|
508
510
|
};
|
|
509
511
|
markScheme: {
|
|
510
512
|
id: string;
|
|
@@ -522,8 +524,8 @@ export declare function findSubmissionByIdForClassMember(submissionId: string, c
|
|
|
522
524
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
523
525
|
id: string;
|
|
524
526
|
createdAt: Date | null;
|
|
525
|
-
modifiedAt: Date | null;
|
|
526
527
|
classId: string;
|
|
528
|
+
modifiedAt: Date | null;
|
|
527
529
|
title: string;
|
|
528
530
|
instructions: string;
|
|
529
531
|
dueDate: Date;
|
|
@@ -550,6 +552,7 @@ export declare function findSubmissionByIdForClassMember(submissionId: string, c
|
|
|
550
552
|
name: string;
|
|
551
553
|
id: string;
|
|
552
554
|
userId: string | null;
|
|
555
|
+
folderId: string | null;
|
|
553
556
|
size: number | null;
|
|
554
557
|
uploadedAt: Date | null;
|
|
555
558
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -566,7 +569,6 @@ export declare function findSubmissionByIdForClassMember(submissionId: string, c
|
|
|
566
569
|
submissionId: string | null;
|
|
567
570
|
annotationId: string | null;
|
|
568
571
|
classDraftId: string | null;
|
|
569
|
-
folderId: string | null;
|
|
570
572
|
conversationId: string | null;
|
|
571
573
|
messageId: string | null;
|
|
572
574
|
announcementId: string | null;
|
|
@@ -578,6 +580,7 @@ export declare function findSubmissionByIdForClassMember(submissionId: string, c
|
|
|
578
580
|
name: string;
|
|
579
581
|
id: string;
|
|
580
582
|
userId: string | null;
|
|
583
|
+
folderId: string | null;
|
|
581
584
|
size: number | null;
|
|
582
585
|
uploadedAt: Date | null;
|
|
583
586
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -594,7 +597,6 @@ export declare function findSubmissionByIdForClassMember(submissionId: string, c
|
|
|
594
597
|
submissionId: string | null;
|
|
595
598
|
annotationId: string | null;
|
|
596
599
|
classDraftId: string | null;
|
|
597
|
-
folderId: string | null;
|
|
598
600
|
conversationId: string | null;
|
|
599
601
|
messageId: string | null;
|
|
600
602
|
announcementId: string | null;
|
|
@@ -650,6 +652,7 @@ export declare function findSubmissionForUpdate(submissionId: string, userId: st
|
|
|
650
652
|
color: string | null;
|
|
651
653
|
section: string;
|
|
652
654
|
syllabus: string | null;
|
|
655
|
+
departmentId: string | null;
|
|
653
656
|
};
|
|
654
657
|
markScheme: {
|
|
655
658
|
id: string;
|
|
@@ -663,8 +666,8 @@ export declare function findSubmissionForUpdate(submissionId: string, userId: st
|
|
|
663
666
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
664
667
|
id: string;
|
|
665
668
|
createdAt: Date | null;
|
|
666
|
-
modifiedAt: Date | null;
|
|
667
669
|
classId: string;
|
|
670
|
+
modifiedAt: Date | null;
|
|
668
671
|
title: string;
|
|
669
672
|
instructions: string;
|
|
670
673
|
dueDate: Date;
|
|
@@ -692,6 +695,7 @@ export declare function findSubmissionForUpdate(submissionId: string, userId: st
|
|
|
692
695
|
name: string;
|
|
693
696
|
id: string;
|
|
694
697
|
userId: string | null;
|
|
698
|
+
folderId: string | null;
|
|
695
699
|
size: number | null;
|
|
696
700
|
uploadedAt: Date | null;
|
|
697
701
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -708,7 +712,6 @@ export declare function findSubmissionForUpdate(submissionId: string, userId: st
|
|
|
708
712
|
submissionId: string | null;
|
|
709
713
|
annotationId: string | null;
|
|
710
714
|
classDraftId: string | null;
|
|
711
|
-
folderId: string | null;
|
|
712
715
|
conversationId: string | null;
|
|
713
716
|
messageId: string | null;
|
|
714
717
|
announcementId: string | null;
|
|
@@ -720,6 +723,7 @@ export declare function findSubmissionForUpdate(submissionId: string, userId: st
|
|
|
720
723
|
name: string;
|
|
721
724
|
id: string;
|
|
722
725
|
userId: string | null;
|
|
726
|
+
folderId: string | null;
|
|
723
727
|
size: number | null;
|
|
724
728
|
uploadedAt: Date | null;
|
|
725
729
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -736,7 +740,6 @@ export declare function findSubmissionForUpdate(submissionId: string, userId: st
|
|
|
736
740
|
submissionId: string | null;
|
|
737
741
|
annotationId: string | null;
|
|
738
742
|
classDraftId: string | null;
|
|
739
|
-
folderId: string | null;
|
|
740
743
|
conversationId: string | null;
|
|
741
744
|
messageId: string | null;
|
|
742
745
|
announcementId: string | null;
|
|
@@ -776,6 +779,7 @@ export declare function createSubmission(assignmentId: string, studentId: string
|
|
|
776
779
|
color: string | null;
|
|
777
780
|
section: string;
|
|
778
781
|
syllabus: string | null;
|
|
782
|
+
departmentId: string | null;
|
|
779
783
|
};
|
|
780
784
|
markScheme: {
|
|
781
785
|
id: string;
|
|
@@ -793,8 +797,8 @@ export declare function createSubmission(assignmentId: string, studentId: string
|
|
|
793
797
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
794
798
|
id: string;
|
|
795
799
|
createdAt: Date | null;
|
|
796
|
-
modifiedAt: Date | null;
|
|
797
800
|
classId: string;
|
|
801
|
+
modifiedAt: Date | null;
|
|
798
802
|
title: string;
|
|
799
803
|
instructions: string;
|
|
800
804
|
dueDate: Date;
|
|
@@ -821,6 +825,7 @@ export declare function createSubmission(assignmentId: string, studentId: string
|
|
|
821
825
|
name: string;
|
|
822
826
|
id: string;
|
|
823
827
|
userId: string | null;
|
|
828
|
+
folderId: string | null;
|
|
824
829
|
size: number | null;
|
|
825
830
|
uploadedAt: Date | null;
|
|
826
831
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -837,7 +842,6 @@ export declare function createSubmission(assignmentId: string, studentId: string
|
|
|
837
842
|
submissionId: string | null;
|
|
838
843
|
annotationId: string | null;
|
|
839
844
|
classDraftId: string | null;
|
|
840
|
-
folderId: string | null;
|
|
841
845
|
conversationId: string | null;
|
|
842
846
|
messageId: string | null;
|
|
843
847
|
announcementId: string | null;
|
|
@@ -849,6 +853,7 @@ export declare function createSubmission(assignmentId: string, studentId: string
|
|
|
849
853
|
name: string;
|
|
850
854
|
id: string;
|
|
851
855
|
userId: string | null;
|
|
856
|
+
folderId: string | null;
|
|
852
857
|
size: number | null;
|
|
853
858
|
uploadedAt: Date | null;
|
|
854
859
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -865,7 +870,6 @@ export declare function createSubmission(assignmentId: string, studentId: string
|
|
|
865
870
|
submissionId: string | null;
|
|
866
871
|
annotationId: string | null;
|
|
867
872
|
classDraftId: string | null;
|
|
868
|
-
folderId: string | null;
|
|
869
873
|
conversationId: string | null;
|
|
870
874
|
messageId: string | null;
|
|
871
875
|
announcementId: string | null;
|
|
@@ -913,13 +917,14 @@ export declare function findAssignmentWithClassForTeacher(assignmentId: string,
|
|
|
913
917
|
color: string | null;
|
|
914
918
|
section: string;
|
|
915
919
|
syllabus: string | null;
|
|
920
|
+
departmentId: string | null;
|
|
916
921
|
};
|
|
917
922
|
} & {
|
|
918
923
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
919
924
|
id: string;
|
|
920
925
|
createdAt: Date | null;
|
|
921
|
-
modifiedAt: Date | null;
|
|
922
926
|
classId: string;
|
|
927
|
+
modifiedAt: Date | null;
|
|
923
928
|
title: string;
|
|
924
929
|
instructions: string;
|
|
925
930
|
dueDate: Date;
|
|
@@ -956,8 +961,8 @@ export declare function duplicateAssignment(sourceAssignmentId: string, targetCl
|
|
|
956
961
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
957
962
|
id: string;
|
|
958
963
|
createdAt: Date | null;
|
|
959
|
-
modifiedAt: Date | null;
|
|
960
964
|
classId: string;
|
|
965
|
+
modifiedAt: Date | null;
|
|
961
966
|
title: string;
|
|
962
967
|
instructions: string;
|
|
963
968
|
dueDate: Date;
|
|
@@ -989,6 +994,7 @@ export declare function findSubmissionsByAssignmentForTeacher(assignmentId: stri
|
|
|
989
994
|
color: string | null;
|
|
990
995
|
section: string;
|
|
991
996
|
syllabus: string | null;
|
|
997
|
+
departmentId: string | null;
|
|
992
998
|
};
|
|
993
999
|
markScheme: {
|
|
994
1000
|
id: string;
|
|
@@ -1002,8 +1008,8 @@ export declare function findSubmissionsByAssignmentForTeacher(assignmentId: stri
|
|
|
1002
1008
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
1003
1009
|
id: string;
|
|
1004
1010
|
createdAt: Date | null;
|
|
1005
|
-
modifiedAt: Date | null;
|
|
1006
1011
|
classId: string;
|
|
1012
|
+
modifiedAt: Date | null;
|
|
1007
1013
|
title: string;
|
|
1008
1014
|
instructions: string;
|
|
1009
1015
|
dueDate: Date;
|
|
@@ -1031,6 +1037,7 @@ export declare function findSubmissionsByAssignmentForTeacher(assignmentId: stri
|
|
|
1031
1037
|
name: string;
|
|
1032
1038
|
id: string;
|
|
1033
1039
|
userId: string | null;
|
|
1040
|
+
folderId: string | null;
|
|
1034
1041
|
size: number | null;
|
|
1035
1042
|
uploadedAt: Date | null;
|
|
1036
1043
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -1047,7 +1054,6 @@ export declare function findSubmissionsByAssignmentForTeacher(assignmentId: stri
|
|
|
1047
1054
|
submissionId: string | null;
|
|
1048
1055
|
annotationId: string | null;
|
|
1049
1056
|
classDraftId: string | null;
|
|
1050
|
-
folderId: string | null;
|
|
1051
1057
|
conversationId: string | null;
|
|
1052
1058
|
messageId: string | null;
|
|
1053
1059
|
announcementId: string | null;
|
|
@@ -1059,6 +1065,7 @@ export declare function findSubmissionsByAssignmentForTeacher(assignmentId: stri
|
|
|
1059
1065
|
name: string;
|
|
1060
1066
|
id: string;
|
|
1061
1067
|
userId: string | null;
|
|
1068
|
+
folderId: string | null;
|
|
1062
1069
|
size: number | null;
|
|
1063
1070
|
uploadedAt: Date | null;
|
|
1064
1071
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -1075,7 +1082,6 @@ export declare function findSubmissionsByAssignmentForTeacher(assignmentId: stri
|
|
|
1075
1082
|
submissionId: string | null;
|
|
1076
1083
|
annotationId: string | null;
|
|
1077
1084
|
classDraftId: string | null;
|
|
1078
|
-
folderId: string | null;
|
|
1079
1085
|
conversationId: string | null;
|
|
1080
1086
|
messageId: string | null;
|
|
1081
1087
|
announcementId: string | null;
|
|
@@ -1118,6 +1124,7 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1118
1124
|
color: string | null;
|
|
1119
1125
|
section: string;
|
|
1120
1126
|
syllabus: string | null;
|
|
1127
|
+
departmentId: string | null;
|
|
1121
1128
|
};
|
|
1122
1129
|
markScheme: {
|
|
1123
1130
|
id: string;
|
|
@@ -1131,8 +1138,8 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1131
1138
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
1132
1139
|
id: string;
|
|
1133
1140
|
createdAt: Date | null;
|
|
1134
|
-
modifiedAt: Date | null;
|
|
1135
1141
|
classId: string;
|
|
1142
|
+
modifiedAt: Date | null;
|
|
1136
1143
|
title: string;
|
|
1137
1144
|
instructions: string;
|
|
1138
1145
|
dueDate: Date;
|
|
@@ -1160,6 +1167,7 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1160
1167
|
name: string;
|
|
1161
1168
|
id: string;
|
|
1162
1169
|
userId: string | null;
|
|
1170
|
+
folderId: string | null;
|
|
1163
1171
|
size: number | null;
|
|
1164
1172
|
uploadedAt: Date | null;
|
|
1165
1173
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -1176,7 +1184,6 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1176
1184
|
submissionId: string | null;
|
|
1177
1185
|
annotationId: string | null;
|
|
1178
1186
|
classDraftId: string | null;
|
|
1179
|
-
folderId: string | null;
|
|
1180
1187
|
conversationId: string | null;
|
|
1181
1188
|
messageId: string | null;
|
|
1182
1189
|
announcementId: string | null;
|
|
@@ -1188,6 +1195,7 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1188
1195
|
name: string;
|
|
1189
1196
|
id: string;
|
|
1190
1197
|
userId: string | null;
|
|
1198
|
+
folderId: string | null;
|
|
1191
1199
|
size: number | null;
|
|
1192
1200
|
uploadedAt: Date | null;
|
|
1193
1201
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -1204,7 +1212,6 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1204
1212
|
submissionId: string | null;
|
|
1205
1213
|
annotationId: string | null;
|
|
1206
1214
|
classDraftId: string | null;
|
|
1207
|
-
folderId: string | null;
|
|
1208
1215
|
conversationId: string | null;
|
|
1209
1216
|
messageId: string | null;
|
|
1210
1217
|
announcementId: string | null;
|
|
@@ -1217,6 +1224,7 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1217
1224
|
name: string;
|
|
1218
1225
|
id: string;
|
|
1219
1226
|
userId: string | null;
|
|
1227
|
+
folderId: string | null;
|
|
1220
1228
|
size: number | null;
|
|
1221
1229
|
uploadedAt: Date | null;
|
|
1222
1230
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -1233,7 +1241,6 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1233
1241
|
submissionId: string | null;
|
|
1234
1242
|
annotationId: string | null;
|
|
1235
1243
|
classDraftId: string | null;
|
|
1236
|
-
folderId: string | null;
|
|
1237
1244
|
conversationId: string | null;
|
|
1238
1245
|
messageId: string | null;
|
|
1239
1246
|
announcementId: string | null;
|
|
@@ -1245,6 +1252,7 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1245
1252
|
name: string;
|
|
1246
1253
|
id: string;
|
|
1247
1254
|
userId: string | null;
|
|
1255
|
+
folderId: string | null;
|
|
1248
1256
|
size: number | null;
|
|
1249
1257
|
uploadedAt: Date | null;
|
|
1250
1258
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
@@ -1261,7 +1269,6 @@ export declare function findSubmissionForTeacherUpdate(submissionId: string, tea
|
|
|
1261
1269
|
submissionId: string | null;
|
|
1262
1270
|
annotationId: string | null;
|
|
1263
1271
|
classDraftId: string | null;
|
|
1264
|
-
folderId: string | null;
|
|
1265
1272
|
conversationId: string | null;
|
|
1266
1273
|
messageId: string | null;
|
|
1267
1274
|
announcementId: string | null;
|
|
@@ -1326,8 +1333,8 @@ export declare function attachAssignmentToEvent(assignmentId: string, eventId: s
|
|
|
1326
1333
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
1327
1334
|
id: string;
|
|
1328
1335
|
createdAt: Date | null;
|
|
1329
|
-
modifiedAt: Date | null;
|
|
1330
1336
|
classId: string;
|
|
1337
|
+
modifiedAt: Date | null;
|
|
1331
1338
|
title: string;
|
|
1332
1339
|
instructions: string;
|
|
1333
1340
|
dueDate: Date;
|
|
@@ -1380,8 +1387,8 @@ export declare function detachAssignmentFromEvent(assignmentId: string): import(
|
|
|
1380
1387
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
1381
1388
|
id: string;
|
|
1382
1389
|
createdAt: Date | null;
|
|
1383
|
-
modifiedAt: Date | null;
|
|
1384
1390
|
classId: string;
|
|
1391
|
+
modifiedAt: Date | null;
|
|
1385
1392
|
title: string;
|
|
1386
1393
|
instructions: string;
|
|
1387
1394
|
dueDate: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignment.d.ts","sourceRoot":"/","sources":["models/assignment.ts"],"names":[],"mappings":"AA+CA,iCAAiC;AACjC,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAI5C;AAED,qDAAqD;AACrD,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKnD;AAED,uDAAuD;AACvD,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmBpE;AAED,sCAAsC;AACtC,wBAAgB,uBAAuB;;;;;;;;;;;KAetC;AAED,qDAAqD;AACrD,wBAAgB,oCAAoC,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"assignment.d.ts","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AAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoBrF;AAED,yEAAyE;AACzE,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;;;;;;;;KAiBrF;AAiBD,kCAAkC;AAClC,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM5E;AAED,oCAAoC;AACpC,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM7D"}
|
package/dist/models/auth.d.ts
CHANGED
|
@@ -34,7 +34,6 @@ export declare function findUserByUsernameOrEmail(username: string, email: strin
|
|
|
34
34
|
export declare function findUserByEmail(email: string): import(".prisma/client").Prisma.Prisma__UserClient<{
|
|
35
35
|
id: string;
|
|
36
36
|
email: string;
|
|
37
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
38
37
|
profile: {
|
|
39
38
|
location: string | null;
|
|
40
39
|
displayName: string | null;
|
|
@@ -118,7 +117,6 @@ export declare function deleteUserById(id: string): import(".prisma/client").Pri
|
|
|
118
117
|
email: string;
|
|
119
118
|
password: string;
|
|
120
119
|
verified: boolean;
|
|
121
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
122
120
|
schoolId: string | null;
|
|
123
121
|
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
124
122
|
datasources: {
|
|
@@ -168,7 +166,6 @@ export declare function updateUserVerified(userId: string, verified: boolean): i
|
|
|
168
166
|
email: string;
|
|
169
167
|
password: string;
|
|
170
168
|
verified: boolean;
|
|
171
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
172
169
|
schoolId: string | null;
|
|
173
170
|
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
174
171
|
datasources: {
|
|
@@ -184,7 +181,6 @@ export declare function updateUserPassword(userId: string, password: string): im
|
|
|
184
181
|
email: string;
|
|
185
182
|
password: string;
|
|
186
183
|
verified: boolean;
|
|
187
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
188
184
|
schoolId: string | null;
|
|
189
185
|
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
190
186
|
datasources: {
|
|
@@ -217,6 +213,7 @@ export declare function findClassWithMember(classId: string, userId: string): im
|
|
|
217
213
|
color: string | null;
|
|
218
214
|
section: string;
|
|
219
215
|
syllabus: string | null;
|
|
216
|
+
departmentId: string | null;
|
|
220
217
|
} | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
221
218
|
datasources: {
|
|
222
219
|
db: {
|
|
@@ -233,6 +230,7 @@ export declare function findClassWithTeacher(classId: string, teacherId: string)
|
|
|
233
230
|
color: string | null;
|
|
234
231
|
section: string;
|
|
235
232
|
syllabus: string | null;
|
|
233
|
+
departmentId: string | null;
|
|
236
234
|
} | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
237
235
|
datasources: {
|
|
238
236
|
db: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"/","sources":["models/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAuB7C,+DAA+D;AAC/D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;GAWlD;AAED,0CAA0C;AAC1C,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;;;;;;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AM;;;;;;;;;;;;;GAIxC;AAED,uCAAuC;AACvC,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;;;;;;;;;;;;;GAInE;AAED,iDAAiD;AACjD,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;;;;;;;;;;;;;;;;;GAO3E;AAED,gCAAgC;AAChC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO;;;;;;;;;;;;;GAKnE;AAED,4BAA4B;AAC5B,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;;;;;;;GAKlE;AAED,wBAAwB;AACxB,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,MAAM;;;;;;;GAKjD;AAED,iGAAiG;AACjG,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,MAAM,gBAqCzD;AAED,kDAAkD;AAClD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM;;KAKxD;AAED,oDAAoD;AACpD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;GAOlE;AAED,2DAA2D;AAC3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;GAOtE"}
|
package/dist/models/auth.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* findUserBySessionToken checks Redis first, then DB.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
6
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0a142abe-c24b-5549-932f-108cd325b0ee")}catch(e){}}();
|
|
7
7
|
import { SessionType } from "@prisma/client";
|
|
8
8
|
import { getRedis } from "../lib/redis.js";
|
|
9
9
|
import { prisma } from "../lib/prisma.js";
|
|
@@ -53,7 +53,6 @@ export function findUserByEmail(email) {
|
|
|
53
53
|
select: {
|
|
54
54
|
id: true,
|
|
55
55
|
email: true,
|
|
56
|
-
role: true,
|
|
57
56
|
profile: {
|
|
58
57
|
select: {
|
|
59
58
|
displayName: true,
|
|
@@ -234,4 +233,4 @@ export function findClassWithTeacher(classId, teacherId) {
|
|
|
234
233
|
});
|
|
235
234
|
}
|
|
236
235
|
//# sourceMappingURL=auth.js.map
|
|
237
|
-
//# debugId=
|
|
236
|
+
//# debugId=0a142abe-c24b-5549-932f-108cd325b0ee
|
package/dist/models/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["models/auth.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Auth model – user lookup, session CRUD, Redis session cache.\n * findUserBySessionToken checks Redis first, then DB.\n */\nimport { SessionType } from \"@prisma/client\";\nimport { getRedis } from \"../lib/redis.js\";\nimport { prisma } from \"../lib/prisma.js\";\nimport {\n classMemberOrSchoolAdminWhere,\n classTeacherOrSchoolAdminWhere,\n} from \"./access.js\";\n\nconst AUTH_SESSION_CACHE_PREFIX = \"auth-session:\";\n\nfunction getAuthSessionCacheKey(token: string) {\n return `${AUTH_SESSION_CACHE_PREFIX}${token}`;\n}\n\nfunction getSessionTtlSeconds(expiresAt?: Date | null) {\n if (!expiresAt) {\n return null;\n }\n\n const ttlSeconds = Math.floor((expiresAt.getTime() - Date.now()) / 1000);\n return ttlSeconds > 0 ? ttlSeconds : null;\n}\n\n/** @returns User by username (includes password for login). */\nexport function findUserByUsername(username: string) {\n return prisma.user.findFirst({\n where: { username },\n select: {\n id: true,\n username: true,\n password: true,\n email: true,\n verified: true,\n },\n });\n}\n\n/** @returns User by username or email. */\nexport function findUserByUsernameOrEmail(username: string, email: string) {\n return prisma.user.findFirst({\n where: {\n OR: [{ username }, { email }],\n },\n select: {\n id: true,\n username: true,\n email: true,\n verified: true,\n },\n });\n}\n\n/** @returns User by email with profile. */\nexport function findUserByEmail(email: string) {\n return prisma.user.findFirst({\n where: { email },\n select: {\n id: true,\n email: true,\n role: true,\n profile: {\n select: {\n displayName: true,\n bio: true,\n location: true,\n website: true,\n profilePicture: true,\n },\n },\n },\n });\n}\n\n/** @returns User by ID with profile. */\nexport function findUserById(id: string) {\n return prisma.user.findUnique({\n where: { id },\n select: {\n id: true,\n username: true,\n email: true,\n profile: {\n select: {\n displayName: true,\n bio: true,\n location: true,\n website: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n });\n}\n\n/** Create a user with empty profile. */\nexport function createUser(data: {\n username: string;\n email: string;\n password: string;\n verified?: boolean;\n}) {\n return prisma.user.create({\n data: {\n username: data.username,\n email: data.email,\n password: data.password,\n verified: data.verified ?? false,\n profile: { create: {} },\n },\n select: {\n id: true,\n username: true,\n email: true,\n },\n });\n}\n\n/** Create a session. */\nexport function createSession(data: {\n id: string;\n type: SessionType;\n expiresAt: Date;\n userId?: string;\n classId?: string;\n}) {\n return prisma.session.create({\n data,\n });\n}\n\n/** Delete all sessions for user. Invalidates Redis cache. */\nexport async function deleteSessionsByUserId(userId: string) {\n const sessions = await prisma.session.findMany({\n where: { userId },\n });\n for (const session of sessions) {\n await getRedis()?.del(getAuthSessionCacheKey(session.id));\n }\n return prisma.session.deleteMany({\n where: { userId },\n });\n}\n\n/** Delete password reset sessions expiring before date. */\nexport function deleteShortLivedSessionsByUserId(\n userId: string,\n expiresBefore: Date\n) {\n return prisma.session.deleteMany({\n where: {\n userId,\n type: SessionType.PASSWORD_RESET,\n expiresAt: { lte: expiresBefore },\n },\n });\n}\n\n/** Delete a user. */\nexport function deleteUserById(id: string) {\n return prisma.user.delete({\n where: { id },\n });\n}\n\n/** @returns Session by ID and type. */\nexport function findSessionByIdAndType(id: string, type: SessionType) {\n return prisma.session.findFirst({\n where: { id, type },\n });\n}\n\n/** @returns Session with user by ID and type. */\nexport function findSessionByIdWithUserAndType(id: string, type: SessionType) {\n return prisma.session.findFirst({\n where: { id, type },\n include: {\n user: { select: { id: true } },\n },\n });\n}\n\n/** Set user verified status. */\nexport function updateUserVerified(userId: string, verified: boolean) {\n return prisma.user.update({\n where: { id: userId },\n data: { verified },\n });\n}\n\n/** Update user password. */\nexport function updateUserPassword(userId: string, password: string) {\n return prisma.user.update({\n where: { id: userId },\n data: { password },\n });\n}\n\n/** Delete a session. */\nexport async function deleteSessionById(id: string) {\n await getRedis()?.del(getAuthSessionCacheKey(id));\n return prisma.session.delete({\n where: { id },\n });\n}\n\n/** @returns User from valid auth session token. Checks Redis first, then DB. Caches in Redis. */\nexport async function findUserBySessionToken(token: string) {\n const cacheKey = getAuthSessionCacheKey(token);\n const cachedUser = await getRedis()?.get(cacheKey);\n\n if (cachedUser) {\n return JSON.parse(cachedUser);\n }\n\n const session = await prisma.session.findFirst({\n where: {\n id: token,\n type: SessionType.AUTH,\n userId: { not: null },\n expiresAt: { gt: new Date() },\n },\n select: {\n expiresAt: true,\n user: {\n select: {\n id: true,\n username: true,\n },\n },\n },\n });\n\n if (!session?.user) {\n return null;\n }\n\n const ttlSeconds = getSessionTtlSeconds(session.expiresAt);\n const r = getRedis();\n if (r && ttlSeconds) {\n await r.setex(cacheKey, ttlSeconds, JSON.stringify(session.user));\n }\n\n return session.user;\n}\n\n/** @returns Class IDs where user is a teacher. */\nexport function findTeacherClassesByUserId(userId: string) {\n return prisma.class.findMany({\n where: classTeacherOrSchoolAdminWhere(userId),\n select: { id: true },\n });\n}\n\n/** @returns Class if user is student or teacher. */\nexport function findClassWithMember(classId: string, userId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classMemberOrSchoolAdminWhere(userId),\n },\n });\n}\n\n/** @returns Class if user is a teacher or school admin. */\nexport function findClassWithTeacher(classId: string, teacherId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classTeacherOrSchoolAdminWhere(teacherId),\n },\n });\n}\n"],"names":[],"mappings":"AAAA;;;GAGG;;;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AAErB,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAElD,SAAS,sBAAsB,CAAC,KAAa;IAC3C,OAAO,GAAG,yBAAyB,GAAG,KAAK,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,oBAAoB,CAAC,SAAuB;IACnD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACzE,OAAO,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;QAC3B,KAAK,EAAE,EAAE,QAAQ,EAAE;QACnB,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;SACf;KACF,CAAC,CAAC;AACL,CAAC;AAED,0CAA0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OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACvD,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC3B,KAAK,EAAE,8BAA8B,CAAC,MAAM,CAAC;QAC7C,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;KACrB,CAAC,CAAC;AACL,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAc;IACjE,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QAC5B,KAAK,EAAE;YACL,EAAE,EAAE,OAAO;YACX,GAAG,6BAA6B,CAAC,MAAM,CAAC;SACzC;KACF,CAAC,CAAC;AACL,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB;IACrE,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QAC5B,KAAK,EAAE;YACL,EAAE,EAAE,OAAO;YACX,GAAG,8BAA8B,CAAC,SAAS,CAAC;SAC7C;KACF,CAAC,CAAC;AACL,CAAC","debug_id":"e3101e01-922b-52d7-b98a-a20d1623f1be"}
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["models/auth.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Auth model – user lookup, session CRUD, Redis session cache.\n * findUserBySessionToken checks Redis first, then DB.\n */\nimport { SessionType } from \"@prisma/client\";\nimport { getRedis } from \"../lib/redis.js\";\nimport { prisma } from \"../lib/prisma.js\";\nimport {\n classMemberOrSchoolAdminWhere,\n classTeacherOrSchoolAdminWhere,\n} from \"./access.js\";\n\nconst AUTH_SESSION_CACHE_PREFIX = \"auth-session:\";\n\nfunction getAuthSessionCacheKey(token: string) {\n return `${AUTH_SESSION_CACHE_PREFIX}${token}`;\n}\n\nfunction getSessionTtlSeconds(expiresAt?: Date | null) {\n if (!expiresAt) {\n return null;\n }\n\n const ttlSeconds = Math.floor((expiresAt.getTime() - Date.now()) / 1000);\n return ttlSeconds > 0 ? ttlSeconds : null;\n}\n\n/** @returns User by username (includes password for login). */\nexport function findUserByUsername(username: string) {\n return prisma.user.findFirst({\n where: { username },\n select: {\n id: true,\n username: true,\n password: true,\n email: true,\n verified: true,\n },\n });\n}\n\n/** @returns User by username or email. */\nexport function findUserByUsernameOrEmail(username: string, email: string) {\n return prisma.user.findFirst({\n where: {\n OR: [{ username }, { email }],\n },\n select: {\n id: true,\n username: true,\n email: true,\n verified: true,\n },\n });\n}\n\n/** @returns User by email with profile. */\nexport function findUserByEmail(email: string) {\n return prisma.user.findFirst({\n where: { email },\n select: {\n id: true,\n email: true,\n profile: {\n select: {\n displayName: true,\n bio: true,\n location: true,\n website: true,\n profilePicture: true,\n },\n },\n },\n });\n}\n\n/** @returns User by ID with profile. */\nexport function findUserById(id: string) {\n return prisma.user.findUnique({\n where: { id },\n select: {\n id: true,\n username: true,\n email: true,\n profile: {\n select: {\n displayName: true,\n bio: true,\n location: true,\n website: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n });\n}\n\n/** Create a user with empty profile. */\nexport function createUser(data: {\n username: string;\n email: string;\n password: string;\n verified?: boolean;\n}) {\n return prisma.user.create({\n data: {\n username: data.username,\n email: data.email,\n password: data.password,\n verified: data.verified ?? false,\n profile: { create: {} },\n },\n select: {\n id: true,\n username: true,\n email: true,\n },\n });\n}\n\n/** Create a session. */\nexport function createSession(data: {\n id: string;\n type: SessionType;\n expiresAt: Date;\n userId?: string;\n classId?: string;\n}) {\n return prisma.session.create({\n data,\n });\n}\n\n/** Delete all sessions for user. Invalidates Redis cache. */\nexport async function deleteSessionsByUserId(userId: string) {\n const sessions = await prisma.session.findMany({\n where: { userId },\n });\n for (const session of sessions) {\n await getRedis()?.del(getAuthSessionCacheKey(session.id));\n }\n return prisma.session.deleteMany({\n where: { userId },\n });\n}\n\n/** Delete password reset sessions expiring before date. */\nexport function deleteShortLivedSessionsByUserId(\n userId: string,\n expiresBefore: Date\n) {\n return prisma.session.deleteMany({\n where: {\n userId,\n type: SessionType.PASSWORD_RESET,\n expiresAt: { lte: expiresBefore },\n },\n });\n}\n\n/** Delete a user. */\nexport function deleteUserById(id: string) {\n return prisma.user.delete({\n where: { id },\n });\n}\n\n/** @returns Session by ID and type. */\nexport function findSessionByIdAndType(id: string, type: SessionType) {\n return prisma.session.findFirst({\n where: { id, type },\n });\n}\n\n/** @returns Session with user by ID and type. */\nexport function findSessionByIdWithUserAndType(id: string, type: SessionType) {\n return prisma.session.findFirst({\n where: { id, type },\n include: {\n user: { select: { id: true } },\n },\n });\n}\n\n/** Set user verified status. */\nexport function updateUserVerified(userId: string, verified: boolean) {\n return prisma.user.update({\n where: { id: userId },\n data: { verified },\n });\n}\n\n/** Update user password. */\nexport function updateUserPassword(userId: string, password: string) {\n return prisma.user.update({\n where: { id: userId },\n data: { password },\n });\n}\n\n/** Delete a session. */\nexport async function deleteSessionById(id: string) {\n await getRedis()?.del(getAuthSessionCacheKey(id));\n return prisma.session.delete({\n where: { id },\n });\n}\n\n/** @returns User from valid auth session token. Checks Redis first, then DB. Caches in Redis. */\nexport async function findUserBySessionToken(token: string) {\n const cacheKey = getAuthSessionCacheKey(token);\n const cachedUser = await getRedis()?.get(cacheKey);\n\n if (cachedUser) {\n return JSON.parse(cachedUser);\n }\n\n const session = await prisma.session.findFirst({\n where: {\n id: token,\n type: SessionType.AUTH,\n userId: { not: null },\n expiresAt: { gt: new Date() },\n },\n select: {\n expiresAt: true,\n user: {\n select: {\n id: true,\n username: true,\n },\n },\n },\n });\n\n if (!session?.user) {\n return null;\n }\n\n const ttlSeconds = getSessionTtlSeconds(session.expiresAt);\n const r = getRedis();\n if (r && ttlSeconds) {\n await r.setex(cacheKey, ttlSeconds, JSON.stringify(session.user));\n }\n\n return session.user;\n}\n\n/** @returns Class IDs where user is a teacher. */\nexport function findTeacherClassesByUserId(userId: string) {\n return prisma.class.findMany({\n where: classTeacherOrSchoolAdminWhere(userId),\n select: { id: true },\n });\n}\n\n/** @returns Class if user is student or teacher. */\nexport function findClassWithMember(classId: string, userId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classMemberOrSchoolAdminWhere(userId),\n },\n });\n}\n\n/** @returns Class if user is a teacher or school admin. */\nexport function findClassWithTeacher(classId: string, teacherId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classTeacherOrSchoolAdminWhere(teacherId),\n },\n });\n}\n"],"names":[],"mappings":"AAAA;;;GAGG;;;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AAErB,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAElD,SAAS,sBAAsB,CAAC,KAAa;IAC3C,OAAO,GAAG,yBAAyB,GAAG,KAAK,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,oBAAoB,CAAC,SAAuB;IACnD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACzE,OAAO,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;QAC3B,KAAK,EAAE,EAAE,QAAQ,EAAE;QACnB,MAAM,EAAE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