@studious-lms/server 1.4.6 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm.yml +28 -0
- package/dist/models/access.d.ts +112 -0
- package/dist/models/access.d.ts.map +1 -0
- package/dist/models/access.js +49 -0
- package/dist/models/access.js.map +1 -0
- package/dist/models/announcement.d.ts +17 -2
- package/dist/models/announcement.d.ts.map +1 -1
- package/dist/models/announcement.js +21 -4
- package/dist/models/announcement.js.map +1 -1
- package/dist/models/assignment.d.ts +69 -37
- package/dist/models/assignment.d.ts.map +1 -1
- package/dist/models/assignment.js +124 -15
- package/dist/models/assignment.js.map +1 -1
- package/dist/models/attendance.d.ts +1 -1
- package/dist/models/attendance.d.ts.map +1 -1
- package/dist/models/attendance.js +6 -5
- package/dist/models/attendance.js.map +1 -1
- package/dist/models/auth.d.ts +5 -5
- package/dist/models/auth.d.ts.map +1 -1
- package/dist/models/auth.js +7 -11
- package/dist/models/auth.js.map +1 -1
- package/dist/models/class.d.ts +26 -26
- package/dist/models/class.d.ts.map +1 -1
- package/dist/models/class.js +7 -11
- package/dist/models/class.js.map +1 -1
- package/dist/models/comment.d.ts +134 -70
- package/dist/models/comment.d.ts.map +1 -1
- package/dist/models/comment.js +30 -42
- package/dist/models/comment.js.map +1 -1
- package/dist/models/conversation.d.ts +7 -7
- package/dist/models/event.d.ts +52 -3
- package/dist/models/event.d.ts.map +1 -1
- package/dist/models/event.js +56 -6
- package/dist/models/event.js.map +1 -1
- package/dist/models/file.d.ts +178 -103
- package/dist/models/file.d.ts.map +1 -1
- package/dist/models/file.js +54 -14
- package/dist/models/file.js.map +1 -1
- package/dist/models/folder.d.ts +22 -22
- package/dist/models/folder.d.ts.map +1 -1
- package/dist/models/folder.js +5 -4
- package/dist/models/folder.js.map +1 -1
- package/dist/models/labChat.d.ts +20 -20
- package/dist/models/labChat.d.ts.map +1 -1
- package/dist/models/labChat.js +8 -10
- package/dist/models/labChat.js.map +1 -1
- package/dist/models/marketing.d.ts +1 -1
- package/dist/models/message.d.ts +6 -6
- package/dist/models/newtonChat.d.ts +5 -5
- package/dist/models/school.d.ts +361 -0
- package/dist/models/school.d.ts.map +1 -0
- package/dist/models/school.js +314 -0
- package/dist/models/school.js.map +1 -0
- package/dist/models/section.d.ts +1 -1
- package/dist/models/section.d.ts.map +1 -1
- package/dist/models/section.js +5 -4
- package/dist/models/section.js.map +1 -1
- package/dist/models/user.d.ts +4 -4
- package/dist/models/worksheet.d.ts +163 -141
- package/dist/models/worksheet.d.ts.map +1 -1
- package/dist/models/worksheet.js +42 -17
- package/dist/models/worksheet.js.map +1 -1
- package/dist/pipelines/gradeWorksheet.d.ts +2 -2
- package/dist/pipelines/pdfToWorksheet.d.ts +1 -1
- package/dist/routers/_app.d.ts +1271 -327
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/_app.js +4 -2
- package/dist/routers/_app.js.map +1 -1
- package/dist/routers/announcement.d.ts +5 -5
- package/dist/routers/announcement.d.ts.map +1 -1
- package/dist/routers/announcement.js +25 -5
- package/dist/routers/announcement.js.map +1 -1
- package/dist/routers/assignment.d.ts +79 -44
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +32 -12
- package/dist/routers/assignment.js.map +1 -1
- package/dist/routers/class.d.ts +40 -20
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +3 -2
- package/dist/routers/class.js.map +1 -1
- package/dist/routers/comment.d.ts +5 -5
- package/dist/routers/conversation.d.ts +6 -6
- package/dist/routers/event.d.ts +21 -2
- package/dist/routers/event.d.ts.map +1 -1
- package/dist/routers/file.d.ts +2 -2
- package/dist/routers/folder.d.ts +24 -24
- package/dist/routers/labChat.d.ts +7 -7
- package/dist/routers/school.d.ts +384 -0
- package/dist/routers/school.d.ts.map +1 -0
- package/dist/routers/school.js +79 -0
- package/dist/routers/school.js.map +1 -0
- package/dist/routers/search.d.ts +1 -1
- package/dist/routers/worksheet.d.ts +36 -20
- package/dist/routers/worksheet.d.ts.map +1 -1
- package/dist/routers/worksheet.js +10 -3
- package/dist/routers/worksheet.js.map +1 -1
- package/dist/services/announcement.d.ts.map +1 -1
- package/dist/services/announcement.js +10 -6
- package/dist/services/announcement.js.map +1 -1
- package/dist/services/assignment.d.ts +66 -36
- package/dist/services/assignment.d.ts.map +1 -1
- package/dist/services/assignment.js +37 -3
- package/dist/services/assignment.js.map +1 -1
- package/dist/services/class.d.ts +39 -19
- package/dist/services/class.d.ts.map +1 -1
- package/dist/services/class.js +52 -15
- package/dist/services/class.js.map +1 -1
- package/dist/services/comment.d.ts +5 -5
- package/dist/services/comment.d.ts.map +1 -1
- package/dist/services/comment.js +8 -3
- package/dist/services/comment.js.map +1 -1
- package/dist/services/conversation.d.ts +6 -6
- package/dist/services/event.d.ts +21 -2
- package/dist/services/event.d.ts.map +1 -1
- package/dist/services/event.js +11 -7
- package/dist/services/event.js.map +1 -1
- package/dist/services/file.d.ts +2 -2
- package/dist/services/file.d.ts.map +1 -1
- package/dist/services/file.js +17 -8
- package/dist/services/file.js.map +1 -1
- package/dist/services/folder.d.ts +24 -24
- package/dist/services/labChat.d.ts +7 -7
- package/dist/services/school.d.ts +299 -0
- package/dist/services/school.d.ts.map +1 -0
- package/dist/services/school.js +225 -0
- package/dist/services/school.js.map +1 -0
- package/dist/services/worksheet.d.ts +31 -20
- package/dist/services/worksheet.d.ts.map +1 -1
- package/dist/services/worksheet.js +37 -3
- package/dist/services/worksheet.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20260504071500_school_memberships/migration.sql +81 -0
- package/prisma/schema.prisma +66 -2
- package/src/models/access.ts +48 -0
- package/src/models/announcement.ts +19 -2
- package/src/models/assignment.ts +149 -13
- package/src/models/attendance.ts +4 -3
- package/src/models/auth.ts +8 -9
- package/src/models/class.ts +8 -9
- package/src/models/comment.ts +29 -40
- package/src/models/event.ts +54 -4
- package/src/models/file.ts +53 -12
- package/src/models/folder.ts +3 -2
- package/src/models/labChat.ts +9 -8
- package/src/models/school.ts +361 -0
- package/src/models/section.ts +3 -2
- package/src/models/worksheet.ts +61 -12
- package/src/routers/_app.ts +2 -0
- package/src/routers/announcement.ts +30 -4
- package/src/routers/assignment.ts +46 -9
- package/src/routers/class.ts +1 -0
- package/src/routers/school.ts +122 -0
- package/src/routers/worksheet.ts +18 -0
- package/src/services/announcement.ts +12 -4
- package/src/services/assignment.ts +47 -1
- package/src/services/class.ts +61 -14
- package/src/services/comment.ts +10 -1
- package/src/services/event.ts +23 -6
- package/src/services/file.ts +20 -6
- package/src/services/school.ts +308 -0
- package/src/services/worksheet.ts +46 -0
- package/dist/lib/notificationHandler.d.ts +0 -25
- package/dist/lib/notificationHandler.d.ts.map +0 -1
- package/dist/lib/notificationHandler.js +0 -32
- package/dist/lib/notificationHandler.js.map +0 -1
- package/dist/server/pipelines/aiLabChat.d.ts +0 -21
- package/dist/server/pipelines/aiLabChat.d.ts.map +0 -1
- package/dist/server/pipelines/aiLabChat.js +0 -456
- package/dist/server/pipelines/aiLabChat.js.map +0 -1
- package/dist/server/pipelines/aiNewtonChat.d.ts +0 -30
- package/dist/server/pipelines/aiNewtonChat.d.ts.map +0 -1
- package/dist/server/pipelines/aiNewtonChat.js +0 -285
- package/dist/server/pipelines/aiNewtonChat.js.map +0 -1
- package/dist/server/pipelines/gradeWorksheet.d.ts +0 -30
- package/dist/server/pipelines/gradeWorksheet.d.ts.map +0 -1
- package/dist/server/pipelines/gradeWorksheet.js +0 -248
- package/dist/server/pipelines/gradeWorksheet.js.map +0 -1
package/dist/models/comment.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const commentSelect: {
|
|
|
42
42
|
/** @returns Comment by ID with author and reactions. */
|
|
43
43
|
export declare function findCommentById(id: string): import(".prisma/client").Prisma.Prisma__CommentClient<{
|
|
44
44
|
id: string;
|
|
45
|
+
createdAt: Date;
|
|
45
46
|
assignmentId: string | null;
|
|
46
47
|
submissionId: string | null;
|
|
47
48
|
announcementId: string | null;
|
|
@@ -57,7 +58,6 @@ export declare function findCommentById(id: string): import(".prisma/client").Pr
|
|
|
57
58
|
} | null;
|
|
58
59
|
};
|
|
59
60
|
}[];
|
|
60
|
-
createdAt: Date;
|
|
61
61
|
modifiedAt: Date | null;
|
|
62
62
|
content: string;
|
|
63
63
|
parentCommentId: string | null;
|
|
@@ -91,10 +91,10 @@ export declare function findRepliesByCommentId(commentId: string): import(".pris
|
|
|
91
91
|
} & {
|
|
92
92
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
93
93
|
id: string;
|
|
94
|
+
createdAt: Date;
|
|
94
95
|
assignmentId: string | null;
|
|
95
96
|
submissionId: string | null;
|
|
96
97
|
announcementId: string | null;
|
|
97
|
-
createdAt: Date;
|
|
98
98
|
modifiedAt: Date | null;
|
|
99
99
|
content: string;
|
|
100
100
|
authorId: string;
|
|
@@ -113,10 +113,10 @@ export declare function createComment(data: {
|
|
|
113
113
|
}): import(".prisma/client").Prisma.Prisma__CommentClient<{
|
|
114
114
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
115
115
|
id: string;
|
|
116
|
+
createdAt: Date;
|
|
116
117
|
assignmentId: string | null;
|
|
117
118
|
submissionId: string | null;
|
|
118
119
|
announcementId: string | null;
|
|
119
|
-
createdAt: Date;
|
|
120
120
|
modifiedAt: Date | null;
|
|
121
121
|
content: string;
|
|
122
122
|
authorId: string;
|
|
@@ -133,9 +133,9 @@ export declare function createComment(data: {
|
|
|
133
133
|
export declare function findReactionByUserAndComment(userId: string, commentId: string): import(".prisma/client").Prisma.Prisma__ReactionClient<{
|
|
134
134
|
type: import(".prisma/client").$Enums.ReactionType;
|
|
135
135
|
id: string;
|
|
136
|
+
createdAt: Date;
|
|
136
137
|
userId: string;
|
|
137
138
|
announcementId: string | null;
|
|
138
|
-
createdAt: Date;
|
|
139
139
|
commentId: string | null;
|
|
140
140
|
} | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
141
141
|
datasources: {
|
|
@@ -162,9 +162,9 @@ export declare function upsertReaction(data: {
|
|
|
162
162
|
} & {
|
|
163
163
|
type: import(".prisma/client").$Enums.ReactionType;
|
|
164
164
|
id: string;
|
|
165
|
+
createdAt: Date;
|
|
165
166
|
userId: string;
|
|
166
167
|
announcementId: string | null;
|
|
167
|
-
createdAt: Date;
|
|
168
168
|
commentId: string | null;
|
|
169
169
|
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
170
170
|
datasources: {
|
|
@@ -177,9 +177,9 @@ export declare function upsertReaction(data: {
|
|
|
177
177
|
export declare function deleteReactionById(id: string): import(".prisma/client").Prisma.Prisma__ReactionClient<{
|
|
178
178
|
type: import(".prisma/client").$Enums.ReactionType;
|
|
179
179
|
id: string;
|
|
180
|
+
createdAt: Date;
|
|
180
181
|
userId: string;
|
|
181
182
|
announcementId: string | null;
|
|
182
|
-
createdAt: Date;
|
|
183
183
|
commentId: string | null;
|
|
184
184
|
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
185
185
|
datasources: {
|
|
@@ -196,10 +196,10 @@ export declare function findCommentWithAnnouncement(commentId: string): import("
|
|
|
196
196
|
} & {
|
|
197
197
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
198
198
|
id: string;
|
|
199
|
+
createdAt: Date;
|
|
199
200
|
assignmentId: string | null;
|
|
200
201
|
submissionId: string | null;
|
|
201
202
|
announcementId: string | null;
|
|
202
|
-
createdAt: Date;
|
|
203
203
|
modifiedAt: Date | null;
|
|
204
204
|
content: string;
|
|
205
205
|
authorId: string;
|
|
@@ -214,124 +214,188 @@ export declare function findCommentWithAnnouncement(commentId: string): import("
|
|
|
214
214
|
}>;
|
|
215
215
|
/** @returns Comment with the owning class context for authorization. */
|
|
216
216
|
export declare function findCommentWithContext(commentId: string): import(".prisma/client").Prisma.Prisma__CommentClient<({
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
id: string;
|
|
227
|
-
}[];
|
|
228
|
-
teachers: {
|
|
229
|
-
id: string;
|
|
230
|
-
}[];
|
|
231
|
-
};
|
|
232
|
-
};
|
|
217
|
+
assignment: {
|
|
218
|
+
class: {
|
|
219
|
+
school: {
|
|
220
|
+
users: {
|
|
221
|
+
id: string;
|
|
222
|
+
}[];
|
|
223
|
+
memberships: {
|
|
224
|
+
userId: string;
|
|
225
|
+
}[];
|
|
233
226
|
} | null;
|
|
234
|
-
|
|
227
|
+
id: string;
|
|
228
|
+
teachers: {
|
|
229
|
+
id: string;
|
|
230
|
+
}[];
|
|
231
|
+
students: {
|
|
232
|
+
id: string;
|
|
233
|
+
}[];
|
|
234
|
+
};
|
|
235
235
|
} | null;
|
|
236
236
|
submission: {
|
|
237
|
-
studentId: string;
|
|
238
237
|
assignment: {
|
|
239
238
|
class: {
|
|
239
|
+
school: {
|
|
240
|
+
users: {
|
|
241
|
+
id: string;
|
|
242
|
+
}[];
|
|
243
|
+
memberships: {
|
|
244
|
+
userId: string;
|
|
245
|
+
}[];
|
|
246
|
+
} | null;
|
|
240
247
|
id: string;
|
|
241
|
-
|
|
248
|
+
teachers: {
|
|
242
249
|
id: string;
|
|
243
250
|
}[];
|
|
244
|
-
|
|
251
|
+
students: {
|
|
245
252
|
id: string;
|
|
246
253
|
}[];
|
|
247
254
|
};
|
|
248
255
|
};
|
|
256
|
+
studentId: string;
|
|
249
257
|
} | null;
|
|
250
|
-
|
|
258
|
+
announcement: {
|
|
251
259
|
class: {
|
|
260
|
+
school: {
|
|
261
|
+
users: {
|
|
262
|
+
id: string;
|
|
263
|
+
}[];
|
|
264
|
+
memberships: {
|
|
265
|
+
userId: string;
|
|
266
|
+
}[];
|
|
267
|
+
} | null;
|
|
252
268
|
id: string;
|
|
253
|
-
students: {
|
|
254
|
-
id: string;
|
|
255
|
-
}[];
|
|
256
269
|
teachers: {
|
|
257
270
|
id: string;
|
|
258
271
|
}[];
|
|
259
|
-
};
|
|
260
|
-
} | null;
|
|
261
|
-
announcement: {
|
|
262
|
-
class: {
|
|
263
|
-
id: string;
|
|
264
272
|
students: {
|
|
265
273
|
id: string;
|
|
266
274
|
}[];
|
|
267
|
-
teachers: {
|
|
268
|
-
id: string;
|
|
269
|
-
}[];
|
|
270
275
|
};
|
|
271
276
|
} | null;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
id: string;
|
|
281
|
-
students: {
|
|
277
|
+
studentQuestionProgress: {
|
|
278
|
+
studentId: string;
|
|
279
|
+
studentWorksheetResponse: {
|
|
280
|
+
submission: {
|
|
281
|
+
assignment: {
|
|
282
|
+
class: {
|
|
283
|
+
school: {
|
|
284
|
+
users: {
|
|
282
285
|
id: string;
|
|
283
286
|
}[];
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
memberships: {
|
|
288
|
+
userId: string;
|
|
286
289
|
}[];
|
|
287
|
-
};
|
|
290
|
+
} | null;
|
|
291
|
+
id: string;
|
|
292
|
+
teachers: {
|
|
293
|
+
id: string;
|
|
294
|
+
}[];
|
|
295
|
+
students: {
|
|
296
|
+
id: string;
|
|
297
|
+
}[];
|
|
288
298
|
};
|
|
289
|
-
}
|
|
299
|
+
};
|
|
300
|
+
studentId: string;
|
|
290
301
|
} | null;
|
|
291
302
|
} | null;
|
|
303
|
+
} | null;
|
|
304
|
+
parentComment: ({
|
|
305
|
+
assignment: {
|
|
306
|
+
class: {
|
|
307
|
+
school: {
|
|
308
|
+
users: {
|
|
309
|
+
id: string;
|
|
310
|
+
}[];
|
|
311
|
+
memberships: {
|
|
312
|
+
userId: string;
|
|
313
|
+
}[];
|
|
314
|
+
} | null;
|
|
315
|
+
id: string;
|
|
316
|
+
teachers: {
|
|
317
|
+
id: string;
|
|
318
|
+
}[];
|
|
319
|
+
students: {
|
|
320
|
+
id: string;
|
|
321
|
+
}[];
|
|
322
|
+
};
|
|
323
|
+
} | null;
|
|
292
324
|
submission: {
|
|
293
|
-
studentId: string;
|
|
294
325
|
assignment: {
|
|
295
326
|
class: {
|
|
327
|
+
school: {
|
|
328
|
+
users: {
|
|
329
|
+
id: string;
|
|
330
|
+
}[];
|
|
331
|
+
memberships: {
|
|
332
|
+
userId: string;
|
|
333
|
+
}[];
|
|
334
|
+
} | null;
|
|
296
335
|
id: string;
|
|
297
|
-
|
|
336
|
+
teachers: {
|
|
298
337
|
id: string;
|
|
299
338
|
}[];
|
|
300
|
-
|
|
339
|
+
students: {
|
|
301
340
|
id: string;
|
|
302
341
|
}[];
|
|
303
342
|
};
|
|
304
343
|
};
|
|
344
|
+
studentId: string;
|
|
305
345
|
} | null;
|
|
306
|
-
|
|
346
|
+
announcement: {
|
|
307
347
|
class: {
|
|
348
|
+
school: {
|
|
349
|
+
users: {
|
|
350
|
+
id: string;
|
|
351
|
+
}[];
|
|
352
|
+
memberships: {
|
|
353
|
+
userId: string;
|
|
354
|
+
}[];
|
|
355
|
+
} | null;
|
|
308
356
|
id: string;
|
|
309
|
-
students: {
|
|
310
|
-
id: string;
|
|
311
|
-
}[];
|
|
312
357
|
teachers: {
|
|
313
358
|
id: string;
|
|
314
359
|
}[];
|
|
315
|
-
};
|
|
316
|
-
} | null;
|
|
317
|
-
announcement: {
|
|
318
|
-
class: {
|
|
319
|
-
id: string;
|
|
320
360
|
students: {
|
|
321
361
|
id: string;
|
|
322
362
|
}[];
|
|
323
|
-
teachers: {
|
|
324
|
-
id: string;
|
|
325
|
-
}[];
|
|
326
363
|
};
|
|
327
364
|
} | null;
|
|
365
|
+
studentQuestionProgress: {
|
|
366
|
+
studentId: string;
|
|
367
|
+
studentWorksheetResponse: {
|
|
368
|
+
submission: {
|
|
369
|
+
assignment: {
|
|
370
|
+
class: {
|
|
371
|
+
school: {
|
|
372
|
+
users: {
|
|
373
|
+
id: string;
|
|
374
|
+
}[];
|
|
375
|
+
memberships: {
|
|
376
|
+
userId: string;
|
|
377
|
+
}[];
|
|
378
|
+
} | null;
|
|
379
|
+
id: string;
|
|
380
|
+
teachers: {
|
|
381
|
+
id: string;
|
|
382
|
+
}[];
|
|
383
|
+
students: {
|
|
384
|
+
id: string;
|
|
385
|
+
}[];
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
studentId: string;
|
|
389
|
+
} | null;
|
|
390
|
+
} | null;
|
|
391
|
+
} | null;
|
|
328
392
|
} & {
|
|
329
393
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
330
394
|
id: string;
|
|
395
|
+
createdAt: Date;
|
|
331
396
|
assignmentId: string | null;
|
|
332
397
|
submissionId: string | null;
|
|
333
398
|
announcementId: string | null;
|
|
334
|
-
createdAt: Date;
|
|
335
399
|
modifiedAt: Date | null;
|
|
336
400
|
content: string;
|
|
337
401
|
authorId: string;
|
|
@@ -341,10 +405,10 @@ export declare function findCommentWithContext(commentId: string): import(".pris
|
|
|
341
405
|
} & {
|
|
342
406
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
343
407
|
id: string;
|
|
408
|
+
createdAt: Date;
|
|
344
409
|
assignmentId: string | null;
|
|
345
410
|
submissionId: string | null;
|
|
346
411
|
announcementId: string | null;
|
|
347
|
-
createdAt: Date;
|
|
348
412
|
modifiedAt: Date | null;
|
|
349
413
|
content: string;
|
|
350
414
|
authorId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.d.ts","sourceRoot":"/","sources":["models/comment.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwChB,CAAC;
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"/","sources":["models/comment.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwChB,CAAC;AAuBX,wDAAwD;AACxD,wBAAgB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwGvD;AAED,sDAAsD;AACtD,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM;;;;;;;;GAM7D"}
|
package/dist/models/comment.js
CHANGED
|
@@ -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]="
|
|
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){}}();
|
|
6
6
|
import { prisma } from "../lib/prisma.js";
|
|
7
7
|
export const commentSelect = {
|
|
8
8
|
id: true,
|
|
@@ -45,6 +45,26 @@ export const commentSelect = {
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
};
|
|
48
|
+
const commentClassAuthSelect = {
|
|
49
|
+
id: true,
|
|
50
|
+
teachers: { select: { id: true } },
|
|
51
|
+
students: { select: { id: true } },
|
|
52
|
+
school: {
|
|
53
|
+
select: {
|
|
54
|
+
users: {
|
|
55
|
+
where: { role: "ADMIN" },
|
|
56
|
+
select: { id: true },
|
|
57
|
+
},
|
|
58
|
+
memberships: {
|
|
59
|
+
where: {
|
|
60
|
+
role: "ADMIN",
|
|
61
|
+
status: "ACTIVE",
|
|
62
|
+
},
|
|
63
|
+
select: { userId: true },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
48
68
|
/** @returns Comment by ID with author and reactions. */
|
|
49
69
|
export function findCommentById(id) {
|
|
50
70
|
return prisma.comment.findUnique({
|
|
@@ -138,22 +158,14 @@ export function findCommentWithContext(commentId) {
|
|
|
138
158
|
announcement: {
|
|
139
159
|
select: {
|
|
140
160
|
class: {
|
|
141
|
-
select:
|
|
142
|
-
id: true,
|
|
143
|
-
teachers: { select: { id: true } },
|
|
144
|
-
students: { select: { id: true } },
|
|
145
|
-
},
|
|
161
|
+
select: commentClassAuthSelect,
|
|
146
162
|
},
|
|
147
163
|
},
|
|
148
164
|
},
|
|
149
165
|
assignment: {
|
|
150
166
|
select: {
|
|
151
167
|
class: {
|
|
152
|
-
select:
|
|
153
|
-
id: true,
|
|
154
|
-
teachers: { select: { id: true } },
|
|
155
|
-
students: { select: { id: true } },
|
|
156
|
-
},
|
|
168
|
+
select: commentClassAuthSelect,
|
|
157
169
|
},
|
|
158
170
|
},
|
|
159
171
|
},
|
|
@@ -163,11 +175,7 @@ export function findCommentWithContext(commentId) {
|
|
|
163
175
|
assignment: {
|
|
164
176
|
select: {
|
|
165
177
|
class: {
|
|
166
|
-
select:
|
|
167
|
-
id: true,
|
|
168
|
-
teachers: { select: { id: true } },
|
|
169
|
-
students: { select: { id: true } },
|
|
170
|
-
},
|
|
178
|
+
select: commentClassAuthSelect,
|
|
171
179
|
},
|
|
172
180
|
},
|
|
173
181
|
},
|
|
@@ -184,11 +192,7 @@ export function findCommentWithContext(commentId) {
|
|
|
184
192
|
assignment: {
|
|
185
193
|
select: {
|
|
186
194
|
class: {
|
|
187
|
-
select:
|
|
188
|
-
id: true,
|
|
189
|
-
teachers: { select: { id: true } },
|
|
190
|
-
students: { select: { id: true } },
|
|
191
|
-
},
|
|
195
|
+
select: commentClassAuthSelect,
|
|
192
196
|
},
|
|
193
197
|
},
|
|
194
198
|
},
|
|
@@ -203,22 +207,14 @@ export function findCommentWithContext(commentId) {
|
|
|
203
207
|
announcement: {
|
|
204
208
|
select: {
|
|
205
209
|
class: {
|
|
206
|
-
select:
|
|
207
|
-
id: true,
|
|
208
|
-
teachers: { select: { id: true } },
|
|
209
|
-
students: { select: { id: true } },
|
|
210
|
-
},
|
|
210
|
+
select: commentClassAuthSelect,
|
|
211
211
|
},
|
|
212
212
|
},
|
|
213
213
|
},
|
|
214
214
|
assignment: {
|
|
215
215
|
select: {
|
|
216
216
|
class: {
|
|
217
|
-
select:
|
|
218
|
-
id: true,
|
|
219
|
-
teachers: { select: { id: true } },
|
|
220
|
-
students: { select: { id: true } },
|
|
221
|
-
},
|
|
217
|
+
select: commentClassAuthSelect,
|
|
222
218
|
},
|
|
223
219
|
},
|
|
224
220
|
},
|
|
@@ -228,11 +224,7 @@ export function findCommentWithContext(commentId) {
|
|
|
228
224
|
assignment: {
|
|
229
225
|
select: {
|
|
230
226
|
class: {
|
|
231
|
-
select:
|
|
232
|
-
id: true,
|
|
233
|
-
teachers: { select: { id: true } },
|
|
234
|
-
students: { select: { id: true } },
|
|
235
|
-
},
|
|
227
|
+
select: commentClassAuthSelect,
|
|
236
228
|
},
|
|
237
229
|
},
|
|
238
230
|
},
|
|
@@ -249,11 +241,7 @@ export function findCommentWithContext(commentId) {
|
|
|
249
241
|
assignment: {
|
|
250
242
|
select: {
|
|
251
243
|
class: {
|
|
252
|
-
select:
|
|
253
|
-
id: true,
|
|
254
|
-
teachers: { select: { id: true } },
|
|
255
|
-
students: { select: { id: true } },
|
|
256
|
-
},
|
|
244
|
+
select: commentClassAuthSelect,
|
|
257
245
|
},
|
|
258
246
|
},
|
|
259
247
|
},
|
|
@@ -277,4 +265,4 @@ export function getReactionCountsByCommentId(commentId) {
|
|
|
277
265
|
});
|
|
278
266
|
}
|
|
279
267
|
//# sourceMappingURL=comment.js.map
|
|
280
|
-
//# debugId=
|
|
268
|
+
//# debugId=4e10262a-c8cd-5388-9b97-3cf8d34902b6
|
|
@@ -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\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: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\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: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n parentComment: {\n include: {\n announcement: {\n select: {\n class: {\n select: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\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: {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n },\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,CAAC;AAEX,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAC,EAAU;IACxC,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;QAC/B,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,MAAM,EAAE,aAAa;KACtB,CAAC,CAAC;AACL,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IAC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pB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KACvB,CAAC,CAAC;AACL,CAAC","debug_id":"f7121ae4-2705-5c41-8439-e02632b5f35c"}
|
|
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,CAAC;AAEX,MAAM,sBAAsB,GAAG;IAC7B,EAAE,EAAE,IAAI;IACR,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,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ACF;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"}
|
|
@@ -15,9 +15,9 @@ export declare function findConversationsByUserId(userId: string): import(".pris
|
|
|
15
15
|
};
|
|
16
16
|
} & {
|
|
17
17
|
id: string;
|
|
18
|
+
role: import(".prisma/client").$Enums.ConversationRole;
|
|
18
19
|
userId: string;
|
|
19
20
|
conversationId: string;
|
|
20
|
-
role: import(".prisma/client").$Enums.ConversationRole;
|
|
21
21
|
joinedAt: Date;
|
|
22
22
|
hiddenAt: Date | null;
|
|
23
23
|
lastViewedAt: Date | null;
|
|
@@ -35,8 +35,8 @@ export declare function findConversationsByUserId(userId: string): import(".pris
|
|
|
35
35
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
36
36
|
meta: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
37
37
|
id: string;
|
|
38
|
-
conversationId: string;
|
|
39
38
|
createdAt: Date;
|
|
39
|
+
conversationId: string;
|
|
40
40
|
content: string;
|
|
41
41
|
senderId: string;
|
|
42
42
|
})[];
|
|
@@ -101,9 +101,9 @@ export declare function createConversation(data: {
|
|
|
101
101
|
};
|
|
102
102
|
} & {
|
|
103
103
|
id: string;
|
|
104
|
+
role: import(".prisma/client").$Enums.ConversationRole;
|
|
104
105
|
userId: string;
|
|
105
106
|
conversationId: string;
|
|
106
|
-
role: import(".prisma/client").$Enums.ConversationRole;
|
|
107
107
|
joinedAt: Date;
|
|
108
108
|
hiddenAt: Date | null;
|
|
109
109
|
lastViewedAt: Date | null;
|
|
@@ -136,9 +136,9 @@ export declare function findConversationByIdAndMember(conversationId: string, us
|
|
|
136
136
|
};
|
|
137
137
|
} & {
|
|
138
138
|
id: string;
|
|
139
|
+
role: import(".prisma/client").$Enums.ConversationRole;
|
|
139
140
|
userId: string;
|
|
140
141
|
conversationId: string;
|
|
141
|
-
role: import(".prisma/client").$Enums.ConversationRole;
|
|
142
142
|
joinedAt: Date;
|
|
143
143
|
hiddenAt: Date | null;
|
|
144
144
|
lastViewedAt: Date | null;
|
|
@@ -165,9 +165,9 @@ export declare function createConversationMember(data: {
|
|
|
165
165
|
role: string;
|
|
166
166
|
}): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
|
|
167
167
|
id: string;
|
|
168
|
+
role: import(".prisma/client").$Enums.ConversationRole;
|
|
168
169
|
userId: string;
|
|
169
170
|
conversationId: string;
|
|
170
|
-
role: import(".prisma/client").$Enums.ConversationRole;
|
|
171
171
|
joinedAt: Date;
|
|
172
172
|
hiddenAt: Date | null;
|
|
173
173
|
lastViewedAt: Date | null;
|
|
@@ -182,9 +182,9 @@ export declare function createConversationMember(data: {
|
|
|
182
182
|
/** Hide a conversation for a single member until new activity occurs. */
|
|
183
183
|
export declare function hideConversationMember(userId: string, conversationId: string): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
|
|
184
184
|
id: string;
|
|
185
|
+
role: import(".prisma/client").$Enums.ConversationRole;
|
|
185
186
|
userId: string;
|
|
186
187
|
conversationId: string;
|
|
187
|
-
role: import(".prisma/client").$Enums.ConversationRole;
|
|
188
188
|
joinedAt: Date;
|
|
189
189
|
hiddenAt: Date | null;
|
|
190
190
|
lastViewedAt: Date | null;
|
|
@@ -199,9 +199,9 @@ export declare function hideConversationMember(userId: string, conversationId: s
|
|
|
199
199
|
/** Remove a member from a conversation. */
|
|
200
200
|
export declare function deleteConversationMember(userId: string, conversationId: string): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
|
|
201
201
|
id: string;
|
|
202
|
+
role: import(".prisma/client").$Enums.ConversationRole;
|
|
202
203
|
userId: string;
|
|
203
204
|
conversationId: string;
|
|
204
|
-
role: import(".prisma/client").$Enums.ConversationRole;
|
|
205
205
|
joinedAt: Date;
|
|
206
206
|
hiddenAt: Date | null;
|
|
207
207
|
lastViewedAt: Date | null;
|