@studious-lms/server 1.7.0 → 1.8.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.
Files changed (196) hide show
  1. package/dist/models/access.d.ts +21 -66
  2. package/dist/models/access.d.ts.map +1 -1
  3. package/dist/models/access.js +10 -26
  4. package/dist/models/access.js.map +1 -1
  5. package/dist/models/agenda.d.ts +2 -0
  6. package/dist/models/agenda.d.ts.map +1 -1
  7. package/dist/models/announcement.d.ts +2 -1
  8. package/dist/models/announcement.d.ts.map +1 -1
  9. package/dist/models/announcement.js +2 -3
  10. package/dist/models/announcement.js.map +1 -1
  11. package/dist/models/assignment.d.ts +7 -0
  12. package/dist/models/assignment.d.ts.map +1 -1
  13. package/dist/models/auth.d.ts +2 -4
  14. package/dist/models/auth.d.ts.map +1 -1
  15. package/dist/models/auth.js +2 -3
  16. package/dist/models/auth.js.map +1 -1
  17. package/dist/models/class.d.ts +32 -4
  18. package/dist/models/class.d.ts.map +1 -1
  19. package/dist/models/class.js +15 -2
  20. package/dist/models/class.js.map +1 -1
  21. package/dist/models/cloudStorage.d.ts +140 -0
  22. package/dist/models/cloudStorage.d.ts.map +1 -0
  23. package/dist/models/cloudStorage.js +175 -0
  24. package/dist/models/cloudStorage.js.map +1 -0
  25. package/dist/models/comment.d.ts +0 -24
  26. package/dist/models/comment.d.ts.map +1 -1
  27. package/dist/models/comment.js +2 -6
  28. package/dist/models/comment.js.map +1 -1
  29. package/dist/models/conversation.d.ts +22 -22
  30. package/dist/models/department.d.ts +154 -0
  31. package/dist/models/department.d.ts.map +1 -0
  32. package/dist/models/department.js +135 -0
  33. package/dist/models/department.js.map +1 -0
  34. package/dist/models/event.d.ts +7 -1
  35. package/dist/models/event.d.ts.map +1 -1
  36. package/dist/models/event.js +2 -5
  37. package/dist/models/event.js.map +1 -1
  38. package/dist/models/file.d.ts +25 -10
  39. package/dist/models/file.d.ts.map +1 -1
  40. package/dist/models/file.js +2 -5
  41. package/dist/models/file.js.map +1 -1
  42. package/dist/models/folder.d.ts +47 -0
  43. package/dist/models/folder.d.ts.map +1 -1
  44. package/dist/models/labChat.d.ts +5 -3
  45. package/dist/models/labChat.d.ts.map +1 -1
  46. package/dist/models/message.d.ts +46 -12
  47. package/dist/models/message.d.ts.map +1 -1
  48. package/dist/models/message.js +19 -10
  49. package/dist/models/message.js.map +1 -1
  50. package/dist/models/newtonChat.d.ts +2 -1
  51. package/dist/models/newtonChat.d.ts.map +1 -1
  52. package/dist/models/school.d.ts +45 -12
  53. package/dist/models/school.d.ts.map +1 -1
  54. package/dist/models/school.js +19 -2
  55. package/dist/models/school.js.map +1 -1
  56. package/dist/models/section.d.ts +1 -0
  57. package/dist/models/section.d.ts.map +1 -1
  58. package/dist/models/tag.d.ts +117 -0
  59. package/dist/models/tag.d.ts.map +1 -0
  60. package/dist/models/tag.js +113 -0
  61. package/dist/models/tag.js.map +1 -0
  62. package/dist/models/worksheet.d.ts +3 -0
  63. package/dist/models/worksheet.d.ts.map +1 -1
  64. package/dist/pipelines/aiLabChatContract.d.ts +8 -8
  65. package/dist/routers/_app.d.ts +3200 -1972
  66. package/dist/routers/_app.d.ts.map +1 -1
  67. package/dist/routers/_app.js +6 -2
  68. package/dist/routers/_app.js.map +1 -1
  69. package/dist/routers/agenda.d.ts +2 -0
  70. package/dist/routers/agenda.d.ts.map +1 -1
  71. package/dist/routers/announcement.d.ts.map +1 -1
  72. package/dist/routers/announcement.js +3 -5
  73. package/dist/routers/announcement.js.map +1 -1
  74. package/dist/routers/assignment.d.ts +18 -9
  75. package/dist/routers/assignment.d.ts.map +1 -1
  76. package/dist/routers/assignment.js +2 -3
  77. package/dist/routers/assignment.js.map +1 -1
  78. package/dist/routers/class.d.ts +87 -14
  79. package/dist/routers/class.d.ts.map +1 -1
  80. package/dist/routers/class.js +5 -2
  81. package/dist/routers/class.js.map +1 -1
  82. package/dist/routers/conversation.d.ts +5 -5
  83. package/dist/routers/department.d.ts +293 -0
  84. package/dist/routers/department.d.ts.map +1 -0
  85. package/dist/routers/department.js +93 -0
  86. package/dist/routers/department.js.map +1 -0
  87. package/dist/routers/event.d.ts +2 -1
  88. package/dist/routers/event.d.ts.map +1 -1
  89. package/dist/routers/file.d.ts +8 -6
  90. package/dist/routers/file.d.ts.map +1 -1
  91. package/dist/routers/file.js +26 -17
  92. package/dist/routers/file.js.map +1 -1
  93. package/dist/routers/folder.d.ts +139 -186
  94. package/dist/routers/folder.d.ts.map +1 -1
  95. package/dist/routers/folder.js +82 -90
  96. package/dist/routers/folder.js.map +1 -1
  97. package/dist/routers/labChat.d.ts +11 -2
  98. package/dist/routers/labChat.d.ts.map +1 -1
  99. package/dist/routers/message.d.ts +20 -2
  100. package/dist/routers/message.d.ts.map +1 -1
  101. package/dist/routers/newtonChat.d.ts +9 -0
  102. package/dist/routers/newtonChat.d.ts.map +1 -1
  103. package/dist/routers/school.d.ts +160 -17
  104. package/dist/routers/school.d.ts.map +1 -1
  105. package/dist/routers/school.js +46 -3
  106. package/dist/routers/school.js.map +1 -1
  107. package/dist/routers/tag.d.ts +119 -0
  108. package/dist/routers/tag.d.ts.map +1 -0
  109. package/dist/routers/tag.js +52 -0
  110. package/dist/routers/tag.js.map +1 -0
  111. package/dist/routers/worksheet.d.ts +1 -0
  112. package/dist/routers/worksheet.d.ts.map +1 -1
  113. package/dist/seedDatabase.d.ts +0 -1
  114. package/dist/seedDatabase.d.ts.map +1 -1
  115. package/dist/services/agenda.d.ts +2 -0
  116. package/dist/services/agenda.d.ts.map +1 -1
  117. package/dist/services/assignment.d.ts +18 -9
  118. package/dist/services/assignment.d.ts.map +1 -1
  119. package/dist/services/class.d.ts +87 -14
  120. package/dist/services/class.d.ts.map +1 -1
  121. package/dist/services/class.js +91 -4
  122. package/dist/services/class.js.map +1 -1
  123. package/dist/services/conversation.d.ts +5 -5
  124. package/dist/services/department.d.ts +200 -0
  125. package/dist/services/department.d.ts.map +1 -0
  126. package/dist/services/department.js +368 -0
  127. package/dist/services/department.js.map +1 -0
  128. package/dist/services/event.d.ts +2 -1
  129. package/dist/services/event.d.ts.map +1 -1
  130. package/dist/services/file.d.ts +85 -0
  131. package/dist/services/file.d.ts.map +1 -1
  132. package/dist/services/file.js +92 -2
  133. package/dist/services/file.js.map +1 -1
  134. package/dist/services/folder.d.ts +125 -149
  135. package/dist/services/folder.d.ts.map +1 -1
  136. package/dist/services/folder.js +258 -199
  137. package/dist/services/folder.js.map +1 -1
  138. package/dist/services/labChat.d.ts +11 -2
  139. package/dist/services/labChat.d.ts.map +1 -1
  140. package/dist/services/labChat.js +4 -3
  141. package/dist/services/labChat.js.map +1 -1
  142. package/dist/services/message.d.ts +20 -2
  143. package/dist/services/message.d.ts.map +1 -1
  144. package/dist/services/message.js +7 -23
  145. package/dist/services/message.js.map +1 -1
  146. package/dist/services/newtonChat.d.ts +9 -0
  147. package/dist/services/newtonChat.d.ts.map +1 -1
  148. package/dist/services/newtonChat.js +4 -3
  149. package/dist/services/newtonChat.js.map +1 -1
  150. package/dist/services/school.d.ts +142 -15
  151. package/dist/services/school.d.ts.map +1 -1
  152. package/dist/services/school.js +308 -54
  153. package/dist/services/school.js.map +1 -1
  154. package/dist/services/tag.d.ts +71 -0
  155. package/dist/services/tag.d.ts.map +1 -0
  156. package/dist/services/tag.js +178 -0
  157. package/dist/services/tag.js.map +1 -0
  158. package/dist/services/worksheet.d.ts +1 -0
  159. package/dist/services/worksheet.d.ts.map +1 -1
  160. package/dist/utils/aiUser.d.ts.map +1 -1
  161. package/dist/utils/aiUser.js +2 -3
  162. package/dist/utils/aiUser.js.map +1 -1
  163. package/package.json +1 -1
  164. package/prisma/migrations/20260509220000_institution_overhaul/migration.sql +184 -0
  165. package/prisma/schema.prisma +119 -35
  166. package/src/models/access.ts +8 -24
  167. package/src/models/announcement.ts +0 -1
  168. package/src/models/auth.ts +0 -1
  169. package/src/models/class.ts +13 -0
  170. package/src/models/cloudStorage.ts +194 -0
  171. package/src/models/comment.ts +0 -4
  172. package/src/models/department.ts +159 -0
  173. package/src/models/event.ts +0 -3
  174. package/src/models/file.ts +0 -3
  175. package/src/models/message.ts +19 -5
  176. package/src/models/school.ts +26 -0
  177. package/src/models/tag.ts +140 -0
  178. package/src/routers/_app.ts +4 -0
  179. package/src/routers/announcement.ts +1 -3
  180. package/src/routers/assignment.ts +0 -1
  181. package/src/routers/class.ts +3 -0
  182. package/src/routers/department.ts +174 -0
  183. package/src/routers/file.ts +29 -26
  184. package/src/routers/folder.ts +100 -121
  185. package/src/routers/school.ts +83 -0
  186. package/src/routers/tag.ts +78 -0
  187. package/src/services/class.ts +108 -3
  188. package/src/services/department.ts +478 -0
  189. package/src/services/file.ts +100 -0
  190. package/src/services/folder.ts +313 -240
  191. package/src/services/labChat.ts +2 -1
  192. package/src/services/message.ts +5 -21
  193. package/src/services/newtonChat.ts +2 -1
  194. package/src/services/school.ts +369 -57
  195. package/src/services/tag.ts +229 -0
  196. package/src/utils/aiUser.ts +0 -1
@@ -2,7 +2,7 @@
2
2
  * Comment model – comments, replies, and reactions.
3
3
  */
4
4
 
5
- !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]="4e10262a-c8cd-5388-9b97-3cf8d34902b6")}catch(e){}}();
5
+ !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]="8dbc1c18-53a6-535e-8af0-25c781796a36")}catch(e){}}();
6
6
  import { prisma } from "../lib/prisma.js";
7
7
  export const commentSelect = {
8
8
  id: true,
@@ -51,10 +51,6 @@ const commentClassAuthSelect = {
51
51
  students: { select: { id: true } },
52
52
  school: {
53
53
  select: {
54
- users: {
55
- where: { role: "ADMIN" },
56
- select: { id: true },
57
- },
58
54
  memberships: {
59
55
  where: {
60
56
  role: "ADMIN",
@@ -265,4 +261,4 @@ export function getReactionCountsByCommentId(commentId) {
265
261
  });
266
262
  }
267
263
  //# sourceMappingURL=comment.js.map
268
- //# debugId=4e10262a-c8cd-5388-9b97-3cf8d34902b6
264
+ //# debugId=8dbc1c18-53a6-535e-8af0-25c781796a36
@@ -1 +1 @@
1
- {"version":3,"file":"comment.js","sources":["models/comment.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Comment model – comments, replies, and reactions.\n */\nimport { prisma } from \"../lib/prisma.js\";\nimport type { ReactionType } from \"@prisma/client\";\n\nexport const commentSelect = {\n id: true,\n content: true,\n announcementId: true,\n assignmentId: true,\n submissionId: true,\n parentCommentId: true,\n createdAt: true,\n modifiedAt: true,\n author: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n reactions: {\n select: {\n type: true,\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n },\n} as const;\n\nconst commentClassAuthSelect = {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n school: {\n select: {\n users: {\n where: { role: \"ADMIN\" as const },\n select: { id: true },\n },\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n} as const;\n\n/** @returns Comment by ID with author and reactions. */\nexport function findCommentById(id: string) {\n return prisma.comment.findUnique({\n where: { id },\n select: commentSelect,\n });\n}\n\n/** @returns Replies to a comment. */\nexport function findRepliesByCommentId(commentId: string) {\n return prisma.comment.findMany({\n where: { parentCommentId: commentId },\n include: {\n author: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n });\n}\n\n/** Create a comment (reply). */\nexport function createComment(data: {\n parentCommentId: string;\n content: string;\n authorId: string;\n announcementId?: string | null;\n assignmentId?: string | null;\n submissionId?: string | null;\n studentQuestionProgressId?: string | null;\n}) {\n return prisma.comment.create({\n data,\n });\n}\n\n/** @returns User's reaction on a comment. */\nexport function findReactionByUserAndComment(userId: string, commentId: string) {\n return prisma.reaction.findUnique({\n where: {\n userId_commentId: { userId, commentId },\n },\n });\n}\n\n/** Add or update reaction on a comment. */\nexport function upsertReaction(data: {\n userId: string;\n commentId: string;\n type: string;\n}) {\n return prisma.reaction.upsert({\n where: {\n userId_commentId: {\n userId: data.userId,\n commentId: data.commentId,\n },\n },\n update: { type: data.type as ReactionType },\n create: { ...data, type: data.type as ReactionType },\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n });\n}\n\n/** Delete a reaction. */\nexport function deleteReactionById(id: string) {\n return prisma.reaction.delete({\n where: { id },\n });\n}\n\n/** @returns Comment with announcement classId. */\nexport function findCommentWithAnnouncement(commentId: string) {\n return prisma.comment.findUnique({\n where: { id: commentId },\n include: {\n announcement: { select: { classId: true } },\n },\n });\n}\n\n/** @returns Comment with the owning class context for authorization. */\nexport function findCommentWithContext(commentId: string) {\n return prisma.comment.findUnique({\n where: { id: commentId },\n include: {\n announcement: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n studentQuestionProgress: {\n select: {\n studentId: true,\n studentWorksheetResponse: {\n select: {\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n parentComment: {\n include: {\n announcement: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n studentQuestionProgress: {\n select: {\n studentId: true,\n studentWorksheetResponse: {\n select: {\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Reaction counts by type for a comment. */\nexport function getReactionCountsByCommentId(commentId: string) {\n return prisma.reaction.groupBy({\n by: [\"type\"],\n where: { commentId },\n _count: { type: true },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE;QACN,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,MAAM,EAAE;oBACN,WAAW,EAAE,IAAI;oBACjB,cAAc,EAAE,IAAI;oBACpB,uBAAuB,EAAE,IAAI;iBAC9B;aACF;SACF;KACF;IACD,SAAS,EAAE;QACT,MAAM,EAAE;YACN,IAAI,EAAE,IAAI;YACV,IAAI,EAAE;gBACJ,MAAM,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE;wBACP,MAAM,EAAE;4BACN,WAAW,EAAE,IAAI;4BACjB,cAAc,EAAE,IAAI;4BACpB,uBAAuB,EAAE,IAAI;yBAC9B;qBACF;iBACF;aACF;SACF;KACF;CACO,C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,SAAS,EAAE,IAAI;4BACf,UAAU,EAAE;gCACV,MAAM,EAAE;oCACN,KAAK,EAAE;wCACL,MAAM,EAAE,sBAAsB;qCAC/B;iCACF;6BACF;yBACF;qBACF;oBACD,uBAAuB,EAAE;wBACvB,MAAM,EAAE;4BACN,SAAS,EAAE,IAAI;4BACf,wBAAwB,EAAE;gCACxB,MAAM,EAAE;oCACN,UAAU,EAAE;wCACV,MAAM,EAAE;4CACN,SAAS,EAAE,IAAI;4CACf,UAAU,EAAE;gDACV,MAAM,EAAE;oDACN,KAAK,EAAE;wDACL,MAAM,EAAE,sBAAsB;qDAC/B;iDACF;6CACF;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,4BAA4B,CAAC,SAAiB;IAC5D,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC7B,EAAE,EAAE,CAAC,MAAM,CAAC;QACZ,KAAK,EAAE,EAAE,SAAS,EAAE;QACpB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KACvB,CAAC,CAAC;AACL,CAAC","debug_id":"4e10262a-c8cd-5388-9b97-3cf8d34902b6"}
1
+ {"version":3,"file":"comment.js","sources":["models/comment.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Comment model – comments, replies, and reactions.\n */\nimport { prisma } from \"../lib/prisma.js\";\nimport type { ReactionType } from \"@prisma/client\";\n\nexport const commentSelect = {\n id: true,\n content: true,\n announcementId: true,\n assignmentId: true,\n submissionId: true,\n parentCommentId: true,\n createdAt: true,\n modifiedAt: true,\n author: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n reactions: {\n select: {\n type: true,\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n },\n} as const;\n\nconst commentClassAuthSelect = {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n school: {\n select: {\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n} as const;\n\n/** @returns Comment by ID with author and reactions. */\nexport function findCommentById(id: string) {\n return prisma.comment.findUnique({\n where: { id },\n select: commentSelect,\n });\n}\n\n/** @returns Replies to a comment. */\nexport function findRepliesByCommentId(commentId: string) {\n return prisma.comment.findMany({\n where: { parentCommentId: commentId },\n include: {\n author: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n });\n}\n\n/** Create a comment (reply). */\nexport function createComment(data: {\n parentCommentId: string;\n content: string;\n authorId: string;\n announcementId?: string | null;\n assignmentId?: string | null;\n submissionId?: string | null;\n studentQuestionProgressId?: string | null;\n}) {\n return prisma.comment.create({\n data,\n });\n}\n\n/** @returns User's reaction on a comment. */\nexport function findReactionByUserAndComment(userId: string, commentId: string) {\n return prisma.reaction.findUnique({\n where: {\n userId_commentId: { userId, commentId },\n },\n });\n}\n\n/** Add or update reaction on a comment. */\nexport function upsertReaction(data: {\n userId: string;\n commentId: string;\n type: string;\n}) {\n return prisma.reaction.upsert({\n where: {\n userId_commentId: {\n userId: data.userId,\n commentId: data.commentId,\n },\n },\n update: { type: data.type as ReactionType },\n create: { ...data, type: data.type as ReactionType },\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n });\n}\n\n/** Delete a reaction. */\nexport function deleteReactionById(id: string) {\n return prisma.reaction.delete({\n where: { id },\n });\n}\n\n/** @returns Comment with announcement classId. */\nexport function findCommentWithAnnouncement(commentId: string) {\n return prisma.comment.findUnique({\n where: { id: commentId },\n include: {\n announcement: { select: { classId: true } },\n },\n });\n}\n\n/** @returns Comment with the owning class context for authorization. */\nexport function findCommentWithContext(commentId: string) {\n return prisma.comment.findUnique({\n where: { id: commentId },\n include: {\n announcement: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n studentQuestionProgress: {\n select: {\n studentId: true,\n studentWorksheetResponse: {\n select: {\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n parentComment: {\n include: {\n announcement: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n studentQuestionProgress: {\n select: {\n studentId: true,\n studentWorksheetResponse: {\n select: {\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Reaction counts by type for a comment. */\nexport function getReactionCountsByCommentId(commentId: string) {\n return prisma.reaction.groupBy({\n by: [\"type\"],\n where: { commentId },\n _count: { type: true },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE;QACN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K,EAAE;gDACL,MAAM,EAAE,sBAAsB;6CAC/B;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;YACD,aAAa,EAAE;gBACb,OAAO,EAAE;oBACP,YAAY,EAAE;wBACZ,MAAM,EAAE;4BACN,KAAK,EAAE;gCACL,MAAM,EAAE,sBAAsB;6BAC/B;yBACF;qBACF;oBACD,UAAU,EAAE;wBACV,MAAM,EAAE;4BACN,KAAK,EAAE;gCACL,MAAM,EAAE,sBAAsB;6BAC/B;yBACF;qBACF;oBACD,UAAU,EAAE;wBACV,MAAM,EAAE;4BACN,SAAS,EAAE,IAAI;4BACf,UAAU,EAAE;gCACV,MAAM,EAAE;oCACN,KAAK,EAAE;wCACL,MAAM,EAAE,sBAAsB;qCAC/B;iCACF;6BACF;yBACF;qBACF;oBACD,uBAAuB,EAAE;wBACvB,MAAM,EAAE;4BACN,SAAS,EAAE,IAAI;4BACf,wBAAwB,EAAE;gCACxB,MAAM,EAAE;oCACN,UAAU,EAAE;wCACV,MAAM,EAAE;4CACN,SAAS,EAAE,IAAI;4CACf,UAAU,EAAE;gDACV,MAAM,EAAE;oDACN,KAAK,EAAE;wDACL,MAAM,EAAE,sBAAsB;qDAC/B;iDACF;6CACF;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,4BAA4B,CAAC,SAAiB;IAC5D,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC7B,EAAE,EAAE,CAAC,MAAM,CAAC;QACZ,KAAK,EAAE,EAAE,SAAS,EAAE;QACpB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KACvB,CAAC,CAAC;AACL,CAAC","debug_id":"8dbc1c18-53a6-535e-8af0-25c781796a36"}
@@ -4,42 +4,42 @@ export declare function findConversationsByUserId(userId: string): import(".pris
4
4
  id: string;
5
5
  title: string;
6
6
  } | null;
7
- messages: ({
8
- sender: {
7
+ members: ({
8
+ user: {
9
9
  id: string;
10
10
  username: string;
11
11
  profile: {
12
12
  displayName: string | null;
13
+ profilePicture: string | null;
13
14
  } | null;
14
15
  };
15
16
  } & {
16
- status: import(".prisma/client").$Enums.JobStatus | null;
17
- meta: import("@prisma/client/runtime/library.js").JsonValue | null;
18
17
  id: string;
19
- createdAt: Date;
18
+ userId: string;
19
+ role: import(".prisma/client").$Enums.ConversationRole;
20
20
  conversationId: string;
21
- content: string;
22
- senderId: string;
23
- runJobId: string | null;
21
+ joinedAt: Date;
22
+ hiddenAt: Date | null;
23
+ lastViewedAt: Date | null;
24
+ lastViewedMentionAt: Date | null;
24
25
  })[];
25
- members: ({
26
- user: {
26
+ messages: ({
27
+ sender: {
27
28
  id: string;
28
29
  username: string;
29
30
  profile: {
30
31
  displayName: string | null;
31
- profilePicture: string | null;
32
32
  } | null;
33
33
  };
34
34
  } & {
35
+ status: import(".prisma/client").$Enums.JobStatus | null;
36
+ meta: import("@prisma/client/runtime/library.js").JsonValue | null;
35
37
  id: string;
36
- role: import(".prisma/client").$Enums.ConversationRole;
37
- userId: string;
38
+ createdAt: Date;
38
39
  conversationId: string;
39
- joinedAt: Date;
40
- hiddenAt: Date | null;
41
- lastViewedAt: Date | null;
42
- lastViewedMentionAt: Date | null;
40
+ content: string;
41
+ senderId: string;
42
+ runJobId: string | null;
43
43
  })[];
44
44
  } & {
45
45
  type: import(".prisma/client").$Enums.ConversationType;
@@ -118,8 +118,8 @@ export declare function createConversation(data: {
118
118
  };
119
119
  } & {
120
120
  id: string;
121
- role: import(".prisma/client").$Enums.ConversationRole;
122
121
  userId: string;
122
+ role: import(".prisma/client").$Enums.ConversationRole;
123
123
  conversationId: string;
124
124
  joinedAt: Date;
125
125
  hiddenAt: Date | null;
@@ -153,8 +153,8 @@ export declare function findConversationByIdAndMember(conversationId: string, us
153
153
  };
154
154
  } & {
155
155
  id: string;
156
- role: import(".prisma/client").$Enums.ConversationRole;
157
156
  userId: string;
157
+ role: import(".prisma/client").$Enums.ConversationRole;
158
158
  conversationId: string;
159
159
  joinedAt: Date;
160
160
  hiddenAt: Date | null;
@@ -182,8 +182,8 @@ export declare function createConversationMember(data: {
182
182
  role: string;
183
183
  }): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
184
184
  id: string;
185
- role: import(".prisma/client").$Enums.ConversationRole;
186
185
  userId: string;
186
+ role: import(".prisma/client").$Enums.ConversationRole;
187
187
  conversationId: string;
188
188
  joinedAt: Date;
189
189
  hiddenAt: Date | null;
@@ -199,8 +199,8 @@ export declare function createConversationMember(data: {
199
199
  /** Hide a conversation for a single member until new activity occurs. */
200
200
  export declare function hideConversationMember(userId: string, conversationId: string): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
201
201
  id: string;
202
- role: import(".prisma/client").$Enums.ConversationRole;
203
202
  userId: string;
203
+ role: import(".prisma/client").$Enums.ConversationRole;
204
204
  conversationId: string;
205
205
  joinedAt: Date;
206
206
  hiddenAt: Date | null;
@@ -216,8 +216,8 @@ export declare function hideConversationMember(userId: string, conversationId: s
216
216
  /** Remove a member from a conversation. */
217
217
  export declare function deleteConversationMember(userId: string, conversationId: string): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
218
218
  id: string;
219
- role: import(".prisma/client").$Enums.ConversationRole;
220
219
  userId: string;
220
+ role: import(".prisma/client").$Enums.ConversationRole;
221
221
  conversationId: string;
222
222
  joinedAt: Date;
223
223
  hiddenAt: Date | null;
@@ -0,0 +1,154 @@
1
+ export declare function listDepartmentsForSchool(schoolId: string): import(".prisma/client").Prisma.PrismaPromise<{
2
+ name: string;
3
+ id: string;
4
+ description: string | null;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ schoolId: string;
8
+ color: string | null;
9
+ _count: {
10
+ tags: number;
11
+ classes: number;
12
+ members: number;
13
+ rubricTemplates: number;
14
+ boundaryTemplates: number;
15
+ };
16
+ }[]>;
17
+ export declare function listDepartmentsForUser(userId: string, schoolId: string): import(".prisma/client").Prisma.PrismaPromise<{
18
+ name: string;
19
+ id: string;
20
+ description: string | null;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ schoolId: string;
24
+ color: string | null;
25
+ }[]>;
26
+ export declare function getDepartment(departmentId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
27
+ name: string;
28
+ id: string;
29
+ description: string | null;
30
+ createdAt: Date;
31
+ updatedAt: Date;
32
+ schoolId: string;
33
+ color: string | null;
34
+ tags: {
35
+ name: string;
36
+ id: string;
37
+ color: string;
38
+ }[];
39
+ classes: {
40
+ name: string;
41
+ id: string;
42
+ subject: string;
43
+ color: string | null;
44
+ section: string;
45
+ }[];
46
+ members: {
47
+ id: string;
48
+ username: string;
49
+ email: string;
50
+ profile: {
51
+ displayName: string | null;
52
+ profilePicture: string | null;
53
+ profilePictureThumbnail: string | null;
54
+ } | null;
55
+ }[];
56
+ rubricTemplates: {
57
+ name: string | null;
58
+ id: string;
59
+ structured: string;
60
+ }[];
61
+ boundaryTemplates: {
62
+ name: string | null;
63
+ id: string;
64
+ structured: string;
65
+ }[];
66
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
67
+ datasources: {
68
+ db: {
69
+ url: string;
70
+ };
71
+ };
72
+ }>;
73
+ export declare function createDepartment(data: {
74
+ schoolId: string;
75
+ name: string;
76
+ description?: string;
77
+ color?: string;
78
+ }): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
79
+ name: string;
80
+ id: string;
81
+ description: string | null;
82
+ createdAt: Date;
83
+ updatedAt: Date;
84
+ schoolId: string;
85
+ color: string | null;
86
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
87
+ datasources: {
88
+ db: {
89
+ url: string;
90
+ };
91
+ };
92
+ }>;
93
+ export declare function updateDepartment(departmentId: string, data: {
94
+ name?: string;
95
+ description?: string | null;
96
+ color?: string;
97
+ }): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
98
+ name: string;
99
+ id: string;
100
+ description: string | null;
101
+ createdAt: Date;
102
+ updatedAt: Date;
103
+ schoolId: string;
104
+ color: string | null;
105
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
106
+ datasources: {
107
+ db: {
108
+ url: string;
109
+ };
110
+ };
111
+ }>;
112
+ export declare function deleteDepartment(departmentId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
113
+ name: string;
114
+ id: string;
115
+ description: string | null;
116
+ createdAt: Date;
117
+ updatedAt: Date;
118
+ schoolId: string;
119
+ color: string | null;
120
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
121
+ datasources: {
122
+ db: {
123
+ url: string;
124
+ };
125
+ };
126
+ }>;
127
+ export declare function addDepartmentMembers(departmentId: string, userIds: string[]): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
128
+ id: string;
129
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
130
+ datasources: {
131
+ db: {
132
+ url: string;
133
+ };
134
+ };
135
+ }>;
136
+ export declare function removeDepartmentMember(departmentId: string, userId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
137
+ id: string;
138
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
139
+ datasources: {
140
+ db: {
141
+ url: string;
142
+ };
143
+ };
144
+ }>;
145
+ export declare function findDepartmentMembership(departmentId: string, userId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
146
+ id: string;
147
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
148
+ datasources: {
149
+ db: {
150
+ url: string;
151
+ };
152
+ };
153
+ }>;
154
+ //# sourceMappingURL=department.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"department.d.ts","sourceRoot":"/","sources":["models/department.ts"],"names":[],"mappings":"AAgCA,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;KAiBxD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;;KAStE;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BjD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;;;;;;;;;;;;;GAUA;AAED,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;GAOrE;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;GAIpD;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EAAE;;;;;;;;GASlB;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;;;;;;;;GASf;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;;;;;;;;GAMf"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Department model — department CRUD, members, and template artefacts.
3
+ *
4
+ * Departments scope rubric/boundary templates and tags inside an institution.
5
+ * They are an admin-managed taxonomy; teachers/students can be members of
6
+ * many departments.
7
+ */
8
+
9
+ !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]="5b5ee7e7-d0d6-5846-a279-d6c6dee02dd4")}catch(e){}}();
10
+ import { prisma } from "../lib/prisma.js";
11
+ const departmentSelect = {
12
+ id: true,
13
+ schoolId: true,
14
+ name: true,
15
+ description: true,
16
+ color: true,
17
+ createdAt: true,
18
+ updatedAt: true,
19
+ };
20
+ const memberSelect = {
21
+ id: true,
22
+ username: true,
23
+ email: true,
24
+ profile: {
25
+ select: {
26
+ displayName: true,
27
+ profilePicture: true,
28
+ profilePictureThumbnail: true,
29
+ },
30
+ },
31
+ };
32
+ export function listDepartmentsForSchool(schoolId) {
33
+ return prisma.department.findMany({
34
+ where: { schoolId },
35
+ orderBy: { name: "asc" },
36
+ select: {
37
+ ...departmentSelect,
38
+ _count: {
39
+ select: {
40
+ members: true,
41
+ classes: true,
42
+ tags: true,
43
+ rubricTemplates: true,
44
+ boundaryTemplates: true,
45
+ },
46
+ },
47
+ },
48
+ });
49
+ }
50
+ export function listDepartmentsForUser(userId, schoolId) {
51
+ return prisma.department.findMany({
52
+ where: {
53
+ schoolId,
54
+ members: { some: { id: userId } },
55
+ },
56
+ orderBy: { name: "asc" },
57
+ select: departmentSelect,
58
+ });
59
+ }
60
+ export function getDepartment(departmentId) {
61
+ return prisma.department.findUnique({
62
+ where: { id: departmentId },
63
+ select: {
64
+ ...departmentSelect,
65
+ members: { select: memberSelect },
66
+ tags: {
67
+ select: { id: true, name: true, color: true },
68
+ },
69
+ rubricTemplates: {
70
+ select: { id: true, name: true, structured: true },
71
+ },
72
+ boundaryTemplates: {
73
+ select: { id: true, name: true, structured: true },
74
+ },
75
+ classes: {
76
+ select: {
77
+ id: true,
78
+ name: true,
79
+ subject: true,
80
+ section: true,
81
+ color: true,
82
+ },
83
+ },
84
+ },
85
+ });
86
+ }
87
+ export function createDepartment(data) {
88
+ return prisma.department.create({
89
+ data: {
90
+ schoolId: data.schoolId,
91
+ name: data.name,
92
+ description: data.description,
93
+ color: data.color,
94
+ },
95
+ select: departmentSelect,
96
+ });
97
+ }
98
+ export function updateDepartment(departmentId, data) {
99
+ return prisma.department.update({
100
+ where: { id: departmentId },
101
+ data,
102
+ select: departmentSelect,
103
+ });
104
+ }
105
+ export function deleteDepartment(departmentId) {
106
+ return prisma.department.delete({
107
+ where: { id: departmentId },
108
+ });
109
+ }
110
+ export function addDepartmentMembers(departmentId, userIds) {
111
+ return prisma.department.update({
112
+ where: { id: departmentId },
113
+ data: {
114
+ members: { connect: userIds.map((id) => ({ id })) },
115
+ },
116
+ select: { id: true },
117
+ });
118
+ }
119
+ export function removeDepartmentMember(departmentId, userId) {
120
+ return prisma.department.update({
121
+ where: { id: departmentId },
122
+ data: {
123
+ members: { disconnect: { id: userId } },
124
+ },
125
+ select: { id: true },
126
+ });
127
+ }
128
+ export function findDepartmentMembership(departmentId, userId) {
129
+ return prisma.department.findFirst({
130
+ where: { id: departmentId, members: { some: { id: userId } } },
131
+ select: { id: true },
132
+ });
133
+ }
134
+ //# sourceMappingURL=department.js.map
135
+ //# debugId=5b5ee7e7-d0d6-5846-a279-d6c6dee02dd4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"department.js","sources":["models/department.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Department model — department CRUD, members, and template artefacts.\n *\n * Departments scope rubric/boundary templates and tags inside an institution.\n * They are an admin-managed taxonomy; teachers/students can be members of\n * many departments.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\nconst departmentSelect = {\n id: true,\n schoolId: true,\n name: true,\n description: true,\n color: true,\n createdAt: true,\n updatedAt: true,\n} as const;\n\nconst memberSelect = {\n id: true,\n username: true,\n email: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n} as const;\n\nexport function listDepartmentsForSchool(schoolId: string) {\n return prisma.department.findMany({\n where: { schoolId },\n orderBy: { name: \"asc\" },\n select: {\n ...departmentSelect,\n _count: {\n select: {\n members: true,\n classes: true,\n tags: true,\n rubricTemplates: true,\n boundaryTemplates: true,\n },\n },\n },\n });\n}\n\nexport function listDepartmentsForUser(userId: string, schoolId: string) {\n return prisma.department.findMany({\n where: {\n schoolId,\n members: { some: { id: userId } },\n },\n orderBy: { name: \"asc\" },\n select: departmentSelect,\n });\n}\n\nexport function getDepartment(departmentId: string) {\n return prisma.department.findUnique({\n where: { id: departmentId },\n select: {\n ...departmentSelect,\n members: { select: memberSelect },\n tags: {\n select: { id: true, name: true, color: true },\n },\n rubricTemplates: {\n select: { id: true, name: true, structured: true },\n },\n boundaryTemplates: {\n select: { id: true, name: true, structured: true },\n },\n classes: {\n select: {\n id: true,\n name: true,\n subject: true,\n section: true,\n color: true,\n },\n },\n },\n });\n}\n\nexport function createDepartment(data: {\n schoolId: string;\n name: string;\n description?: string;\n color?: string;\n}) {\n return prisma.department.create({\n data: {\n schoolId: data.schoolId,\n name: data.name,\n description: data.description,\n color: data.color,\n },\n select: departmentSelect,\n });\n}\n\nexport function updateDepartment(\n departmentId: string,\n data: { name?: string; description?: string | null; color?: string }\n) {\n return prisma.department.update({\n where: { id: departmentId },\n data,\n select: departmentSelect,\n });\n}\n\nexport function deleteDepartment(departmentId: string) {\n return prisma.department.delete({\n where: { id: departmentId },\n });\n}\n\nexport function addDepartmentMembers(\n departmentId: string,\n userIds: string[]\n) {\n return prisma.department.update({\n where: { id: departmentId },\n data: {\n members: { connect: userIds.map((id) => ({ id })) },\n },\n select: { id: true },\n });\n}\n\nexport function removeDepartmentMember(\n departmentId: string,\n userId: string\n) {\n return prisma.department.update({\n where: { id: departmentId },\n data: {\n members: { disconnect: { id: userId } },\n },\n select: { id: true },\n });\n}\n\nexport function findDepartmentMembership(\n departmentId: string,\n userId: string\n) {\n return prisma.department.findFirst({\n where: { id: departmentId, members: { some: { id: userId } } },\n select: { id: true },\n });\n}\n"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,gBAAgB,GAAG;IACvB,EAAE,EAAE,IAAI;IACR,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,IAAI;IACjB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,YAAY,EAAE;KAC5B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,YAAoB,EACpB,OAAiB;IAEjB,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAC9B,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE;QAC3B,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE;SACpD;QACD,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;KACrB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,YAAoB,EACpB,MAAc;IAEd,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAC9B,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE;QAC3B,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;SACxC;QACD,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;KACrB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,YAAoB,EACpB,MAAc;IAEd,OAAO,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;QACjC,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAC9D,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;KACrB,CAAC,CAAC;AACL,CAAC","debug_id":"5b5ee7e7-d0d6-5846-a279-d6c6dee02dd4"}
@@ -6,7 +6,6 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
6
6
  email: string;
7
7
  password: string;
8
8
  verified: boolean;
9
- role: import(".prisma/client").$Enums.UserRole;
10
9
  schoolId: string | null;
11
10
  } | null;
12
11
  class: ({
@@ -20,6 +19,7 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
20
19
  } & {
21
20
  name: string;
22
21
  id: string;
22
+ description: string | null;
23
23
  logoId: string | null;
24
24
  subdomain: string | null;
25
25
  createdAt: Date;
@@ -36,6 +36,7 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
36
36
  color: string | null;
37
37
  section: string;
38
38
  syllabus: string | null;
39
+ departmentId: string | null;
39
40
  }) | null;
40
41
  assignmentsAttached: {
41
42
  type: import(".prisma/client").$Enums.AssignmentType;
@@ -86,6 +87,7 @@ export declare function findClassWithTeachers(classId: string, teacherId: string
86
87
  color: string | null;
87
88
  section: string;
88
89
  syllabus: string | null;
90
+ departmentId: string | null;
89
91
  } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
90
92
  datasources: {
91
93
  db: {
@@ -181,6 +183,7 @@ export declare function findEventWithClass(eventId: string): import(".prisma/cli
181
183
  } & {
182
184
  name: string;
183
185
  id: string;
186
+ description: string | null;
184
187
  logoId: string | null;
185
188
  subdomain: string | null;
186
189
  createdAt: Date;
@@ -197,6 +200,7 @@ export declare function findEventWithClass(eventId: string): import(".prisma/cli
197
200
  color: string | null;
198
201
  section: string;
199
202
  syllabus: string | null;
203
+ departmentId: string | null;
200
204
  }) | null;
201
205
  } & {
202
206
  name: string | null;
@@ -228,6 +232,7 @@ export declare function findAssignmentWithClass(assignmentId: string): import(".
228
232
  } & {
229
233
  name: string;
230
234
  id: string;
235
+ description: string | null;
231
236
  logoId: string | null;
232
237
  subdomain: string | null;
233
238
  createdAt: Date;
@@ -244,6 +249,7 @@ export declare function findAssignmentWithClass(assignmentId: string): import(".
244
249
  color: string | null;
245
250
  section: string;
246
251
  syllabus: string | null;
252
+ departmentId: string | null;
247
253
  };
248
254
  } & {
249
255
  type: import(".prisma/client").$Enums.AssignmentType;
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"/","sources":["models/event.ts"],"names":[],"m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CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;;;;;;;;;;;;;;;GAMF;AAED,uBAAuB;AACvB,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;GAIzC;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBjD;AAED,mDAAmD;AACnD,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyB3D;AAED,qCAAqC;AACrC,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOhB;AAED,wCAAwC;AACxC,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM7D;AAED,sDAAsD;AACtD,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;KAqB/D"}
@@ -2,7 +2,7 @@
2
2
  * Event model – calendar events, assignment attachment/detachment.
3
3
  */
4
4
 
5
- !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]="cf3ed911-c40a-5919-97ae-6a9c13344647")}catch(e){}}();
5
+ !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]="40b50512-03a6-535f-a397-55717298eee6")}catch(e){}}();
6
6
  import { prisma } from "../lib/prisma.js";
7
7
  import { classTeacherOrSchoolAdminWhere } from "./access.js";
8
8
  const eventGetInclude = {
@@ -12,7 +12,6 @@ const eventGetInclude = {
12
12
  school: {
13
13
  include: {
14
14
  users: {
15
- where: { role: "ADMIN" },
16
15
  select: { id: true },
17
16
  },
18
17
  memberships: {
@@ -107,7 +106,6 @@ export function findEventWithClass(eventId) {
107
106
  school: {
108
107
  include: {
109
108
  users: {
110
- where: { role: "ADMIN" },
111
109
  select: { id: true },
112
110
  },
113
111
  memberships: {
@@ -135,7 +133,6 @@ export function findAssignmentWithClass(assignmentId) {
135
133
  school: {
136
134
  include: {
137
135
  users: {
138
- where: { role: "ADMIN" },
139
136
  select: { id: true },
140
137
  },
141
138
  memberships: {
@@ -192,4 +189,4 @@ export function findAvailableAssignmentsForClass(classId) {
192
189
  });
193
190
  }
194
191
  //# sourceMappingURL=event.js.map
195
- //# debugId=cf3ed911-c40a-5919-97ae-6a9c13344647
192
+ //# debugId=40b50512-03a6-535f-a397-55717298eee6