@studious-lms/server 1.4.6 → 1.4.7

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.
Files changed (148) hide show
  1. package/dist/models/access.d.ts +112 -0
  2. package/dist/models/access.d.ts.map +1 -0
  3. package/dist/models/access.js +49 -0
  4. package/dist/models/access.js.map +1 -0
  5. package/dist/models/announcement.d.ts +17 -2
  6. package/dist/models/announcement.d.ts.map +1 -1
  7. package/dist/models/announcement.js +21 -4
  8. package/dist/models/announcement.js.map +1 -1
  9. package/dist/models/assignment.d.ts +37 -37
  10. package/dist/models/assignment.d.ts.map +1 -1
  11. package/dist/models/assignment.js +15 -15
  12. package/dist/models/assignment.js.map +1 -1
  13. package/dist/models/attendance.d.ts +1 -1
  14. package/dist/models/attendance.d.ts.map +1 -1
  15. package/dist/models/attendance.js +6 -5
  16. package/dist/models/attendance.js.map +1 -1
  17. package/dist/models/auth.d.ts +5 -5
  18. package/dist/models/auth.d.ts.map +1 -1
  19. package/dist/models/auth.js +7 -11
  20. package/dist/models/auth.js.map +1 -1
  21. package/dist/models/class.d.ts +26 -26
  22. package/dist/models/class.d.ts.map +1 -1
  23. package/dist/models/class.js +7 -11
  24. package/dist/models/class.js.map +1 -1
  25. package/dist/models/comment.d.ts +134 -70
  26. package/dist/models/comment.d.ts.map +1 -1
  27. package/dist/models/comment.js +30 -42
  28. package/dist/models/comment.js.map +1 -1
  29. package/dist/models/conversation.d.ts +7 -7
  30. package/dist/models/event.d.ts +52 -3
  31. package/dist/models/event.d.ts.map +1 -1
  32. package/dist/models/event.js +56 -6
  33. package/dist/models/event.js.map +1 -1
  34. package/dist/models/file.d.ts +178 -103
  35. package/dist/models/file.d.ts.map +1 -1
  36. package/dist/models/file.js +54 -14
  37. package/dist/models/file.js.map +1 -1
  38. package/dist/models/folder.d.ts +22 -22
  39. package/dist/models/folder.d.ts.map +1 -1
  40. package/dist/models/folder.js +5 -4
  41. package/dist/models/folder.js.map +1 -1
  42. package/dist/models/labChat.d.ts +20 -20
  43. package/dist/models/labChat.d.ts.map +1 -1
  44. package/dist/models/labChat.js +8 -10
  45. package/dist/models/labChat.js.map +1 -1
  46. package/dist/models/marketing.d.ts +1 -1
  47. package/dist/models/message.d.ts +6 -6
  48. package/dist/models/newtonChat.d.ts +5 -5
  49. package/dist/models/school.d.ts +361 -0
  50. package/dist/models/school.d.ts.map +1 -0
  51. package/dist/models/school.js +314 -0
  52. package/dist/models/school.js.map +1 -0
  53. package/dist/models/section.d.ts +1 -1
  54. package/dist/models/section.d.ts.map +1 -1
  55. package/dist/models/section.js +5 -4
  56. package/dist/models/section.js.map +1 -1
  57. package/dist/models/user.d.ts +4 -4
  58. package/dist/models/worksheet.d.ts +65 -65
  59. package/dist/models/worksheet.d.ts.map +1 -1
  60. package/dist/models/worksheet.js +6 -14
  61. package/dist/models/worksheet.js.map +1 -1
  62. package/dist/pipelines/gradeWorksheet.d.ts +2 -2
  63. package/dist/pipelines/pdfToWorksheet.d.ts +1 -1
  64. package/dist/routers/_app.d.ts +2855 -2051
  65. package/dist/routers/_app.d.ts.map +1 -1
  66. package/dist/routers/_app.js +4 -2
  67. package/dist/routers/_app.js.map +1 -1
  68. package/dist/routers/announcement.d.ts +5 -5
  69. package/dist/routers/announcement.d.ts.map +1 -1
  70. package/dist/routers/announcement.js +25 -5
  71. package/dist/routers/announcement.js.map +1 -1
  72. package/dist/routers/assignment.d.ts +44 -44
  73. package/dist/routers/assignment.d.ts.map +1 -1
  74. package/dist/routers/assignment.js +24 -11
  75. package/dist/routers/assignment.js.map +1 -1
  76. package/dist/routers/class.d.ts +21 -20
  77. package/dist/routers/class.d.ts.map +1 -1
  78. package/dist/routers/class.js +3 -2
  79. package/dist/routers/class.js.map +1 -1
  80. package/dist/routers/comment.d.ts +5 -5
  81. package/dist/routers/conversation.d.ts +6 -6
  82. package/dist/routers/event.d.ts +21 -2
  83. package/dist/routers/event.d.ts.map +1 -1
  84. package/dist/routers/file.d.ts +2 -2
  85. package/dist/routers/folder.d.ts +24 -24
  86. package/dist/routers/labChat.d.ts +7 -7
  87. package/dist/routers/school.d.ts +384 -0
  88. package/dist/routers/school.d.ts.map +1 -0
  89. package/dist/routers/school.js +79 -0
  90. package/dist/routers/school.js.map +1 -0
  91. package/dist/routers/search.d.ts +1 -1
  92. package/dist/routers/worksheet.d.ts +21 -21
  93. package/dist/services/announcement.d.ts.map +1 -1
  94. package/dist/services/announcement.js +10 -6
  95. package/dist/services/announcement.js.map +1 -1
  96. package/dist/services/assignment.d.ts +36 -36
  97. package/dist/services/class.d.ts +20 -19
  98. package/dist/services/class.d.ts.map +1 -1
  99. package/dist/services/class.js +22 -3
  100. package/dist/services/class.js.map +1 -1
  101. package/dist/services/comment.d.ts +5 -5
  102. package/dist/services/comment.d.ts.map +1 -1
  103. package/dist/services/comment.js +8 -3
  104. package/dist/services/comment.js.map +1 -1
  105. package/dist/services/conversation.d.ts +6 -6
  106. package/dist/services/event.d.ts +21 -2
  107. package/dist/services/event.d.ts.map +1 -1
  108. package/dist/services/event.js +11 -7
  109. package/dist/services/event.js.map +1 -1
  110. package/dist/services/file.d.ts +2 -2
  111. package/dist/services/file.d.ts.map +1 -1
  112. package/dist/services/file.js +17 -8
  113. package/dist/services/file.js.map +1 -1
  114. package/dist/services/folder.d.ts +24 -24
  115. package/dist/services/labChat.d.ts +7 -7
  116. package/dist/services/school.d.ts +299 -0
  117. package/dist/services/school.d.ts.map +1 -0
  118. package/dist/services/school.js +225 -0
  119. package/dist/services/school.js.map +1 -0
  120. package/dist/services/worksheet.d.ts +21 -21
  121. package/package.json +1 -1
  122. package/prisma/migrations/20260504071500_school_memberships/migration.sql +81 -0
  123. package/prisma/schema.prisma +66 -2
  124. package/src/models/access.ts +48 -0
  125. package/src/models/announcement.ts +19 -2
  126. package/src/models/assignment.ts +17 -13
  127. package/src/models/attendance.ts +4 -3
  128. package/src/models/auth.ts +8 -9
  129. package/src/models/class.ts +8 -9
  130. package/src/models/comment.ts +29 -40
  131. package/src/models/event.ts +54 -4
  132. package/src/models/file.ts +53 -12
  133. package/src/models/folder.ts +3 -2
  134. package/src/models/labChat.ts +9 -8
  135. package/src/models/school.ts +361 -0
  136. package/src/models/section.ts +3 -2
  137. package/src/models/worksheet.ts +7 -12
  138. package/src/routers/_app.ts +2 -0
  139. package/src/routers/announcement.ts +30 -4
  140. package/src/routers/assignment.ts +27 -9
  141. package/src/routers/class.ts +1 -0
  142. package/src/routers/school.ts +122 -0
  143. package/src/services/announcement.ts +12 -4
  144. package/src/services/class.ts +25 -2
  145. package/src/services/comment.ts +10 -1
  146. package/src/services/event.ts +23 -6
  147. package/src/services/file.ts +20 -6
  148. package/src/services/school.ts +308 -0
@@ -189,12 +189,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
189
189
  output: {
190
190
  type: import(".prisma/client").$Enums.AssignmentType;
191
191
  id: string;
192
- submissions: {
193
- student: {
194
- id: string;
195
- username: string;
196
- };
197
- }[];
192
+ createdAt: Date | null;
198
193
  class: {
199
194
  name: string;
200
195
  id: string;
@@ -211,7 +206,12 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
211
206
  classId: string;
212
207
  order: number | null;
213
208
  } | null;
214
- createdAt: Date | null;
209
+ submissions: {
210
+ student: {
211
+ id: string;
212
+ username: string;
213
+ };
214
+ }[];
215
215
  title: string;
216
216
  instructions: string;
217
217
  dueDate: Date;
@@ -241,8 +241,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
241
241
  type: string;
242
242
  name: string;
243
243
  id: string;
244
- size: number | null;
245
244
  userId: string | null;
245
+ size: number | null;
246
246
  uploadedAt: Date | null;
247
247
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
248
248
  uploadUrl: string | null;
@@ -289,12 +289,6 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
289
289
  name: string;
290
290
  id: string;
291
291
  }[];
292
- submissions: {
293
- student: {
294
- id: string;
295
- username: string;
296
- };
297
- }[];
298
292
  class: {
299
293
  name: string;
300
294
  id: string;
@@ -303,6 +297,12 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
303
297
  name: string;
304
298
  id: string;
305
299
  } | null;
300
+ submissions: {
301
+ student: {
302
+ id: string;
303
+ username: string;
304
+ };
305
+ }[];
306
306
  markScheme: {
307
307
  id: string;
308
308
  structured: string;
@@ -425,8 +425,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
425
425
  type: string;
426
426
  name: string;
427
427
  id: string;
428
- size: number | null;
429
428
  userId: string | null;
429
+ size: number | null;
430
430
  uploadedAt: Date | null;
431
431
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
432
432
  uploadUrl: string | null;
@@ -453,8 +453,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
453
453
  type: string;
454
454
  name: string;
455
455
  id: string;
456
- size: number | null;
457
456
  userId: string | null;
457
+ size: number | null;
458
458
  uploadedAt: Date | null;
459
459
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
460
460
  uploadUrl: string | null;
@@ -481,8 +481,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
481
481
  username: string;
482
482
  };
483
483
  id: string;
484
- assignmentId: string;
485
484
  createdAt: Date;
485
+ assignmentId: string;
486
486
  modifiedAt: Date;
487
487
  studentId: string;
488
488
  extendedResponse: string | null;
@@ -559,8 +559,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
559
559
  type: string;
560
560
  name: string;
561
561
  id: string;
562
- size: number | null;
563
562
  userId: string | null;
563
+ size: number | null;
564
564
  uploadedAt: Date | null;
565
565
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
566
566
  uploadUrl: string | null;
@@ -587,8 +587,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
587
587
  type: string;
588
588
  name: string;
589
589
  id: string;
590
- size: number | null;
591
590
  userId: string | null;
591
+ size: number | null;
592
592
  uploadedAt: Date | null;
593
593
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
594
594
  uploadUrl: string | null;
@@ -615,10 +615,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
615
615
  username: string;
616
616
  profile: {
617
617
  id: string;
618
- userId: string;
619
618
  createdAt: Date;
620
- location: string | null;
621
619
  updatedAt: Date;
620
+ userId: string;
621
+ location: string | null;
622
622
  displayName: string | null;
623
623
  bio: string | null;
624
624
  website: string | null;
@@ -627,8 +627,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
627
627
  } | null;
628
628
  };
629
629
  id: string;
630
- assignmentId: string;
631
630
  createdAt: Date;
631
+ assignmentId: string;
632
632
  modifiedAt: Date;
633
633
  studentId: string;
634
634
  extendedResponse: string | null;
@@ -710,8 +710,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
710
710
  type: string;
711
711
  name: string;
712
712
  id: string;
713
- size: number | null;
714
713
  userId: string | null;
714
+ size: number | null;
715
715
  uploadedAt: Date | null;
716
716
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
717
717
  uploadUrl: string | null;
@@ -739,8 +739,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
739
739
  };
740
740
  } & {
741
741
  id: string;
742
- assignmentId: string;
743
742
  createdAt: Date;
743
+ assignmentId: string;
744
744
  modifiedAt: Date;
745
745
  studentId: string;
746
746
  extendedResponse: string | null;
@@ -814,8 +814,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
814
814
  type: string;
815
815
  name: string;
816
816
  id: string;
817
- size: number | null;
818
817
  userId: string | null;
818
+ size: number | null;
819
819
  uploadedAt: Date | null;
820
820
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
821
821
  uploadUrl: string | null;
@@ -842,8 +842,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
842
842
  type: string;
843
843
  name: string;
844
844
  id: string;
845
- size: number | null;
846
845
  userId: string | null;
846
+ size: number | null;
847
847
  uploadedAt: Date | null;
848
848
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
849
849
  uploadUrl: string | null;
@@ -875,8 +875,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
875
875
  } | null;
876
876
  };
877
877
  id: string;
878
- assignmentId: string;
879
878
  createdAt: Date;
879
+ assignmentId: string;
880
880
  modifiedAt: Date;
881
881
  studentId: string;
882
882
  extendedResponse: string | null;
@@ -922,10 +922,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
922
922
  } & {
923
923
  status: import(".prisma/client").$Enums.GenerationStatus | null;
924
924
  id: string;
925
+ createdAt: Date;
925
926
  assignmentId: string | null;
926
927
  submissionId: string | null;
927
928
  announcementId: string | null;
928
- createdAt: Date;
929
929
  modifiedAt: Date | null;
930
930
  content: string;
931
931
  authorId: string;
@@ -935,10 +935,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
935
935
  } & {
936
936
  status: import(".prisma/client").$Enums.GenerationStatus | null;
937
937
  id: string;
938
+ createdAt: Date;
938
939
  assignmentId: string | null;
939
940
  submissionId: string | null;
940
941
  announcementId: string | null;
941
- createdAt: Date;
942
942
  modifiedAt: Date | null;
943
943
  content: string;
944
944
  authorId: string;
@@ -980,10 +980,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
980
980
  } & {
981
981
  status: import(".prisma/client").$Enums.GenerationStatus | null;
982
982
  id: string;
983
+ createdAt: Date;
983
984
  assignmentId: string | null;
984
985
  submissionId: string | null;
985
986
  announcementId: string | null;
986
- createdAt: Date;
987
987
  modifiedAt: Date | null;
988
988
  content: string;
989
989
  authorId: string;
@@ -993,10 +993,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
993
993
  } & {
994
994
  status: import(".prisma/client").$Enums.GenerationStatus | null;
995
995
  id: string;
996
+ createdAt: Date;
996
997
  assignmentId: string | null;
997
998
  submissionId: string | null;
998
999
  announcementId: string | null;
999
- createdAt: Date;
1000
1000
  modifiedAt: Date | null;
1001
1001
  content: string;
1002
1002
  authorId: string;
@@ -1037,10 +1037,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1037
1037
  } & {
1038
1038
  status: import(".prisma/client").$Enums.GenerationStatus | null;
1039
1039
  id: string;
1040
+ createdAt: Date;
1040
1041
  assignmentId: string | null;
1041
1042
  submissionId: string | null;
1042
1043
  announcementId: string | null;
1043
- createdAt: Date;
1044
1044
  modifiedAt: Date | null;
1045
1045
  content: string;
1046
1046
  authorId: string;
@@ -1050,10 +1050,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1050
1050
  } & {
1051
1051
  status: import(".prisma/client").$Enums.GenerationStatus | null;
1052
1052
  id: string;
1053
+ createdAt: Date;
1053
1054
  assignmentId: string | null;
1054
1055
  submissionId: string | null;
1055
1056
  announcementId: string | null;
1056
- createdAt: Date;
1057
1057
  modifiedAt: Date | null;
1058
1058
  content: string;
1059
1059
  authorId: string;
@@ -1096,10 +1096,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1096
1096
  } & {
1097
1097
  status: import(".prisma/client").$Enums.GenerationStatus | null;
1098
1098
  id: string;
1099
+ createdAt: Date;
1099
1100
  assignmentId: string | null;
1100
1101
  submissionId: string | null;
1101
1102
  announcementId: string | null;
1102
- createdAt: Date;
1103
1103
  modifiedAt: Date | null;
1104
1104
  content: string;
1105
1105
  authorId: string;
@@ -1109,10 +1109,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1109
1109
  } & {
1110
1110
  status: import(".prisma/client").$Enums.GenerationStatus | null;
1111
1111
  id: string;
1112
+ createdAt: Date;
1112
1113
  assignmentId: string | null;
1113
1114
  submissionId: string | null;
1114
1115
  announcementId: string | null;
1115
- createdAt: Date;
1116
1116
  modifiedAt: Date | null;
1117
1117
  content: string;
1118
1118
  authorId: string;
@@ -1196,8 +1196,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1196
1196
  type: string;
1197
1197
  name: string;
1198
1198
  id: string;
1199
- size: number | null;
1200
1199
  userId: string | null;
1200
+ size: number | null;
1201
1201
  uploadedAt: Date | null;
1202
1202
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1203
1203
  uploadUrl: string | null;
@@ -1224,8 +1224,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1224
1224
  type: string;
1225
1225
  name: string;
1226
1226
  id: string;
1227
- size: number | null;
1228
1227
  userId: string | null;
1228
+ size: number | null;
1229
1229
  uploadedAt: Date | null;
1230
1230
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1231
1231
  uploadUrl: string | null;
@@ -1253,8 +1253,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1253
1253
  type: string;
1254
1254
  name: string;
1255
1255
  id: string;
1256
- size: number | null;
1257
1256
  userId: string | null;
1257
+ size: number | null;
1258
1258
  uploadedAt: Date | null;
1259
1259
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1260
1260
  uploadUrl: string | null;
@@ -1281,8 +1281,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1281
1281
  type: string;
1282
1282
  name: string;
1283
1283
  id: string;
1284
- size: number | null;
1285
1284
  userId: string | null;
1285
+ size: number | null;
1286
1286
  uploadedAt: Date | null;
1287
1287
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1288
1288
  uploadUrl: string | null;
@@ -1315,8 +1315,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1315
1315
  };
1316
1316
  } & {
1317
1317
  id: string;
1318
- assignmentId: string;
1319
1318
  createdAt: Date;
1319
+ assignmentId: string;
1320
1320
  modifiedAt: Date;
1321
1321
  studentId: string;
1322
1322
  extendedResponse: string | null;
@@ -1516,8 +1516,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1516
1516
  type: string;
1517
1517
  name: string;
1518
1518
  id: string;
1519
- size: number | null;
1520
1519
  userId: string | null;
1520
+ size: number | null;
1521
1521
  uploadedAt: Date | null;
1522
1522
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1523
1523
  uploadUrl: string | null;
@@ -1611,8 +1611,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1611
1611
  type: string;
1612
1612
  name: string;
1613
1613
  id: string;
1614
- size: number | null;
1615
1614
  userId: string | null;
1615
+ size: number | null;
1616
1616
  uploadedAt: Date | null;
1617
1617
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1618
1618
  uploadUrl: string | null;
@@ -1707,8 +1707,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1707
1707
  type: string;
1708
1708
  name: string;
1709
1709
  id: string;
1710
- size: number | null;
1711
1710
  userId: string | null;
1711
+ size: number | null;
1712
1712
  uploadedAt: Date | null;
1713
1713
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1714
1714
  uploadUrl: string | null;
@@ -1802,8 +1802,8 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1802
1802
  type: string;
1803
1803
  name: string;
1804
1804
  id: string;
1805
- size: number | null;
1806
1805
  userId: string | null;
1806
+ size: number | null;
1807
1807
  uploadedAt: Date | null;
1808
1808
  uploadStatus: import(".prisma/client").$Enums.UploadStatus;
1809
1809
  uploadUrl: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"assignment.d.ts","sourceRoot":"/","sources":["routers/assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAA2B,KAAK,gBAAgB,EAAgE,MAAM,sBAAsB,CAAC;AAsOpJ,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ypB3B,CAAC"}
@@ -1,10 +1,11 @@
1
1
 
2
- !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]="1e544bfd-5929-552d-a49c-f0ca8b5232fe")}catch(e){}}();
2
+ !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]="ebda66e0-9fb9-5d7f-97c5-c3e67027f4a8")}catch(e){}}();
3
3
  import { z } from "zod";
4
4
  import { createTRPCRouter, protectedProcedure, protectedClassMemberProcedure, protectedTeacherProcedure } from "../trpc.js";
5
5
  import { TRPCError } from "@trpc/server";
6
6
  import { prisma } from "../lib/prisma.js";
7
7
  import { createDirectUploadFiles, confirmDirectUpload, updateUploadProgress } from "../lib/fileUpload.js";
8
+ import { classMemberOrSchoolAdminWhere, classTeacherOrSchoolAdminWhere, } from "../models/access.js";
8
9
  import { assignmentExists, getDueToday, getAssignment, getSubmission, getSubmissionById, getSubmissions, createAssignmentRecord, updateAssignmentRecord, deleteAssignmentRecord, updateSubmissionRecord, updateSubmissionAsTeacherRecord, attachAssignmentToEventRecord, detachAssignmentFromEventRecord, getAvailableEventsForAssignment, attachMarkSchemeRecord, detachMarkSchemeRecord, attachGradingBoundaryRecord, detachGradingBoundaryRecord, reorderAssignmentRecord, moveAssignmentRecord, } from "../services/assignment.js";
9
10
  // DEPRECATED: This schema is no longer used - files are uploaded directly to GCS
10
11
  // Use directFileSchema instead
@@ -322,16 +323,11 @@ export const assignmentRouter = createTRPCRouter({
322
323
  assignmentId: input.assignmentId,
323
324
  assignment: {
324
325
  classId: input.classId,
325
- class: {
326
- OR: [
327
- { teachers: { some: { id: ctx.user.id } } },
328
- { students: { some: { id: ctx.user.id } } },
329
- ],
330
- },
326
+ class: classMemberOrSchoolAdminWhere(ctx.user.id),
331
327
  },
332
328
  OR: [
333
329
  { studentId: ctx.user.id },
334
- { assignment: { class: { teachers: { some: { id: ctx.user.id } } } } },
330
+ { assignment: { class: classTeacherOrSchoolAdminWhere(ctx.user.id) } },
335
331
  ],
336
332
  },
337
333
  select: { id: true },
@@ -362,7 +358,7 @@ export const assignmentRouter = createTRPCRouter({
362
358
  assignment: { classId: input.classId },
363
359
  OR: [
364
360
  { studentId: ctx.user.id },
365
- { assignment: { class: { teachers: { some: { id: ctx.user.id } } } } },
361
+ { assignment: { class: classTeacherOrSchoolAdminWhere(ctx.user.id) } },
366
362
  ],
367
363
  },
368
364
  select: { id: true },
@@ -516,6 +512,21 @@ export const assignmentRouter = createTRPCRouter({
516
512
  include: {
517
513
  students: true,
518
514
  teachers: true,
515
+ school: {
516
+ include: {
517
+ users: {
518
+ where: { role: "ADMIN" },
519
+ select: { id: true },
520
+ },
521
+ memberships: {
522
+ where: {
523
+ role: "ADMIN",
524
+ status: "ACTIVE",
525
+ },
526
+ select: { userId: true },
527
+ },
528
+ },
529
+ },
519
530
  },
520
531
  },
521
532
  },
@@ -531,7 +542,9 @@ export const assignmentRouter = createTRPCRouter({
531
542
  // Check if user is the student who owns the submission or a teacher of the class
532
543
  const isStudent = submission.studentId === ctx.user.id;
533
544
  const isTeacher = submission.assignment.class.teachers.some(teacher => teacher.id === ctx.user?.id);
534
- if (!isStudent && !isTeacher) {
545
+ const isSchoolAdmin = Boolean(submission.assignment.class.school?.memberships.some(admin => admin.userId === ctx.user?.id) ||
546
+ submission.assignment.class.school?.users.some(admin => admin.id === ctx.user?.id));
547
+ if (!isStudent && !isTeacher && !isSchoolAdmin) {
535
548
  throw new TRPCError({
536
549
  code: "FORBIDDEN",
537
550
  message: "You don't have permission to upload files to this submission",
@@ -724,4 +737,4 @@ export const assignmentRouter = createTRPCRouter({
724
737
  }),
725
738
  });
726
739
  //# sourceMappingURL=assignment.js.map
727
- //# debugId=1e544bfd-5929-552d-a49c-f0ca8b5232fe
740
+ //# debugId=ebda66e0-9fb9-5d7f-97c5-c3e67027f4a8