@studious-lms/server 1.1.26 → 1.2.6

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 (486) hide show
  1. package/.coderabbit.yaml +9 -0
  2. package/.env.example +53 -0
  3. package/.env.test.example +37 -0
  4. package/README.md +34 -7
  5. package/dist/exportType.d.ts.map +1 -1
  6. package/dist/exportType.js +4 -0
  7. package/dist/exportType.js.map +1 -0
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +212 -51
  11. package/dist/index.js.map +1 -0
  12. package/dist/instrument.d.ts +2 -0
  13. package/dist/instrument.d.ts.map +1 -0
  14. package/dist/instrument.js +18 -0
  15. package/dist/instrument.js.map +1 -0
  16. package/dist/lib/config/env.d.ts +190 -0
  17. package/dist/lib/config/env.d.ts.map +1 -0
  18. package/dist/lib/config/env.js +121 -0
  19. package/dist/lib/config/env.js.map +1 -0
  20. package/dist/lib/fileUpload.d.ts +2 -2
  21. package/dist/lib/fileUpload.d.ts.map +1 -1
  22. package/dist/lib/fileUpload.js +15 -5
  23. package/dist/lib/fileUpload.js.map +1 -0
  24. package/dist/lib/googleCloudStorage.d.ts +6 -0
  25. package/dist/lib/googleCloudStorage.d.ts.map +1 -1
  26. package/dist/lib/googleCloudStorage.js +26 -6
  27. package/dist/lib/googleCloudStorage.js.map +1 -0
  28. package/dist/lib/jsonConversion.d.ts.map +1 -1
  29. package/dist/lib/jsonConversion.js +16 -14
  30. package/dist/lib/jsonConversion.js.map +1 -0
  31. package/dist/lib/jsonStyles.d.ts.map +1 -1
  32. package/dist/lib/jsonStyles.js +4 -0
  33. package/dist/lib/jsonStyles.js.map +1 -0
  34. package/dist/lib/notificationHandler.d.ts +2 -2
  35. package/dist/lib/notificationHandler.d.ts.map +1 -1
  36. package/dist/lib/notificationHandler.js +4 -0
  37. package/dist/lib/notificationHandler.js.map +1 -0
  38. package/dist/lib/prisma.d.ts +2 -2
  39. package/dist/lib/prisma.d.ts.map +1 -1
  40. package/dist/lib/prisma.js +24 -1
  41. package/dist/lib/prisma.js.map +1 -0
  42. package/dist/lib/pusher.d.ts +4 -1
  43. package/dist/lib/pusher.d.ts.map +1 -1
  44. package/dist/lib/pusher.js +14 -6
  45. package/dist/lib/pusher.js.map +1 -0
  46. package/dist/lib/redis.d.ts +5 -0
  47. package/dist/lib/redis.d.ts.map +1 -0
  48. package/dist/lib/redis.js +53 -0
  49. package/dist/lib/redis.js.map +1 -0
  50. package/dist/lib/thumbnailGenerator.d.ts +0 -21
  51. package/dist/lib/thumbnailGenerator.d.ts.map +1 -1
  52. package/dist/lib/thumbnailGenerator.js +159 -158
  53. package/dist/lib/thumbnailGenerator.js.map +1 -0
  54. package/dist/middleware/auth.d.ts.map +1 -1
  55. package/dist/middleware/auth.js +41 -93
  56. package/dist/middleware/auth.js.map +1 -0
  57. package/dist/middleware/logging.d.ts.map +1 -1
  58. package/dist/middleware/logging.js +4 -0
  59. package/dist/middleware/logging.js.map +1 -0
  60. package/dist/middleware/security.d.ts +5 -0
  61. package/dist/middleware/security.d.ts.map +1 -0
  62. package/dist/middleware/security.js +77 -0
  63. package/dist/middleware/security.js.map +1 -0
  64. package/dist/models/agenda.d.ts +97 -0
  65. package/dist/models/agenda.d.ts.map +1 -0
  66. package/dist/models/agenda.js +40 -0
  67. package/dist/models/agenda.js.map +1 -0
  68. package/dist/models/announcement.d.ts +223 -0
  69. package/dist/models/announcement.d.ts.map +1 -0
  70. package/dist/models/announcement.js +120 -0
  71. package/dist/models/announcement.js.map +1 -0
  72. package/dist/models/assignment.d.ts +1292 -0
  73. package/dist/models/assignment.d.ts.map +1 -0
  74. package/dist/models/assignment.js +309 -0
  75. package/dist/models/assignment.js.map +1 -0
  76. package/dist/models/attendance.d.ts +180 -0
  77. package/dist/models/attendance.d.ts.map +1 -0
  78. package/dist/models/attendance.js +188 -0
  79. package/dist/models/attendance.js.map +1 -0
  80. package/dist/models/auth.d.ts +153 -0
  81. package/dist/models/auth.d.ts.map +1 -0
  82. package/dist/models/auth.js +217 -0
  83. package/dist/models/auth.js.map +1 -0
  84. package/dist/models/class.d.ts +439 -0
  85. package/dist/models/class.d.ts.map +1 -0
  86. package/dist/models/class.js +546 -0
  87. package/dist/models/class.js.map +1 -0
  88. package/dist/models/comment.d.ts +171 -0
  89. package/dist/models/comment.d.ts.map +1 -0
  90. package/dist/models/comment.js +138 -0
  91. package/dist/models/comment.js.map +1 -0
  92. package/dist/models/conversation.d.ts +164 -0
  93. package/dist/models/conversation.d.ts.map +1 -0
  94. package/dist/models/conversation.js +175 -0
  95. package/dist/models/conversation.js.map +1 -0
  96. package/dist/models/event.d.ts +295 -0
  97. package/dist/models/event.d.ts.map +1 -0
  98. package/dist/models/event.js +145 -0
  99. package/dist/models/event.js.map +1 -0
  100. package/dist/models/file.d.ts +536 -0
  101. package/dist/models/file.d.ts.map +1 -0
  102. package/dist/models/file.js +126 -0
  103. package/dist/models/file.js.map +1 -0
  104. package/dist/models/folder.d.ts +295 -0
  105. package/dist/models/folder.d.ts.map +1 -0
  106. package/dist/models/folder.js +202 -0
  107. package/dist/models/folder.js.map +1 -0
  108. package/dist/models/labChat.d.ts +243 -0
  109. package/dist/models/labChat.d.ts.map +1 -0
  110. package/dist/models/labChat.js +204 -0
  111. package/dist/models/labChat.js.map +1 -0
  112. package/dist/models/marketing.d.ts +72 -0
  113. package/dist/models/marketing.d.ts.map +1 -0
  114. package/dist/models/marketing.js +26 -0
  115. package/dist/models/marketing.js.map +1 -0
  116. package/dist/models/message.d.ts +100 -0
  117. package/dist/models/message.d.ts.map +1 -0
  118. package/dist/models/message.js +131 -0
  119. package/dist/models/message.js.map +1 -0
  120. package/dist/models/newtonChat.d.ts +72 -0
  121. package/dist/models/newtonChat.d.ts.map +1 -0
  122. package/dist/models/newtonChat.js +61 -0
  123. package/dist/models/newtonChat.js.map +1 -0
  124. package/dist/models/notification.d.ts +65 -0
  125. package/dist/models/notification.d.ts.map +1 -0
  126. package/dist/models/notification.js +46 -0
  127. package/dist/models/notification.js.map +1 -0
  128. package/dist/models/section.d.ts +102 -0
  129. package/dist/models/section.d.ts.map +1 -0
  130. package/dist/models/section.js +83 -0
  131. package/dist/models/section.js.map +1 -0
  132. package/dist/models/user.d.ts +39 -0
  133. package/dist/models/user.d.ts.map +1 -0
  134. package/dist/models/user.js +38 -0
  135. package/dist/models/user.js.map +1 -0
  136. package/dist/models/worksheet.d.ts +460 -0
  137. package/dist/models/worksheet.d.ts.map +1 -0
  138. package/dist/models/worksheet.js +200 -0
  139. package/dist/models/worksheet.js.map +1 -0
  140. package/dist/pipelines/aiLabChat.d.ts +21 -0
  141. package/dist/pipelines/aiLabChat.d.ts.map +1 -0
  142. package/dist/pipelines/aiLabChat.js +460 -0
  143. package/dist/pipelines/aiLabChat.js.map +1 -0
  144. package/dist/pipelines/aiNewtonChat.d.ts +30 -0
  145. package/dist/pipelines/aiNewtonChat.d.ts.map +1 -0
  146. package/dist/pipelines/aiNewtonChat.js +289 -0
  147. package/dist/pipelines/aiNewtonChat.js.map +1 -0
  148. package/dist/pipelines/gradeWorksheet.d.ts +30 -0
  149. package/dist/pipelines/gradeWorksheet.d.ts.map +1 -0
  150. package/dist/pipelines/gradeWorksheet.js +252 -0
  151. package/dist/pipelines/gradeWorksheet.js.map +1 -0
  152. package/dist/routers/_app.d.ts +6438 -3910
  153. package/dist/routers/_app.d.ts.map +1 -1
  154. package/dist/routers/_app.js +10 -0
  155. package/dist/routers/_app.js.map +1 -0
  156. package/dist/routers/agenda.d.ts +58 -6
  157. package/dist/routers/agenda.d.ts.map +1 -1
  158. package/dist/routers/agenda.js +6 -58
  159. package/dist/routers/agenda.js.map +1 -0
  160. package/dist/routers/announcement.d.ts +325 -6
  161. package/dist/routers/announcement.d.ts.map +1 -1
  162. package/dist/routers/announcement.js +543 -77
  163. package/dist/routers/announcement.js.map +1 -0
  164. package/dist/routers/assignment.d.ts +419 -357
  165. package/dist/routers/assignment.d.ts.map +1 -1
  166. package/dist/routers/assignment.js +100 -1689
  167. package/dist/routers/assignment.js.map +1 -0
  168. package/dist/routers/attendance.d.ts +20 -9
  169. package/dist/routers/attendance.d.ts.map +1 -1
  170. package/dist/routers/attendance.js +10 -263
  171. package/dist/routers/attendance.js.map +1 -0
  172. package/dist/routers/auth.d.ts +21 -1
  173. package/dist/routers/auth.d.ts.map +1 -1
  174. package/dist/routers/auth.js +37 -241
  175. package/dist/routers/auth.js.map +1 -0
  176. package/dist/routers/class.d.ts +198 -68
  177. package/dist/routers/class.d.ts.map +1 -1
  178. package/dist/routers/class.js +88 -909
  179. package/dist/routers/class.js.map +1 -0
  180. package/dist/routers/comment.d.ts +153 -0
  181. package/dist/routers/comment.d.ts.map +1 -0
  182. package/dist/routers/comment.js +58 -0
  183. package/dist/routers/comment.js.map +1 -0
  184. package/dist/routers/conversation.d.ts +73 -3
  185. package/dist/routers/conversation.d.ts.map +1 -1
  186. package/dist/routers/conversation.js +23 -265
  187. package/dist/routers/conversation.js.map +1 -0
  188. package/dist/routers/event.d.ts +46 -37
  189. package/dist/routers/event.d.ts.map +1 -1
  190. package/dist/routers/event.js +15 -431
  191. package/dist/routers/event.js.map +1 -0
  192. package/dist/routers/file.d.ts +4 -2
  193. package/dist/routers/file.d.ts.map +1 -1
  194. package/dist/routers/file.js +11 -298
  195. package/dist/routers/file.js.map +1 -0
  196. package/dist/routers/folder.d.ts +21 -14
  197. package/dist/routers/folder.d.ts.map +1 -1
  198. package/dist/routers/folder.js +36 -743
  199. package/dist/routers/folder.js.map +1 -0
  200. package/dist/routers/labChat.d.ts +12 -9
  201. package/dist/routers/labChat.d.ts.map +1 -1
  202. package/dist/routers/labChat.js +21 -885
  203. package/dist/routers/labChat.js.map +1 -0
  204. package/dist/routers/marketing.d.ts +2 -2
  205. package/dist/routers/marketing.d.ts.map +1 -1
  206. package/dist/routers/marketing.js +9 -54
  207. package/dist/routers/marketing.js.map +1 -0
  208. package/dist/routers/message.d.ts +2 -1
  209. package/dist/routers/message.d.ts.map +1 -1
  210. package/dist/routers/message.js +29 -519
  211. package/dist/routers/message.js.map +1 -0
  212. package/dist/routers/newtonChat.d.ts +55 -0
  213. package/dist/routers/newtonChat.d.ts.map +1 -0
  214. package/dist/routers/newtonChat.js +22 -0
  215. package/dist/routers/newtonChat.js.map +1 -0
  216. package/dist/routers/notifications.d.ts +8 -8
  217. package/dist/routers/notifications.d.ts.map +1 -1
  218. package/dist/routers/notifications.js +20 -81
  219. package/dist/routers/notifications.js.map +1 -0
  220. package/dist/routers/section.d.ts +23 -8
  221. package/dist/routers/section.d.ts.map +1 -1
  222. package/dist/routers/section.js +23 -273
  223. package/dist/routers/section.js.map +1 -0
  224. package/dist/routers/user.d.ts +1 -1
  225. package/dist/routers/user.d.ts.map +1 -1
  226. package/dist/routers/user.js +34 -204
  227. package/dist/routers/user.js.map +1 -0
  228. package/dist/routers/worksheet.d.ts +362 -0
  229. package/dist/routers/worksheet.d.ts.map +1 -0
  230. package/dist/routers/worksheet.js +153 -0
  231. package/dist/routers/worksheet.js.map +1 -0
  232. package/dist/seedDatabase.d.ts +2 -3
  233. package/dist/seedDatabase.d.ts.map +1 -1
  234. package/dist/seedDatabase.js +309 -288
  235. package/dist/seedDatabase.js.map +1 -0
  236. package/dist/server/pipelines/aiLabChat.d.ts +21 -0
  237. package/dist/server/pipelines/aiLabChat.d.ts.map +1 -0
  238. package/dist/server/pipelines/aiLabChat.js +456 -0
  239. package/dist/server/pipelines/aiLabChat.js.map +1 -0
  240. package/dist/server/pipelines/aiNewtonChat.d.ts +30 -0
  241. package/dist/server/pipelines/aiNewtonChat.d.ts.map +1 -0
  242. package/dist/server/pipelines/aiNewtonChat.js +285 -0
  243. package/dist/server/pipelines/aiNewtonChat.js.map +1 -0
  244. package/dist/server/pipelines/gradeWorksheet.d.ts +30 -0
  245. package/dist/server/pipelines/gradeWorksheet.d.ts.map +1 -0
  246. package/dist/server/pipelines/gradeWorksheet.js +248 -0
  247. package/dist/server/pipelines/gradeWorksheet.js.map +1 -0
  248. package/dist/services/agenda.d.ts +100 -0
  249. package/dist/services/agenda.d.ts.map +1 -0
  250. package/dist/services/agenda.js +21 -0
  251. package/dist/services/agenda.js.map +1 -0
  252. package/dist/services/announcement.d.ts +135 -0
  253. package/dist/services/announcement.d.ts.map +1 -0
  254. package/dist/services/announcement.js +223 -0
  255. package/dist/services/announcement.js.map +1 -0
  256. package/dist/services/assignment.d.ts +1462 -0
  257. package/dist/services/assignment.d.ts.map +1 -0
  258. package/dist/services/assignment.js +898 -0
  259. package/dist/services/assignment.js.map +1 -0
  260. package/dist/services/attendance.d.ts +93 -0
  261. package/dist/services/attendance.d.ts.map +1 -0
  262. package/dist/services/attendance.js +61 -0
  263. package/dist/services/attendance.js.map +1 -0
  264. package/dist/services/auth.d.ts +68 -0
  265. package/dist/services/auth.d.ts.map +1 -0
  266. package/dist/services/auth.js +218 -0
  267. package/dist/services/auth.js.map +1 -0
  268. package/dist/services/class.d.ts +621 -0
  269. package/dist/services/class.d.ts.map +1 -0
  270. package/dist/services/class.js +474 -0
  271. package/dist/services/class.js.map +1 -0
  272. package/dist/services/comment.d.ts +100 -0
  273. package/dist/services/comment.d.ts.map +1 -0
  274. package/dist/services/comment.js +83 -0
  275. package/dist/services/comment.js.map +1 -0
  276. package/dist/services/conversation.d.ts +159 -0
  277. package/dist/services/conversation.d.ts.map +1 -0
  278. package/dist/services/conversation.js +138 -0
  279. package/dist/services/conversation.js.map +1 -0
  280. package/dist/services/event.d.ts +216 -0
  281. package/dist/services/event.d.ts.map +1 -0
  282. package/dist/services/event.js +168 -0
  283. package/dist/services/event.js.map +1 -0
  284. package/dist/services/file.d.ts +74 -0
  285. package/dist/services/file.d.ts.map +1 -0
  286. package/dist/services/file.js +133 -0
  287. package/dist/services/file.js.map +1 -0
  288. package/dist/services/folder.d.ts +239 -0
  289. package/dist/services/folder.d.ts.map +1 -0
  290. package/dist/services/folder.js +248 -0
  291. package/dist/services/folder.js.map +1 -0
  292. package/dist/services/labChat.d.ts +165 -0
  293. package/dist/services/labChat.d.ts.map +1 -0
  294. package/dist/services/labChat.js +289 -0
  295. package/dist/services/labChat.js.map +1 -0
  296. package/dist/services/marketing.d.ts +50 -0
  297. package/dist/services/marketing.d.ts.map +1 -0
  298. package/dist/services/marketing.js +32 -0
  299. package/dist/services/marketing.js.map +1 -0
  300. package/dist/services/message.d.ts +95 -0
  301. package/dist/services/message.d.ts.map +1 -0
  302. package/dist/services/message.js +350 -0
  303. package/dist/services/message.js.map +1 -0
  304. package/dist/services/newtonChat.d.ts +22 -0
  305. package/dist/services/newtonChat.d.ts.map +1 -0
  306. package/dist/services/newtonChat.js +174 -0
  307. package/dist/services/newtonChat.js.map +1 -0
  308. package/dist/services/notification.d.ts +65 -0
  309. package/dist/services/notification.d.ts.map +1 -0
  310. package/dist/services/notification.js +33 -0
  311. package/dist/services/notification.js.map +1 -0
  312. package/dist/services/section.d.ts +53 -0
  313. package/dist/services/section.d.ts.map +1 -0
  314. package/dist/services/section.js +199 -0
  315. package/dist/services/section.js.map +1 -0
  316. package/dist/services/user.d.ts +48 -0
  317. package/dist/services/user.d.ts.map +1 -0
  318. package/dist/services/user.js +141 -0
  319. package/dist/services/user.js.map +1 -0
  320. package/dist/services/worksheet.d.ts +239 -0
  321. package/dist/services/worksheet.d.ts.map +1 -0
  322. package/dist/services/worksheet.js +235 -0
  323. package/dist/services/worksheet.js.map +1 -0
  324. package/dist/socket/handlers.d.ts.map +1 -1
  325. package/dist/socket/handlers.js +4 -0
  326. package/dist/socket/handlers.js.map +1 -0
  327. package/dist/trpc.d.ts.map +1 -1
  328. package/dist/trpc.js +4 -0
  329. package/dist/trpc.js.map +1 -0
  330. package/dist/types/trpc.d.ts.map +1 -1
  331. package/dist/types/trpc.js +4 -0
  332. package/dist/types/trpc.js.map +1 -0
  333. package/dist/utils/aiUser.d.ts +1 -3
  334. package/dist/utils/aiUser.d.ts.map +1 -1
  335. package/dist/utils/aiUser.js +8 -3
  336. package/dist/utils/aiUser.js.map +1 -0
  337. package/dist/utils/email.d.ts +12 -1
  338. package/dist/utils/email.d.ts.map +1 -1
  339. package/dist/utils/email.js +26 -4
  340. package/dist/utils/email.js.map +1 -0
  341. package/dist/utils/generateInviteCode.d.ts +1 -2
  342. package/dist/utils/generateInviteCode.d.ts.map +1 -1
  343. package/dist/utils/generateInviteCode.js +5 -2
  344. package/dist/utils/generateInviteCode.js.map +1 -0
  345. package/dist/utils/inference.d.ts +8 -0
  346. package/dist/utils/inference.d.ts.map +1 -1
  347. package/dist/utils/inference.js +78 -10
  348. package/dist/utils/inference.js.map +1 -0
  349. package/dist/utils/logger.d.ts +3 -0
  350. package/dist/utils/logger.d.ts.map +1 -1
  351. package/dist/utils/logger.js +8 -1
  352. package/dist/utils/logger.js.map +1 -0
  353. package/dist/utils/prismaErrorHandler.d.ts.map +1 -1
  354. package/dist/utils/prismaErrorHandler.js +7 -0
  355. package/dist/utils/prismaErrorHandler.js.map +1 -0
  356. package/dist/utils/prismaWrapper.d.ts +1 -0
  357. package/dist/utils/prismaWrapper.d.ts.map +1 -1
  358. package/dist/utils/prismaWrapper.js +8 -0
  359. package/dist/utils/prismaWrapper.js.map +1 -0
  360. package/docker-compose.yml +19 -0
  361. package/package.json +21 -4
  362. package/prisma/migrations/20251109122857_annuoncements_comments/migration.sql +30 -0
  363. package/prisma/migrations/20251109135555_reactions_announcements_comments/migration.sql +35 -0
  364. package/prisma/schema.prisma +180 -12
  365. package/scripts/test-pre-push.ts +14 -0
  366. package/src/index.ts +247 -52
  367. package/src/instrument.ts +15 -0
  368. package/src/lib/config/env.ts +132 -0
  369. package/src/lib/fileUpload.ts +13 -6
  370. package/src/lib/googleCloudStorage.ts +23 -6
  371. package/src/lib/jsonConversion.ts +12 -14
  372. package/src/lib/prisma.ts +23 -2
  373. package/src/lib/pusher.ts +11 -6
  374. package/src/lib/redis.ts +56 -0
  375. package/src/lib/thumbnailGenerator.ts +170 -168
  376. package/src/middleware/auth.ts +86 -137
  377. package/src/middleware/security.ts +80 -0
  378. package/src/models/agenda.ts +46 -0
  379. package/src/models/announcement.ts +134 -0
  380. package/src/models/assignment.ts +322 -0
  381. package/src/models/attendance.ts +208 -0
  382. package/src/models/auth.ts +247 -0
  383. package/src/models/class.ts +598 -0
  384. package/src/models/comment.ts +152 -0
  385. package/src/models/conversation.ts +200 -0
  386. package/src/models/event.ts +177 -0
  387. package/src/models/file.ts +129 -0
  388. package/src/models/folder.ts +225 -0
  389. package/src/models/labChat.ts +213 -0
  390. package/src/models/marketing.ts +45 -0
  391. package/src/models/message.ts +153 -0
  392. package/src/models/newtonChat.ts +70 -0
  393. package/src/models/notification.ts +54 -0
  394. package/src/models/section.ts +98 -0
  395. package/src/models/user.ts +47 -0
  396. package/src/models/worksheet.ts +294 -0
  397. package/src/pipelines/aiLabChat.ts +511 -0
  398. package/src/pipelines/aiNewtonChat.ts +347 -0
  399. package/src/pipelines/gradeWorksheet.ts +286 -0
  400. package/src/routers/_app.ts +6 -0
  401. package/src/routers/agenda.ts +3 -61
  402. package/src/routers/announcement.ts +616 -79
  403. package/src/routers/assignment.ts +148 -1827
  404. package/src/routers/attendance.ts +16 -277
  405. package/src/routers/auth.ts +79 -313
  406. package/src/routers/class.ts +265 -1038
  407. package/src/routers/comment.ts +76 -0
  408. package/src/routers/conversation.ts +53 -284
  409. package/src/routers/event.ts +50 -481
  410. package/src/routers/file.ts +45 -344
  411. package/src/routers/folder.ts +107 -836
  412. package/src/routers/labChat.ts +29 -969
  413. package/src/routers/marketing.ts +35 -77
  414. package/src/routers/message.ts +45 -571
  415. package/src/routers/newtonChat.ts +36 -0
  416. package/src/routers/notifications.ts +32 -82
  417. package/src/routers/section.ts +58 -322
  418. package/src/routers/user.ts +49 -226
  419. package/src/routers/worksheet.ts +252 -0
  420. package/src/seedDatabase.ts +328 -289
  421. package/src/services/agenda.ts +21 -0
  422. package/src/services/announcement.ts +290 -0
  423. package/src/services/assignment.ts +1198 -0
  424. package/src/services/attendance.ts +85 -0
  425. package/src/services/auth.ts +277 -0
  426. package/src/services/class.ts +622 -0
  427. package/src/services/comment.ts +106 -0
  428. package/src/services/conversation.ts +213 -0
  429. package/src/services/event.ts +231 -0
  430. package/src/services/file.ts +167 -0
  431. package/src/services/folder.ts +316 -0
  432. package/src/services/labChat.ts +352 -0
  433. package/src/services/marketing.ts +57 -0
  434. package/src/services/message.ts +461 -0
  435. package/src/services/newtonChat.ts +222 -0
  436. package/src/services/notification.ts +50 -0
  437. package/src/services/section.ts +283 -0
  438. package/src/services/user.ts +172 -0
  439. package/src/services/worksheet.ts +358 -0
  440. package/src/trpc.ts +4 -0
  441. package/src/utils/aiUser.ts +4 -3
  442. package/src/utils/email.ts +33 -4
  443. package/src/utils/generateInviteCode.ts +1 -3
  444. package/src/utils/inference.ts +89 -10
  445. package/src/utils/logger.ts +4 -1
  446. package/src/utils/prismaErrorHandler.ts +3 -0
  447. package/src/utils/prismaWrapper.ts +4 -0
  448. package/tests/globalSetup.ts +62 -0
  449. package/tests/helpers.ts +22 -0
  450. package/tests/middleware/security.test.ts +42 -0
  451. package/tests/routers/agenda.test.ts +138 -0
  452. package/tests/routers/announcement.test.ts +490 -0
  453. package/tests/routers/assignment.test.ts +837 -0
  454. package/tests/routers/attendance.test.ts +160 -0
  455. package/tests/routers/auth.test.ts +171 -0
  456. package/tests/{class.test.ts → routers/class.test.ts} +163 -92
  457. package/tests/routers/comment.test.ts +126 -0
  458. package/tests/routers/conversation.test.ts +145 -0
  459. package/tests/routers/event.test.ts +289 -0
  460. package/tests/routers/folder.test.ts +178 -0
  461. package/tests/routers/labChat.test.ts +115 -0
  462. package/tests/routers/marketing.test.ts +59 -0
  463. package/tests/routers/message.test.ts +123 -0
  464. package/tests/routers/notification.test.ts +69 -0
  465. package/tests/routers/section.test.ts +208 -0
  466. package/tests/server/rateLimit.test.ts +73 -0
  467. package/tests/setup.ts +39 -59
  468. package/tests/user.test.ts +136 -0
  469. package/tests/utils/aiUser.test.ts +22 -0
  470. package/tests/utils/generateInviteCode.test.ts +24 -0
  471. package/tests/utils/logger.test.ts +74 -0
  472. package/tests/utils/prismaErrorHandler.test.ts +101 -0
  473. package/tests/utils/prismaWrapper.test.ts +82 -0
  474. package/tests/worksheet.test.ts +181 -0
  475. package/tsconfig.json +9 -2
  476. package/vitest.config.ts +30 -1
  477. package/vitest.unit.config.ts +21 -0
  478. package/API_SPECIFICATION.md +0 -1597
  479. package/BASE64_REMOVAL_SUMMARY.md +0 -164
  480. package/CHAT_API_SPEC.md +0 -579
  481. package/LAB_CHAT_API_SPEC.md +0 -518
  482. package/dist/routers/school.d.ts +0 -208
  483. package/dist/routers/school.d.ts.map +0 -1
  484. package/dist/routers/school.js +0 -481
  485. package/src/lib/notificationHandler.ts +0 -36
  486. package/tests/auth.test.ts +0 -25
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Message model – messages, attachments, mentions, unread counts.
3
+ */
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]="ee83e4b5-6fa2-5533-b1fe-2d23d36519d1")}catch(e){}}();
6
+ import { prisma } from "../lib/prisma.js";
7
+ const messageInclude = {
8
+ attachments: {
9
+ select: {
10
+ id: true,
11
+ name: true,
12
+ type: true,
13
+ },
14
+ },
15
+ sender: {
16
+ select: {
17
+ id: true,
18
+ username: true,
19
+ profile: {
20
+ select: {
21
+ displayName: true,
22
+ profilePicture: true,
23
+ },
24
+ },
25
+ },
26
+ },
27
+ mentions: {
28
+ include: {
29
+ user: {
30
+ select: {
31
+ id: true,
32
+ username: true,
33
+ profile: {
34
+ select: {
35
+ displayName: true,
36
+ },
37
+ },
38
+ },
39
+ },
40
+ },
41
+ },
42
+ };
43
+ const senderSelect = {
44
+ id: true,
45
+ username: true,
46
+ profile: {
47
+ select: {
48
+ displayName: true,
49
+ profilePicture: true,
50
+ },
51
+ },
52
+ };
53
+ /** @returns User's membership in a conversation. */
54
+ export function findConversationMembership(conversationId, userId) {
55
+ return prisma.conversationMember.findFirst({
56
+ where: {
57
+ conversationId,
58
+ userId,
59
+ },
60
+ });
61
+ }
62
+ /** @returns Messages in conversation with cursor pagination. */
63
+ export function findMessages(conversationId, options) {
64
+ return prisma.message.findMany({
65
+ where: {
66
+ conversationId,
67
+ ...(options.cursor && {
68
+ createdAt: { lt: options.cursor },
69
+ }),
70
+ },
71
+ include: messageInclude,
72
+ orderBy: { createdAt: "desc" },
73
+ take: options.limit + 1,
74
+ });
75
+ }
76
+ /** @returns Memberships for mentioned users. */
77
+ export function findMentionedMemberships(conversationId, userIds) {
78
+ return prisma.conversationMember.findMany({
79
+ where: {
80
+ conversationId,
81
+ userId: { in: userIds },
82
+ },
83
+ });
84
+ }
85
+ /** @returns Message by ID with sender. */
86
+ export function findMessageById(messageId) {
87
+ return prisma.message.findUnique({
88
+ where: { id: messageId },
89
+ include: {
90
+ sender: {
91
+ select: senderSelect,
92
+ },
93
+ },
94
+ });
95
+ }
96
+ /** @returns Message by ID with minimal sender. */
97
+ export function findMessageByIdMinimal(messageId) {
98
+ return prisma.message.findUnique({
99
+ where: { id: messageId },
100
+ include: {
101
+ sender: {
102
+ select: { id: true, username: true },
103
+ },
104
+ },
105
+ });
106
+ }
107
+ /** Count messages in conversation after date, excluding sender's own. */
108
+ export function countUnreadMessages(conversationId, userId, after) {
109
+ return prisma.message.count({
110
+ where: {
111
+ conversationId,
112
+ senderId: { not: userId },
113
+ ...(after && { createdAt: { gt: after } }),
114
+ },
115
+ });
116
+ }
117
+ /** Count mentions of user in conversation after date. */
118
+ export function countUnreadMentions(conversationId, userId, after) {
119
+ return prisma.mention.count({
120
+ where: {
121
+ userId,
122
+ message: {
123
+ conversationId,
124
+ senderId: { not: userId },
125
+ ...(after && { createdAt: { gt: after } }),
126
+ },
127
+ },
128
+ });
129
+ }
130
+ //# sourceMappingURL=message.js.map
131
+ //# debugId=ee83e4b5-6fa2-5533-b1fe-2d23d36519d1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sources":["models/message.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Message model – messages, attachments, mentions, unread counts.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\nconst messageInclude = {\n attachments: {\n select: {\n id: true,\n name: true,\n type: true,\n },\n },\n sender: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n },\n },\n },\n },\n mentions: {\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n },\n },\n },\n },\n },\n },\n};\n\nconst senderSelect = {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n },\n },\n};\n\n/** @returns User's membership in a conversation. */\nexport function findConversationMembership(conversationId: string, userId: string) {\n return prisma.conversationMember.findFirst({\n where: {\n conversationId,\n userId,\n },\n });\n}\n\n/** @returns Messages in conversation with cursor pagination. */\nexport function findMessages(\n conversationId: string,\n options: {\n cursor?: Date;\n limit: number;\n }\n) {\n return prisma.message.findMany({\n where: {\n conversationId,\n ...(options.cursor && {\n createdAt: { lt: options.cursor },\n }),\n },\n include: messageInclude,\n orderBy: { createdAt: \"desc\" as const },\n take: options.limit + 1,\n });\n}\n\n/** @returns Memberships for mentioned users. */\nexport function findMentionedMemberships(\n conversationId: string,\n userIds: string[]\n) {\n return prisma.conversationMember.findMany({\n where: {\n conversationId,\n userId: { in: userIds },\n },\n });\n}\n\n/** @returns Message by ID with sender. */\nexport function findMessageById(messageId: string) {\n return prisma.message.findUnique({\n where: { id: messageId },\n include: {\n sender: {\n select: senderSelect,\n },\n },\n });\n}\n\n/** @returns Message by ID with minimal sender. */\nexport function findMessageByIdMinimal(messageId: string) {\n return prisma.message.findUnique({\n where: { id: messageId },\n include: {\n sender: {\n select: { id: true, username: true },\n },\n },\n });\n}\n\n/** Count messages in conversation after date, excluding sender's own. */\nexport function countUnreadMessages(\n conversationId: string,\n userId: string,\n after?: Date\n) {\n return prisma.message.count({\n where: {\n conversationId,\n senderId: { not: userId },\n ...(after && { createdAt: { gt: after } }),\n },\n });\n}\n\n/** Count mentions of user in conversation after date. */\nexport function countUnreadMentions(\n conversationId: string,\n userId: string,\n after?: Date\n) {\n return prisma.mention.count({\n where: {\n userId,\n message: {\n conversationId,\n senderId: { not: userId },\n ...(after && { createdAt: { gt: after } }),\n },\n },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,cAAc,GAAG;IACrB,WAAW,EAAE;QACX,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACX;KACF;IACD,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;iBACrB;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,MAAM,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE;wBACP,MAAM,EAAE;4BACN,WAAW,EAAE,IAAI;yBAClB;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,EAAE,EAAE,IAAI;IACR,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE;QACP,MAAM,EAAE;YACN,WAAW,EAAE,IAAI;YACjB,cAAc,EAAE,IAAI;SACrB;KACF;CACF,CAAC;AAEF,oDAAoD;AACpD,MAAM,UAAU,0BAA0B,CAAC,cAAsB,EAAE,MAAc;IAC/E,OAAO,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC;QACzC,KAAK,EAAE;YACL,cAAc;YACd,MAAM;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E,MAAM,UAAU,mBAAmB,CACjC,cAAsB,EACtB,MAAc,EACd,KAAY;IAEZ,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1B,KAAK,EAAE;YACL,cAAc;YACd,QAAQ,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;YACzB,GAAG,CAAC,KAAK,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;SAC3C;KACF,CAAC,CAAC;AACL,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,mBAAmB,CACjC,cAAsB,EACtB,MAAc,EACd,KAAY;IAEZ,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1B,KAAK,EAAE;YACL,MAAM;YACN,OAAO,EAAE;gBACP,cAAc;gBACd,QAAQ,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;gBACzB,GAAG,CAAC,KAAK,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;aAC3C;SACF;KACF,CAAC,CAAC;AACL,CAAC","debug_id":"ee83e4b5-6fa2-5533-b1fe-2d23d36519d1"}
@@ -0,0 +1,72 @@
1
+ /** @returns Class if user is a student. */
2
+ export declare function findClassWithStudent(classId: string, studentId: string): import(".prisma/client").Prisma.Prisma__ClassClient<{
3
+ id: string;
4
+ schoolId: string | null;
5
+ name: string;
6
+ subject: string;
7
+ color: string | null;
8
+ section: string;
9
+ syllabus: string | null;
10
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
11
+ /** @returns Submission for assignment and student. */
12
+ export declare function findSubmissionByAssignmentAndStudent(assignmentId: string, studentId: string): import(".prisma/client").Prisma.Prisma__SubmissionClient<{
13
+ id: string;
14
+ createdAt: Date;
15
+ assignmentId: string;
16
+ modifiedAt: Date;
17
+ studentId: string;
18
+ extendedResponse: string | null;
19
+ gradeReceived: number | null;
20
+ rubricState: string | null;
21
+ teacherComments: string | null;
22
+ submittedAt: Date | null;
23
+ submitted: boolean | null;
24
+ returned: boolean | null;
25
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
26
+ /** @returns Newton chat if user is a member, with conversation and assignment. */
27
+ export declare function findNewtonChatByIdAndMember(newtonChatId: string, userId: string): import(".prisma/client").Prisma.Prisma__NewtonChatClient<({
28
+ submission: {
29
+ assignment: {
30
+ id: string;
31
+ class: {
32
+ subject: string;
33
+ };
34
+ title: string;
35
+ instructions: string;
36
+ };
37
+ } & {
38
+ id: string;
39
+ createdAt: Date;
40
+ assignmentId: string;
41
+ modifiedAt: Date;
42
+ studentId: string;
43
+ extendedResponse: string | null;
44
+ gradeReceived: number | null;
45
+ rubricState: string | null;
46
+ teacherComments: string | null;
47
+ submittedAt: Date | null;
48
+ submitted: boolean | null;
49
+ returned: boolean | null;
50
+ };
51
+ conversation: {
52
+ id: string;
53
+ };
54
+ } & {
55
+ id: string;
56
+ createdAt: Date;
57
+ updatedAt: Date;
58
+ title: string;
59
+ submissionId: string;
60
+ conversationId: string;
61
+ }) | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
62
+ /** @returns Conversation members for given user IDs. */
63
+ export declare function findConversationMembersByUserIds(conversationId: string, userIds: string[]): import(".prisma/client").Prisma.PrismaPromise<{
64
+ id: string;
65
+ role: import(".prisma/client").$Enums.ConversationRole;
66
+ userId: string;
67
+ conversationId: string;
68
+ joinedAt: Date;
69
+ lastViewedAt: Date | null;
70
+ lastViewedMentionAt: Date | null;
71
+ }[]>;
72
+ //# sourceMappingURL=newtonChat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"newtonChat.d.ts","sourceRoot":"/","sources":["models/newtonChat.ts"],"names":[],"mappings":"AAKA,2CAA2C;AAC3C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;8HAOtE;AAED,sDAAsD;AACtD,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM;;;;;;;;;;;;;8HAQlB;AAED,kFAAkF;AAClF,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+HAyBf;AAED,wDAAwD;AACxD,wBAAgB,gCAAgC,CAC9C,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EAAE;;;;;;;;KAQlB"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Newton chat model – tutor conversations linked to submissions.
3
+ */
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]="2a3ad304-7858-550e-b054-2e94c350f8de")}catch(e){}}();
6
+ import { prisma } from "../lib/prisma.js";
7
+ /** @returns Class if user is a student. */
8
+ export function findClassWithStudent(classId, studentId) {
9
+ return prisma.class.findFirst({
10
+ where: {
11
+ id: classId,
12
+ students: { some: { id: studentId } },
13
+ },
14
+ });
15
+ }
16
+ /** @returns Submission for assignment and student. */
17
+ export function findSubmissionByAssignmentAndStudent(assignmentId, studentId) {
18
+ return prisma.submission.findFirst({
19
+ where: {
20
+ assignmentId,
21
+ studentId,
22
+ },
23
+ });
24
+ }
25
+ /** @returns Newton chat if user is a member, with conversation and assignment. */
26
+ export function findNewtonChatByIdAndMember(newtonChatId, userId) {
27
+ return prisma.newtonChat.findFirst({
28
+ where: {
29
+ id: newtonChatId,
30
+ conversation: {
31
+ members: { some: { userId } },
32
+ },
33
+ },
34
+ include: {
35
+ conversation: { select: { id: true } },
36
+ submission: {
37
+ include: {
38
+ assignment: {
39
+ select: {
40
+ id: true,
41
+ title: true,
42
+ instructions: true,
43
+ class: { select: { subject: true } },
44
+ },
45
+ },
46
+ },
47
+ },
48
+ },
49
+ });
50
+ }
51
+ /** @returns Conversation members for given user IDs. */
52
+ export function findConversationMembersByUserIds(conversationId, userIds) {
53
+ return prisma.conversationMember.findMany({
54
+ where: {
55
+ conversationId,
56
+ userId: { in: userIds },
57
+ },
58
+ });
59
+ }
60
+ //# sourceMappingURL=newtonChat.js.map
61
+ //# debugId=2a3ad304-7858-550e-b054-2e94c350f8de
@@ -0,0 +1 @@
1
+ {"version":3,"file":"newtonChat.js","sources":["models/newtonChat.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Newton chat model – tutor conversations linked to submissions.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\n/** @returns Class if user is a student. */\nexport function findClassWithStudent(classId: string, studentId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n students: { some: { id: studentId } },\n },\n });\n}\n\n/** @returns Submission for assignment and student. */\nexport function findSubmissionByAssignmentAndStudent(\n assignmentId: string,\n studentId: string\n) {\n return prisma.submission.findFirst({\n where: {\n assignmentId,\n studentId,\n },\n });\n}\n\n/** @returns Newton chat if user is a member, with conversation and assignment. */\nexport function findNewtonChatByIdAndMember(\n newtonChatId: string,\n userId: string\n) {\n return prisma.newtonChat.findFirst({\n where: {\n id: newtonChatId,\n conversation: {\n members: { some: { userId } },\n },\n },\n include: {\n conversation: { select: { id: true } },\n submission: {\n include: {\n assignment: {\n select: {\n id: true,\n title: true,\n instructions: true,\n class: { select: { subject: true } },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Conversation members for given user IDs. */\nexport function findConversationMembersByUserIds(\n conversationId: string,\n userIds: string[]\n) {\n return prisma.conversationMember.findMany({\n where: {\n conversationId,\n userId: { in: userIds },\n },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,2CAA2C;AAC3C,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAA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"2a3ad304-7858-550e-b054-2e94c350f8de"}
@@ -0,0 +1,65 @@
1
+ /** @returns Notifications for a receiver, newest first. */
2
+ export declare function findNotificationsByReceiverId(receiverId: string): import(".prisma/client").Prisma.PrismaPromise<({
3
+ sender: {
4
+ username: string;
5
+ } | null;
6
+ receiver: {
7
+ username: string;
8
+ };
9
+ } & {
10
+ id: string;
11
+ createdAt: Date;
12
+ title: string;
13
+ content: string;
14
+ read: boolean;
15
+ senderId: string | null;
16
+ receiverId: string;
17
+ })[]>;
18
+ /** @returns Notification by ID. */
19
+ export declare function findNotificationById(id: string): import(".prisma/client").Prisma.Prisma__NotificationClient<({
20
+ sender: {
21
+ username: string;
22
+ } | null;
23
+ receiver: {
24
+ username: string;
25
+ };
26
+ } & {
27
+ id: string;
28
+ createdAt: Date;
29
+ title: string;
30
+ content: string;
31
+ read: boolean;
32
+ senderId: string | null;
33
+ receiverId: string;
34
+ }) | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
35
+ /** Create a notification for one receiver. */
36
+ export declare function createNotification(data: {
37
+ receiverId: string;
38
+ title: string;
39
+ content: string;
40
+ }): import(".prisma/client").Prisma.Prisma__NotificationClient<{
41
+ id: string;
42
+ createdAt: Date;
43
+ title: string;
44
+ content: string;
45
+ read: boolean;
46
+ senderId: string | null;
47
+ receiverId: string;
48
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
49
+ /** Create multiple notifications in one call. */
50
+ export declare function createManyNotifications(data: Array<{
51
+ receiverId: string;
52
+ title: string;
53
+ content: string;
54
+ }>): import(".prisma/client").Prisma.PrismaPromise<import(".prisma/client").Prisma.BatchPayload>;
55
+ /** Mark a notification as read. */
56
+ export declare function markNotificationAsRead(id: string): import(".prisma/client").Prisma.Prisma__NotificationClient<{
57
+ id: string;
58
+ createdAt: Date;
59
+ title: string;
60
+ content: string;
61
+ read: boolean;
62
+ senderId: string | null;
63
+ receiverId: string;
64
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
65
+ //# sourceMappingURL=notification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"/","sources":["models/notification.ts"],"names":[],"mappings":"AAUA,2DAA2D;AAC3D,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;MAM/D;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;+HAK9C;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;;;;;;;;wHAIA;AAED,iDAAiD;AACjD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,+FAKpE;AAED,mCAAmC;AACnC,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM;;;;;;;;wHAKhD"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Notification model – in-app notifications, create, mark read.
3
+ */
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]="a46a17d1-964d-5ba3-91bb-347799a4a82f")}catch(e){}}();
6
+ import { prisma } from "../lib/prisma.js";
7
+ const notificationInclude = {
8
+ sender: { select: { username: true } },
9
+ receiver: { select: { username: true } },
10
+ };
11
+ /** @returns Notifications for a receiver, newest first. */
12
+ export function findNotificationsByReceiverId(receiverId) {
13
+ return prisma.notification.findMany({
14
+ where: { receiverId },
15
+ orderBy: { createdAt: "desc" },
16
+ include: notificationInclude,
17
+ });
18
+ }
19
+ /** @returns Notification by ID. */
20
+ export function findNotificationById(id) {
21
+ return prisma.notification.findUnique({
22
+ where: { id },
23
+ include: notificationInclude,
24
+ });
25
+ }
26
+ /** Create a notification for one receiver. */
27
+ export function createNotification(data) {
28
+ return prisma.notification.create({
29
+ data,
30
+ });
31
+ }
32
+ /** Create multiple notifications in one call. */
33
+ export function createManyNotifications(data) {
34
+ return prisma.notification.createMany({
35
+ data,
36
+ });
37
+ }
38
+ /** Mark a notification as read. */
39
+ export function markNotificationAsRead(id) {
40
+ return prisma.notification.update({
41
+ where: { id },
42
+ data: { read: true },
43
+ });
44
+ }
45
+ //# sourceMappingURL=notification.js.map
46
+ //# debugId=a46a17d1-964d-5ba3-91bb-347799a4a82f
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.js","sources":["models/notification.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Notification model – in-app notifications, create, mark read.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\nconst notificationInclude = {\n sender: { select: { username: true } },\n receiver: { select: { username: true } },\n};\n\n/** @returns Notifications for a receiver, newest first. */\nexport function findNotificationsByReceiverId(receiverId: string) {\n return prisma.notification.findMany({\n where: { receiverId },\n orderBy: { createdAt: \"desc\" },\n include: notificationInclude,\n });\n}\n\n/** @returns Notification by ID. */\nexport function findNotificationById(id: string) {\n return prisma.notification.findUnique({\n where: { id },\n include: notificationInclude,\n });\n}\n\n/** Create a notification for one receiver. */\nexport function createNotification(data: {\n receiverId: string;\n title: string;\n content: string;\n}) {\n return prisma.notification.create({\n data,\n });\n}\n\n/** Create multiple notifications in one call. */\nexport function createManyNotifications(\n data: Array<{ receiverId: string; title: string; content: string }>\n) {\n return prisma.notification.createMany({\n data,\n });\n}\n\n/** Mark a notification as read. */\nexport function markNotificationAsRead(id: string) {\n return prisma.notification.update({\n where: { id },\n data: { read: true },\n });\n}\n"],"names":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a4a82f"}
@@ -0,0 +1,102 @@
1
+ /** @returns Section by ID. */
2
+ export declare function findSectionById(id: string): import(".prisma/client").Prisma.Prisma__SectionClient<{
3
+ id: string;
4
+ classId: string;
5
+ name: string;
6
+ color: string | null;
7
+ order: number | null;
8
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
9
+ /** @returns Class if user is a teacher. */
10
+ export declare function findClassWithTeacher(classId: string, teacherId: string): import(".prisma/client").Prisma.Prisma__ClassClient<{
11
+ id: string;
12
+ schoolId: string | null;
13
+ name: string;
14
+ subject: string;
15
+ color: string | null;
16
+ section: string;
17
+ syllabus: string | null;
18
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
19
+ /** Create a section in a class. */
20
+ export declare function createSection(data: {
21
+ id?: string;
22
+ name: string;
23
+ order: number;
24
+ classId: string;
25
+ color?: string;
26
+ }): import(".prisma/client").Prisma.Prisma__SectionClient<{
27
+ id: string;
28
+ classId: string;
29
+ name: string;
30
+ color: string | null;
31
+ order: number | null;
32
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
33
+ /** @returns Sections for a class (id, order only). */
34
+ export declare function findSectionsByClassId(classId: string): import(".prisma/client").Prisma.PrismaPromise<{
35
+ id: string;
36
+ order: number | null;
37
+ }[]>;
38
+ /** @returns Assignments for a class (id, order only). */
39
+ export declare function findAssignmentsByClassId(classId: string): import(".prisma/client").Prisma.PrismaPromise<{
40
+ id: string;
41
+ order: number | null;
42
+ }[]>;
43
+ /** Update section order. */
44
+ export declare function updateSectionOrder(id: string, order: number): import(".prisma/client").Prisma.Prisma__SectionClient<{
45
+ id: string;
46
+ classId: string;
47
+ name: string;
48
+ color: string | null;
49
+ order: number | null;
50
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
51
+ /** Update assignment order. */
52
+ export declare function updateAssignmentOrder(id: string, order: number): import(".prisma/client").Prisma.Prisma__AssignmentClient<{
53
+ type: import(".prisma/client").$Enums.AssignmentType;
54
+ id: string;
55
+ createdAt: Date | null;
56
+ classId: string;
57
+ title: string;
58
+ dueDate: Date;
59
+ maxGrade: number | null;
60
+ eventId: string | null;
61
+ instructions: string;
62
+ modifiedAt: Date | null;
63
+ teacherId: string;
64
+ acceptFiles: boolean;
65
+ acceptExtendedResponse: boolean;
66
+ acceptWorksheet: boolean;
67
+ gradeWithAI: boolean;
68
+ aiPolicyLevel: number;
69
+ sectionId: string | null;
70
+ graded: boolean;
71
+ weight: number;
72
+ inProgress: boolean;
73
+ template: boolean;
74
+ markSchemeId: string | null;
75
+ order: number | null;
76
+ gradingBoundaryId: string | null;
77
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
78
+ /** Update section name and color. */
79
+ export declare function updateSection(id: string, data: {
80
+ name: string;
81
+ color?: string;
82
+ }): import(".prisma/client").Prisma.Prisma__SectionClient<{
83
+ id: string;
84
+ classId: string;
85
+ name: string;
86
+ color: string | null;
87
+ order: number | null;
88
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
89
+ /** Delete a section. */
90
+ export declare function deleteSectionById(id: string): import(".prisma/client").Prisma.Prisma__SectionClient<{
91
+ id: string;
92
+ classId: string;
93
+ name: string;
94
+ color: string | null;
95
+ order: number | null;
96
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
97
+ /** @returns Section by ID and classId. */
98
+ export declare function findSectionByClassAndId(sectionId: string, classId: string): import(".prisma/client").Prisma.Prisma__SectionClient<{
99
+ id: string;
100
+ classId: string;
101
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
102
+ //# sourceMappingURL=section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section.d.ts","sourceRoot":"/","sources":["models/section.ts"],"names":[],"mappings":"AAKA,8BAA8B;AAC9B,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM;;;;;;8HAIzC;AAED,2CAA2C;AAC3C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;8HAOtE;AAED,mCAAmC;AACnC,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;;;;;wHAUA;AAED,sDAAsD;AACtD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM;;;KAKpD;AAED,yDAAyD;AACzD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM;;;KAKvD;AAED,4BAA4B;AAC5B,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;;;wHAK3D;AAED,+BAA+B;AAC/B,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;wHAK9D;AAED,qCAAqC;AACrC,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;wHAMvC;AAED,wBAAwB;AACxB,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM;;;;;;wHAI3C;AAED,0CAA0C;AAC1C,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;8HAKzE"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Section model – class sections, ordering, assignment grouping.
3
+ */
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]="fc005d3b-3385-5cdb-b0e2-3801da4b9a22")}catch(e){}}();
6
+ import { prisma } from "../lib/prisma.js";
7
+ /** @returns Section by ID. */
8
+ export function findSectionById(id) {
9
+ return prisma.section.findUnique({
10
+ where: { id },
11
+ });
12
+ }
13
+ /** @returns Class if user is a teacher. */
14
+ export function findClassWithTeacher(classId, teacherId) {
15
+ return prisma.class.findFirst({
16
+ where: {
17
+ id: classId,
18
+ teachers: { some: { id: teacherId } },
19
+ },
20
+ });
21
+ }
22
+ /** Create a section in a class. */
23
+ export function createSection(data) {
24
+ return prisma.section.create({
25
+ data: {
26
+ ...(data.id && { id: data.id }),
27
+ name: data.name,
28
+ order: data.order,
29
+ class: { connect: { id: data.classId } },
30
+ ...(data.color && { color: data.color }),
31
+ },
32
+ });
33
+ }
34
+ /** @returns Sections for a class (id, order only). */
35
+ export function findSectionsByClassId(classId) {
36
+ return prisma.section.findMany({
37
+ where: { classId },
38
+ select: { id: true, order: true },
39
+ });
40
+ }
41
+ /** @returns Assignments for a class (id, order only). */
42
+ export function findAssignmentsByClassId(classId) {
43
+ return prisma.assignment.findMany({
44
+ where: { classId },
45
+ select: { id: true, order: true },
46
+ });
47
+ }
48
+ /** Update section order. */
49
+ export function updateSectionOrder(id, order) {
50
+ return prisma.section.update({
51
+ where: { id },
52
+ data: { order },
53
+ });
54
+ }
55
+ /** Update assignment order. */
56
+ export function updateAssignmentOrder(id, order) {
57
+ return prisma.assignment.update({
58
+ where: { id },
59
+ data: { order },
60
+ });
61
+ }
62
+ /** Update section name and color. */
63
+ export function updateSection(id, data) {
64
+ return prisma.section.update({
65
+ where: { id },
66
+ data,
67
+ });
68
+ }
69
+ /** Delete a section. */
70
+ export function deleteSectionById(id) {
71
+ return prisma.section.delete({
72
+ where: { id },
73
+ });
74
+ }
75
+ /** @returns Section by ID and classId. */
76
+ export function findSectionByClassAndId(sectionId, classId) {
77
+ return prisma.section.findFirst({
78
+ where: { id: sectionId, classId },
79
+ select: { id: true, classId: true },
80
+ });
81
+ }
82
+ //# sourceMappingURL=section.js.map
83
+ //# debugId=fc005d3b-3385-5cdb-b0e2-3801da4b9a22
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section.js","sources":["models/section.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Section model – class sections, ordering, assignment grouping.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\n/** @returns Section by ID. */\nexport function findSectionById(id: string) {\n return prisma.section.findUnique({\n where: { id },\n });\n}\n\n/** @returns Class if user is a teacher. */\nexport function findClassWithTeacher(classId: string, teacherId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n teachers: { some: { id: teacherId } },\n },\n });\n}\n\n/** Create a section in a class. */\nexport function createSection(data: {\n id?: string;\n name: string;\n order: number;\n classId: string;\n color?: string;\n}) {\n return prisma.section.create({\n data: {\n ...(data.id && { id: data.id }),\n name: data.name,\n order: data.order,\n class: { connect: { id: data.classId } },\n ...(data.color && { color: data.color }),\n },\n });\n}\n\n/** @returns Sections for a class (id, order only). */\nexport function findSectionsByClassId(classId: string) {\n return prisma.section.findMany({\n where: { classId },\n select: { id: true, order: true },\n });\n}\n\n/** @returns Assignments for a class (id, order only). */\nexport function findAssignmentsByClassId(classId: string) {\n return prisma.assignment.findMany({\n where: { classId },\n select: { id: true, order: true },\n });\n}\n\n/** Update section order. */\nexport function updateSectionOrder(id: string, order: number) {\n return prisma.section.update({\n where: { id },\n data: { order },\n });\n}\n\n/** Update assignment order. */\nexport function updateAssignmentOrder(id: string, order: number) {\n return prisma.assignment.update({\n where: { id },\n data: { order },\n });\n}\n\n/** Update section name and color. */\nexport function updateSection(\n id: string,\n data: { name: string; color?: string }\n) {\n return prisma.section.update({\n where: { id },\n data,\n });\n}\n\n/** Delete a section. */\nexport function deleteSectionById(id: string) {\n return prisma.section.delete({\n where: { id },\n });\n}\n\n/** @returns Section by ID and classId. */\nexport function findSectionByClassAndId(sectionId: string, classId: string) {\n return prisma.section.findFirst({\n where: { id: sectionId, classId },\n select: { id: true, classId: true },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,8BAA8B;AAC9B,MAAM,UAAU,eAAe,CAAC,EAAU;IACxC,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;QAC/B,KAAK,EAAE,EAAE,EAAE,EAAE;KACd,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB;IACrE,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QAC5B,KAAK,EAAE;YACL,EAAE,EAAE,OAAO;YACX,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE;SACtC;KACF,CAAC,CAAC;AACL,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,aAAa,CAAC,IAM7B;IACC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;QAC3B,IAAI,EAAE;YACJ,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YAC/B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE;YACxC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;SACzC;KACF,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,qBAAqB,CAAC,OAAe;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AAM,UAAU,uBAAuB,CAAC,SAAiB,EAAE,OAAe;IACxE,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;QAC9B,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;QACjC,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;KACpC,CAAC,CAAC;AACL,CAAC","debug_id":"fc005d3b-3385-5cdb-b0e2-3801da4b9a22"}
@@ -0,0 +1,39 @@
1
+ /** @returns User by ID (id, username only). */
2
+ export declare function findUserById(id: string): import(".prisma/client").Prisma.Prisma__UserClient<{
3
+ id: string;
4
+ username: string;
5
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
6
+ /** @returns User profile by userId. */
7
+ export declare function findUserProfileByUserId(userId: string): import(".prisma/client").Prisma.Prisma__UserProfileClient<{
8
+ id: string;
9
+ userId: string;
10
+ displayName: string | null;
11
+ bio: string | null;
12
+ location: string | null;
13
+ website: string | null;
14
+ profilePicture: string | null;
15
+ profilePictureThumbnail: string | null;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
19
+ /** Create or update user profile. */
20
+ export declare function upsertUserProfile(userId: string, data: {
21
+ displayName?: string;
22
+ bio?: string;
23
+ location?: string;
24
+ website?: string;
25
+ profilePicture?: string;
26
+ profilePictureThumbnail?: string;
27
+ }): import(".prisma/client").Prisma.Prisma__UserProfileClient<{
28
+ id: string;
29
+ userId: string;
30
+ displayName: string | null;
31
+ bio: string | null;
32
+ location: string | null;
33
+ website: string | null;
34
+ profilePicture: string | null;
35
+ profilePictureThumbnail: string | null;
36
+ createdAt: Date;
37
+ updatedAt: Date;
38
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, import(".prisma/client").Prisma.PrismaClientOptions>;
39
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"/","sources":["models/user.ts"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM;;;8HAQtC;AAED,uCAAuC;AACvC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;8HAIrD;AAED,qCAAqC;AACrC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IACJ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;;;;;;;;;;;wHAaF"}