@studious-lms/server 1.11.0 → 1.12.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 (156) hide show
  1. package/.env.example +3 -0
  2. package/dist/index.js +40 -4
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/config/cors.d.ts.map +1 -1
  5. package/dist/lib/config/cors.js +7 -2
  6. package/dist/lib/config/cors.js.map +1 -1
  7. package/dist/lib/config/env.d.ts +8 -0
  8. package/dist/lib/config/env.d.ts.map +1 -1
  9. package/dist/lib/config/env.js +5 -2
  10. package/dist/lib/config/env.js.map +1 -1
  11. package/dist/lib/pusher.d.ts +2 -1
  12. package/dist/lib/pusher.d.ts.map +1 -1
  13. package/dist/lib/pusher.js +4 -3
  14. package/dist/lib/pusher.js.map +1 -1
  15. package/dist/models/agenda.d.ts +6 -0
  16. package/dist/models/agenda.d.ts.map +1 -1
  17. package/dist/models/announcement.d.ts +3 -0
  18. package/dist/models/announcement.d.ts.map +1 -1
  19. package/dist/models/assignment.d.ts +61 -0
  20. package/dist/models/assignment.d.ts.map +1 -1
  21. package/dist/models/auth.d.ts +6 -0
  22. package/dist/models/auth.d.ts.map +1 -1
  23. package/dist/models/class.d.ts +18 -0
  24. package/dist/models/class.d.ts.map +1 -1
  25. package/dist/models/class.js +5 -2
  26. package/dist/models/class.js.map +1 -1
  27. package/dist/models/comment.d.ts +6 -0
  28. package/dist/models/comment.d.ts.map +1 -1
  29. package/dist/models/event.d.ts +12 -0
  30. package/dist/models/event.d.ts.map +1 -1
  31. package/dist/models/file.d.ts +38 -0
  32. package/dist/models/file.d.ts.map +1 -1
  33. package/dist/models/folder.d.ts +6 -0
  34. package/dist/models/folder.d.ts.map +1 -1
  35. package/dist/models/labChat.d.ts +6 -0
  36. package/dist/models/labChat.d.ts.map +1 -1
  37. package/dist/models/newtonChat.d.ts +3 -0
  38. package/dist/models/newtonChat.d.ts.map +1 -1
  39. package/dist/models/school.d.ts +3 -0
  40. package/dist/models/school.d.ts.map +1 -1
  41. package/dist/models/section.d.ts +3 -0
  42. package/dist/models/section.d.ts.map +1 -1
  43. package/dist/models/worksheet.d.ts +58 -0
  44. package/dist/models/worksheet.d.ts.map +1 -1
  45. package/dist/models/worksheet.js +26 -2
  46. package/dist/models/worksheet.js.map +1 -1
  47. package/dist/routers/_app.d.ts +4055 -1823
  48. package/dist/routers/_app.d.ts.map +1 -1
  49. package/dist/routers/_app.js +6 -2
  50. package/dist/routers/_app.js.map +1 -1
  51. package/dist/routers/admin.d.ts +190 -0
  52. package/dist/routers/admin.d.ts.map +1 -0
  53. package/dist/routers/admin.js +50 -0
  54. package/dist/routers/admin.js.map +1 -0
  55. package/dist/routers/agenda.d.ts +6 -0
  56. package/dist/routers/agenda.d.ts.map +1 -1
  57. package/dist/routers/announcement.d.ts +2 -0
  58. package/dist/routers/announcement.d.ts.map +1 -1
  59. package/dist/routers/assignment.d.ts +50 -0
  60. package/dist/routers/assignment.d.ts.map +1 -1
  61. package/dist/routers/class.d.ts +31 -0
  62. package/dist/routers/class.d.ts.map +1 -1
  63. package/dist/routers/class.js +5 -2
  64. package/dist/routers/class.js.map +1 -1
  65. package/dist/routers/comment.d.ts +2 -0
  66. package/dist/routers/comment.d.ts.map +1 -1
  67. package/dist/routers/discussion.d.ts +823 -0
  68. package/dist/routers/discussion.d.ts.map +1 -0
  69. package/dist/routers/discussion.js +151 -0
  70. package/dist/routers/discussion.js.map +1 -0
  71. package/dist/routers/event.d.ts +3 -0
  72. package/dist/routers/event.d.ts.map +1 -1
  73. package/dist/routers/file.d.ts +4 -0
  74. package/dist/routers/file.d.ts.map +1 -1
  75. package/dist/routers/school.d.ts +6 -0
  76. package/dist/routers/school.d.ts.map +1 -1
  77. package/dist/routers/worksheet.d.ts +3 -0
  78. package/dist/routers/worksheet.d.ts.map +1 -1
  79. package/dist/seedDatabase.d.ts.map +1 -1
  80. package/dist/seedDatabase.js +1490 -1307
  81. package/dist/seedDatabase.js.map +1 -1
  82. package/dist/services/adminInstitution.d.ts +102 -0
  83. package/dist/services/adminInstitution.d.ts.map +1 -0
  84. package/dist/services/adminInstitution.js +117 -0
  85. package/dist/services/adminInstitution.js.map +1 -0
  86. package/dist/services/adminRunJob.d.ts +45 -0
  87. package/dist/services/adminRunJob.d.ts.map +1 -0
  88. package/dist/services/adminRunJob.js +41 -0
  89. package/dist/services/adminRunJob.js.map +1 -0
  90. package/dist/services/agenda.d.ts +6 -0
  91. package/dist/services/agenda.d.ts.map +1 -1
  92. package/dist/services/assignment.d.ts +50 -0
  93. package/dist/services/assignment.d.ts.map +1 -1
  94. package/dist/services/assignment.js +8 -3
  95. package/dist/services/assignment.js.map +1 -1
  96. package/dist/services/class.d.ts +31 -0
  97. package/dist/services/class.d.ts.map +1 -1
  98. package/dist/services/class.js +14 -2
  99. package/dist/services/class.js.map +1 -1
  100. package/dist/services/comment.d.ts +2 -0
  101. package/dist/services/comment.d.ts.map +1 -1
  102. package/dist/services/discussion.d.ts +762 -0
  103. package/dist/services/discussion.d.ts.map +1 -0
  104. package/dist/services/discussion.js +625 -0
  105. package/dist/services/discussion.js.map +1 -0
  106. package/dist/services/event.d.ts +3 -0
  107. package/dist/services/event.d.ts.map +1 -1
  108. package/dist/services/file.d.ts +8 -0
  109. package/dist/services/file.d.ts.map +1 -1
  110. package/dist/services/school.d.ts +6 -0
  111. package/dist/services/school.d.ts.map +1 -1
  112. package/dist/services/studentProgress.d.ts.map +1 -1
  113. package/dist/services/studentProgress.js +27 -5
  114. package/dist/services/studentProgress.js.map +1 -1
  115. package/dist/services/studentProgressInferenceCache.d.ts +16 -0
  116. package/dist/services/studentProgressInferenceCache.d.ts.map +1 -0
  117. package/dist/services/studentProgressInferenceCache.js +43 -0
  118. package/dist/services/studentProgressInferenceCache.js.map +1 -0
  119. package/dist/services/worksheet.d.ts +3 -0
  120. package/dist/services/worksheet.d.ts.map +1 -1
  121. package/dist/services/worksheet.js +5 -5
  122. package/dist/services/worksheet.js.map +1 -1
  123. package/dist/trpc.d.ts +12 -0
  124. package/dist/trpc.d.ts.map +1 -1
  125. package/dist/trpc.js +16 -3
  126. package/dist/trpc.js.map +1 -1
  127. package/dist/utils/adminPanelAccess.d.ts +8 -0
  128. package/dist/utils/adminPanelAccess.d.ts.map +1 -0
  129. package/dist/utils/adminPanelAccess.js +44 -0
  130. package/dist/utils/adminPanelAccess.js.map +1 -0
  131. package/package.json +1 -1
  132. package/prisma/migrations/20260510183000_add_discussions/migration.sql +151 -0
  133. package/prisma/schema.prisma +97 -0
  134. package/src/index.ts +39 -2
  135. package/src/lib/config/cors.ts +5 -0
  136. package/src/lib/config/env.ts +3 -0
  137. package/src/lib/pusher.ts +2 -1
  138. package/src/models/class.ts +3 -0
  139. package/src/models/worksheet.ts +28 -0
  140. package/src/routers/_app.ts +4 -0
  141. package/src/routers/admin.ts +70 -0
  142. package/src/routers/class.ts +3 -0
  143. package/src/routers/discussion.ts +205 -0
  144. package/src/seedDatabase.ts +1713 -1361
  145. package/src/services/adminInstitution.ts +140 -0
  146. package/src/services/adminRunJob.ts +46 -0
  147. package/src/services/assignment.ts +11 -1
  148. package/src/services/class.ts +18 -0
  149. package/src/services/discussion.ts +701 -0
  150. package/src/services/studentProgress.ts +80 -3
  151. package/src/services/studentProgressInferenceCache.ts +64 -0
  152. package/src/services/worksheet.ts +4 -2
  153. package/src/trpc.ts +15 -0
  154. package/src/utils/adminPanelAccess.ts +46 -0
  155. package/tests/integration/routers/discussion.test.ts +253 -0
  156. package/tests/unit/services/discussion.test.ts +356 -0
@@ -0,0 +1,762 @@
1
+ import type { DiscussionType, Prisma, ReactionType } from "@prisma/client";
2
+ declare const replyInclude: {
3
+ readonly author: {
4
+ readonly select: {
5
+ readonly id: true;
6
+ readonly username: true;
7
+ readonly profile: {
8
+ readonly select: {
9
+ readonly displayName: true;
10
+ readonly profilePicture: true;
11
+ readonly profilePictureThumbnail: true;
12
+ };
13
+ };
14
+ };
15
+ };
16
+ readonly attachments: {
17
+ readonly select: {
18
+ readonly id: true;
19
+ readonly name: true;
20
+ readonly type: true;
21
+ readonly size: true;
22
+ readonly path: true;
23
+ readonly uploadedAt: true;
24
+ readonly uploadStatus: true;
25
+ readonly thumbnailId: true;
26
+ readonly thumbnail: {
27
+ readonly select: {
28
+ readonly id: true;
29
+ readonly path: true;
30
+ };
31
+ };
32
+ };
33
+ };
34
+ readonly reactions: {
35
+ readonly select: {
36
+ readonly type: true;
37
+ readonly userId: true;
38
+ };
39
+ };
40
+ };
41
+ type ReplyWithInclude = Prisma.DiscussionReplyGetPayload<{
42
+ include: typeof replyInclude;
43
+ }>;
44
+ export type DiscussionReplyTree = ReturnType<typeof serializeReply> & {
45
+ children: DiscussionReplyTree[];
46
+ };
47
+ declare function serializeReply(reply: ReplyWithInclude, userId: string): {
48
+ id: string;
49
+ discussionId: string;
50
+ authorId: string;
51
+ parentId: string | null;
52
+ body: string;
53
+ deletedAt: Date | null;
54
+ isAcceptedAnswer: boolean;
55
+ createdAt: Date;
56
+ modifiedAt: Date | null;
57
+ author: {
58
+ id: string;
59
+ username: string;
60
+ profile: {
61
+ displayName: string | null;
62
+ profilePicture: string | null;
63
+ profilePictureThumbnail: string | null;
64
+ } | null;
65
+ };
66
+ attachments: {
67
+ path: string;
68
+ type: string;
69
+ name: string;
70
+ id: string;
71
+ size: number | null;
72
+ uploadedAt: Date | null;
73
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
74
+ thumbnailId: string | null;
75
+ thumbnail: {
76
+ path: string;
77
+ id: string;
78
+ } | null;
79
+ }[];
80
+ reactions: {
81
+ counts: {
82
+ THUMBSUP: number;
83
+ CELEBRATE: number;
84
+ CARE: number;
85
+ HEART: number;
86
+ IDEA: number;
87
+ HAPPY: number;
88
+ };
89
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
90
+ total: number;
91
+ };
92
+ };
93
+ export declare function buildReplyTree(replies: ReplyWithInclude[], userId: string): DiscussionReplyTree[];
94
+ export declare function getDiscussionClassAccess(classId: string, userId: string): Promise<{
95
+ isTeacher: boolean;
96
+ isStudent: boolean;
97
+ name: string;
98
+ school: {
99
+ memberships: {
100
+ userId: string;
101
+ }[];
102
+ } | null;
103
+ id: string;
104
+ discussionsEnabled: boolean;
105
+ studentsCanCreateDiscussions: boolean;
106
+ studentsCanReply: boolean;
107
+ teachers: {
108
+ id: string;
109
+ }[];
110
+ students: {
111
+ id: string;
112
+ }[];
113
+ }>;
114
+ export declare function listDiscussions(userId: string, input: {
115
+ classId: string;
116
+ tagId?: string;
117
+ type?: DiscussionType;
118
+ search?: string;
119
+ sort: "recent" | "activity" | "top";
120
+ cursor?: string;
121
+ limit: number;
122
+ }): Promise<{
123
+ items: {
124
+ hasAcceptedAnswer: boolean;
125
+ id: string;
126
+ classId: string;
127
+ authorId: string;
128
+ title: string;
129
+ body: string;
130
+ type: import(".prisma/client").$Enums.DiscussionType;
131
+ isPinned: boolean;
132
+ isLocked: boolean;
133
+ allowReplies: boolean;
134
+ createdAt: Date;
135
+ updatedAt: Date;
136
+ lastActivityAt: Date;
137
+ author: {
138
+ id: string;
139
+ username: string;
140
+ profile: {
141
+ displayName: string | null;
142
+ profilePicture: string | null;
143
+ profilePictureThumbnail: string | null;
144
+ } | null;
145
+ };
146
+ attachments: {
147
+ path: string;
148
+ type: string;
149
+ name: string;
150
+ id: string;
151
+ size: number | null;
152
+ uploadedAt: Date | null;
153
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
154
+ thumbnailId: string | null;
155
+ thumbnail: {
156
+ path: string;
157
+ id: string;
158
+ } | null;
159
+ }[];
160
+ tags: {
161
+ name: string;
162
+ id: string;
163
+ color: string;
164
+ }[];
165
+ replyCount: number;
166
+ reactions: {
167
+ counts: {
168
+ THUMBSUP: number;
169
+ CELEBRATE: number;
170
+ CARE: number;
171
+ HEART: number;
172
+ IDEA: number;
173
+ HAPPY: number;
174
+ };
175
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
176
+ total: number;
177
+ };
178
+ unreadCount: number;
179
+ }[];
180
+ nextCursor: string | undefined;
181
+ }>;
182
+ export declare function getDiscussion(userId: string, discussionId: string): Promise<{
183
+ discussion: {
184
+ id: string;
185
+ classId: string;
186
+ authorId: string;
187
+ title: string;
188
+ body: string;
189
+ type: import(".prisma/client").$Enums.DiscussionType;
190
+ isPinned: boolean;
191
+ isLocked: boolean;
192
+ allowReplies: boolean;
193
+ createdAt: Date;
194
+ updatedAt: Date;
195
+ lastActivityAt: Date;
196
+ author: {
197
+ id: string;
198
+ username: string;
199
+ profile: {
200
+ displayName: string | null;
201
+ profilePicture: string | null;
202
+ profilePictureThumbnail: string | null;
203
+ } | null;
204
+ };
205
+ attachments: {
206
+ path: string;
207
+ type: string;
208
+ name: string;
209
+ id: string;
210
+ size: number | null;
211
+ uploadedAt: Date | null;
212
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
213
+ thumbnailId: string | null;
214
+ thumbnail: {
215
+ path: string;
216
+ id: string;
217
+ } | null;
218
+ }[];
219
+ tags: {
220
+ name: string;
221
+ id: string;
222
+ color: string;
223
+ }[];
224
+ replyCount: number;
225
+ hasAcceptedAnswer: boolean;
226
+ reactions: {
227
+ counts: {
228
+ THUMBSUP: number;
229
+ CELEBRATE: number;
230
+ CARE: number;
231
+ HEART: number;
232
+ IDEA: number;
233
+ HAPPY: number;
234
+ };
235
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
236
+ total: number;
237
+ };
238
+ unreadCount: number;
239
+ };
240
+ replies: DiscussionReplyTree[];
241
+ myReaction: import(".prisma/client").$Enums.ReactionType | null;
242
+ canEdit: boolean;
243
+ canPin: boolean;
244
+ canLock: boolean;
245
+ canDelete: boolean;
246
+ canReply: boolean;
247
+ }>;
248
+ export declare function createDiscussion(userId: string, input: {
249
+ classId: string;
250
+ title: string;
251
+ body: string;
252
+ type: DiscussionType;
253
+ tagIds?: string[];
254
+ attachmentIds?: string[];
255
+ }): Promise<{
256
+ discussion: {
257
+ id: string;
258
+ classId: string;
259
+ authorId: string;
260
+ title: string;
261
+ body: string;
262
+ type: import(".prisma/client").$Enums.DiscussionType;
263
+ isPinned: boolean;
264
+ isLocked: boolean;
265
+ allowReplies: boolean;
266
+ createdAt: Date;
267
+ updatedAt: Date;
268
+ lastActivityAt: Date;
269
+ author: {
270
+ id: string;
271
+ username: string;
272
+ profile: {
273
+ displayName: string | null;
274
+ profilePicture: string | null;
275
+ profilePictureThumbnail: string | null;
276
+ } | null;
277
+ };
278
+ attachments: {
279
+ path: string;
280
+ type: string;
281
+ name: string;
282
+ id: string;
283
+ size: number | null;
284
+ uploadedAt: Date | null;
285
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
286
+ thumbnailId: string | null;
287
+ thumbnail: {
288
+ path: string;
289
+ id: string;
290
+ } | null;
291
+ }[];
292
+ tags: {
293
+ name: string;
294
+ id: string;
295
+ color: string;
296
+ }[];
297
+ replyCount: number;
298
+ hasAcceptedAnswer: boolean;
299
+ reactions: {
300
+ counts: {
301
+ THUMBSUP: number;
302
+ CELEBRATE: number;
303
+ CARE: number;
304
+ HEART: number;
305
+ IDEA: number;
306
+ HAPPY: number;
307
+ };
308
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
309
+ total: number;
310
+ };
311
+ unreadCount: number;
312
+ };
313
+ }>;
314
+ export declare function updateDiscussion(userId: string, input: {
315
+ discussionId: string;
316
+ title?: string;
317
+ body?: string;
318
+ type?: DiscussionType;
319
+ tagIds?: string[];
320
+ allowReplies?: boolean;
321
+ }): Promise<{
322
+ discussion: {
323
+ id: string;
324
+ classId: string;
325
+ authorId: string;
326
+ title: string;
327
+ body: string;
328
+ type: import(".prisma/client").$Enums.DiscussionType;
329
+ isPinned: boolean;
330
+ isLocked: boolean;
331
+ allowReplies: boolean;
332
+ createdAt: Date;
333
+ updatedAt: Date;
334
+ lastActivityAt: Date;
335
+ author: {
336
+ id: string;
337
+ username: string;
338
+ profile: {
339
+ displayName: string | null;
340
+ profilePicture: string | null;
341
+ profilePictureThumbnail: string | null;
342
+ } | null;
343
+ };
344
+ attachments: {
345
+ path: string;
346
+ type: string;
347
+ name: string;
348
+ id: string;
349
+ size: number | null;
350
+ uploadedAt: Date | null;
351
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
352
+ thumbnailId: string | null;
353
+ thumbnail: {
354
+ path: string;
355
+ id: string;
356
+ } | null;
357
+ }[];
358
+ tags: {
359
+ name: string;
360
+ id: string;
361
+ color: string;
362
+ }[];
363
+ replyCount: number;
364
+ hasAcceptedAnswer: boolean;
365
+ reactions: {
366
+ counts: {
367
+ THUMBSUP: number;
368
+ CELEBRATE: number;
369
+ CARE: number;
370
+ HEART: number;
371
+ IDEA: number;
372
+ HAPPY: number;
373
+ };
374
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
375
+ total: number;
376
+ };
377
+ unreadCount: number;
378
+ };
379
+ }>;
380
+ export declare function deleteDiscussion(userId: string, discussionId: string): Promise<{
381
+ success: boolean;
382
+ }>;
383
+ export declare function replyToDiscussion(userId: string, input: {
384
+ discussionId: string;
385
+ parentReplyId?: string;
386
+ body: string;
387
+ attachmentIds?: string[];
388
+ }): Promise<{
389
+ reply: {
390
+ id: string;
391
+ discussionId: string;
392
+ authorId: string;
393
+ parentId: string | null;
394
+ body: string;
395
+ deletedAt: Date | null;
396
+ isAcceptedAnswer: boolean;
397
+ createdAt: Date;
398
+ modifiedAt: Date | null;
399
+ author: {
400
+ id: string;
401
+ username: string;
402
+ profile: {
403
+ displayName: string | null;
404
+ profilePicture: string | null;
405
+ profilePictureThumbnail: string | null;
406
+ } | null;
407
+ };
408
+ attachments: {
409
+ path: string;
410
+ type: string;
411
+ name: string;
412
+ id: string;
413
+ size: number | null;
414
+ uploadedAt: Date | null;
415
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
416
+ thumbnailId: string | null;
417
+ thumbnail: {
418
+ path: string;
419
+ id: string;
420
+ } | null;
421
+ }[];
422
+ reactions: {
423
+ counts: {
424
+ THUMBSUP: number;
425
+ CELEBRATE: number;
426
+ CARE: number;
427
+ HEART: number;
428
+ IDEA: number;
429
+ HAPPY: number;
430
+ };
431
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
432
+ total: number;
433
+ };
434
+ };
435
+ }>;
436
+ export declare function updateDiscussionReply(userId: string, input: {
437
+ replyId: string;
438
+ body: string;
439
+ attachmentIds?: string[];
440
+ }): Promise<{
441
+ reply: {
442
+ id: string;
443
+ discussionId: string;
444
+ authorId: string;
445
+ parentId: string | null;
446
+ body: string;
447
+ deletedAt: Date | null;
448
+ isAcceptedAnswer: boolean;
449
+ createdAt: Date;
450
+ modifiedAt: Date | null;
451
+ author: {
452
+ id: string;
453
+ username: string;
454
+ profile: {
455
+ displayName: string | null;
456
+ profilePicture: string | null;
457
+ profilePictureThumbnail: string | null;
458
+ } | null;
459
+ };
460
+ attachments: {
461
+ path: string;
462
+ type: string;
463
+ name: string;
464
+ id: string;
465
+ size: number | null;
466
+ uploadedAt: Date | null;
467
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
468
+ thumbnailId: string | null;
469
+ thumbnail: {
470
+ path: string;
471
+ id: string;
472
+ } | null;
473
+ }[];
474
+ reactions: {
475
+ counts: {
476
+ THUMBSUP: number;
477
+ CELEBRATE: number;
478
+ CARE: number;
479
+ HEART: number;
480
+ IDEA: number;
481
+ HAPPY: number;
482
+ };
483
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
484
+ total: number;
485
+ };
486
+ };
487
+ }>;
488
+ export declare function deleteDiscussionReply(userId: string, replyId: string): Promise<{
489
+ reply: {
490
+ id: string;
491
+ discussionId: string;
492
+ authorId: string;
493
+ parentId: string | null;
494
+ body: string;
495
+ deletedAt: Date | null;
496
+ isAcceptedAnswer: boolean;
497
+ createdAt: Date;
498
+ modifiedAt: Date | null;
499
+ author: {
500
+ id: string;
501
+ username: string;
502
+ profile: {
503
+ displayName: string | null;
504
+ profilePicture: string | null;
505
+ profilePictureThumbnail: string | null;
506
+ } | null;
507
+ };
508
+ attachments: {
509
+ path: string;
510
+ type: string;
511
+ name: string;
512
+ id: string;
513
+ size: number | null;
514
+ uploadedAt: Date | null;
515
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
516
+ thumbnailId: string | null;
517
+ thumbnail: {
518
+ path: string;
519
+ id: string;
520
+ } | null;
521
+ }[];
522
+ reactions: {
523
+ counts: {
524
+ THUMBSUP: number;
525
+ CELEBRATE: number;
526
+ CARE: number;
527
+ HEART: number;
528
+ IDEA: number;
529
+ HAPPY: number;
530
+ };
531
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
532
+ total: number;
533
+ };
534
+ };
535
+ }>;
536
+ export declare function pinDiscussion(userId: string, discussionId: string, isPinned: boolean): Promise<{
537
+ discussion: {
538
+ id: string;
539
+ classId: string;
540
+ authorId: string;
541
+ title: string;
542
+ body: string;
543
+ type: import(".prisma/client").$Enums.DiscussionType;
544
+ isPinned: boolean;
545
+ isLocked: boolean;
546
+ allowReplies: boolean;
547
+ createdAt: Date;
548
+ updatedAt: Date;
549
+ lastActivityAt: Date;
550
+ author: {
551
+ id: string;
552
+ username: string;
553
+ profile: {
554
+ displayName: string | null;
555
+ profilePicture: string | null;
556
+ profilePictureThumbnail: string | null;
557
+ } | null;
558
+ };
559
+ attachments: {
560
+ path: string;
561
+ type: string;
562
+ name: string;
563
+ id: string;
564
+ size: number | null;
565
+ uploadedAt: Date | null;
566
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
567
+ thumbnailId: string | null;
568
+ thumbnail: {
569
+ path: string;
570
+ id: string;
571
+ } | null;
572
+ }[];
573
+ tags: {
574
+ name: string;
575
+ id: string;
576
+ color: string;
577
+ }[];
578
+ replyCount: number;
579
+ hasAcceptedAnswer: boolean;
580
+ reactions: {
581
+ counts: {
582
+ THUMBSUP: number;
583
+ CELEBRATE: number;
584
+ CARE: number;
585
+ HEART: number;
586
+ IDEA: number;
587
+ HAPPY: number;
588
+ };
589
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
590
+ total: number;
591
+ };
592
+ unreadCount: number;
593
+ };
594
+ }>;
595
+ export declare function lockDiscussion(userId: string, discussionId: string, isLocked: boolean): Promise<{
596
+ discussion: {
597
+ id: string;
598
+ classId: string;
599
+ authorId: string;
600
+ title: string;
601
+ body: string;
602
+ type: import(".prisma/client").$Enums.DiscussionType;
603
+ isPinned: boolean;
604
+ isLocked: boolean;
605
+ allowReplies: boolean;
606
+ createdAt: Date;
607
+ updatedAt: Date;
608
+ lastActivityAt: Date;
609
+ author: {
610
+ id: string;
611
+ username: string;
612
+ profile: {
613
+ displayName: string | null;
614
+ profilePicture: string | null;
615
+ profilePictureThumbnail: string | null;
616
+ } | null;
617
+ };
618
+ attachments: {
619
+ path: string;
620
+ type: string;
621
+ name: string;
622
+ id: string;
623
+ size: number | null;
624
+ uploadedAt: Date | null;
625
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
626
+ thumbnailId: string | null;
627
+ thumbnail: {
628
+ path: string;
629
+ id: string;
630
+ } | null;
631
+ }[];
632
+ tags: {
633
+ name: string;
634
+ id: string;
635
+ color: string;
636
+ }[];
637
+ replyCount: number;
638
+ hasAcceptedAnswer: boolean;
639
+ reactions: {
640
+ counts: {
641
+ THUMBSUP: number;
642
+ CELEBRATE: number;
643
+ CARE: number;
644
+ HEART: number;
645
+ IDEA: number;
646
+ HAPPY: number;
647
+ };
648
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
649
+ total: number;
650
+ };
651
+ unreadCount: number;
652
+ };
653
+ }>;
654
+ export declare function markAcceptedAnswer(userId: string, replyId: string, accepted: boolean): Promise<{
655
+ reply: {
656
+ id: string;
657
+ discussionId: string;
658
+ authorId: string;
659
+ parentId: string | null;
660
+ body: string;
661
+ deletedAt: Date | null;
662
+ isAcceptedAnswer: boolean;
663
+ createdAt: Date;
664
+ modifiedAt: Date | null;
665
+ author: {
666
+ id: string;
667
+ username: string;
668
+ profile: {
669
+ displayName: string | null;
670
+ profilePicture: string | null;
671
+ profilePictureThumbnail: string | null;
672
+ } | null;
673
+ };
674
+ attachments: {
675
+ path: string;
676
+ type: string;
677
+ name: string;
678
+ id: string;
679
+ size: number | null;
680
+ uploadedAt: Date | null;
681
+ uploadStatus: import(".prisma/client").$Enums.UploadStatus;
682
+ thumbnailId: string | null;
683
+ thumbnail: {
684
+ path: string;
685
+ id: string;
686
+ } | null;
687
+ }[];
688
+ reactions: {
689
+ counts: {
690
+ THUMBSUP: number;
691
+ CELEBRATE: number;
692
+ CARE: number;
693
+ HEART: number;
694
+ IDEA: number;
695
+ HAPPY: number;
696
+ };
697
+ userReaction: import(".prisma/client").$Enums.ReactionType | null;
698
+ total: number;
699
+ };
700
+ };
701
+ }>;
702
+ export declare function markDiscussionRead(userId: string, discussionId: string): Promise<{
703
+ userId: string;
704
+ discussionId: string;
705
+ lastReadAt: Date;
706
+ }>;
707
+ export declare function getUnreadCounts(userId: string, classIds: string[]): Promise<Record<string, {
708
+ total: number;
709
+ perDiscussion: {
710
+ discussionId: string;
711
+ count: number;
712
+ }[];
713
+ }>>;
714
+ export declare function toggleDiscussionReaction(userId: string, input: {
715
+ discussionId?: string;
716
+ discussionReplyId?: string;
717
+ type: ReactionType;
718
+ }): Promise<{
719
+ reaction: null;
720
+ } | {
721
+ reaction: {
722
+ type: import(".prisma/client").$Enums.ReactionType;
723
+ id: string;
724
+ createdAt: Date;
725
+ userId: string;
726
+ announcementId: string | null;
727
+ discussionId: string | null;
728
+ discussionReplyId: string | null;
729
+ commentId: string | null;
730
+ };
731
+ }>;
732
+ export declare function listDiscussionTags(userId: string, classId: string): Promise<{
733
+ name: string;
734
+ id: string;
735
+ color: string;
736
+ classId: string;
737
+ }[]>;
738
+ export declare function createDiscussionTag(userId: string, input: {
739
+ classId: string;
740
+ name: string;
741
+ color: string;
742
+ }): Promise<{
743
+ name: string;
744
+ id: string;
745
+ color: string;
746
+ classId: string;
747
+ }>;
748
+ export declare function updateDiscussionTag(userId: string, input: {
749
+ tagId: string;
750
+ name?: string;
751
+ color?: string;
752
+ }): Promise<{
753
+ name: string;
754
+ id: string;
755
+ color: string;
756
+ classId: string;
757
+ }>;
758
+ export declare function deleteDiscussionTag(userId: string, tagId: string): Promise<{
759
+ success: boolean;
760
+ }>;
761
+ export {};
762
+ //# sourceMappingURL=discussion.d.ts.map