@studious-lms/server 1.12.0 → 1.13.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.
- package/dist/models/class.d.ts +10 -0
- package/dist/models/class.d.ts.map +1 -1
- package/dist/models/class.js +9 -3
- package/dist/models/class.js.map +1 -1
- package/dist/models/comment.d.ts +7 -0
- package/dist/models/comment.d.ts.map +1 -1
- package/dist/models/comment.js +3 -2
- package/dist/models/comment.js.map +1 -1
- package/dist/models/conversation.d.ts +17 -0
- package/dist/models/conversation.d.ts.map +1 -1
- package/dist/models/conversation.js +13 -2
- package/dist/models/conversation.js.map +1 -1
- package/dist/models/worksheet.d.ts +4 -0
- package/dist/models/worksheet.d.ts.map +1 -1
- package/dist/models/worksheet.js +13 -7
- package/dist/models/worksheet.js.map +1 -1
- package/dist/pipelines/gradeWorksheet.d.ts.map +1 -1
- package/dist/pipelines/gradeWorksheet.js +59 -14
- package/dist/pipelines/gradeWorksheet.js.map +1 -1
- package/dist/routers/_app.d.ts +124 -0
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/announcement.d.ts +4 -0
- package/dist/routers/announcement.d.ts.map +1 -1
- package/dist/routers/announcement.js +6 -5
- package/dist/routers/announcement.js.map +1 -1
- package/dist/routers/assignment.d.ts +8 -0
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +4 -4
- package/dist/routers/assignment.js.map +1 -1
- package/dist/routers/class.d.ts +23 -0
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/comment.d.ts +24 -0
- package/dist/routers/comment.d.ts.map +1 -1
- package/dist/routers/comment.js +6 -3
- package/dist/routers/comment.js.map +1 -1
- package/dist/routers/worksheet.d.ts +3 -0
- package/dist/routers/worksheet.d.ts.map +1 -1
- package/dist/routers/worksheet.js +4 -2
- package/dist/routers/worksheet.js.map +1 -1
- package/dist/services/assignment.d.ts.map +1 -1
- package/dist/services/assignment.js +10 -8
- package/dist/services/assignment.js.map +1 -1
- package/dist/services/class.d.ts +23 -0
- package/dist/services/class.d.ts.map +1 -1
- package/dist/services/class.js +8 -3
- package/dist/services/class.js.map +1 -1
- package/dist/services/comment.d.ts +18 -0
- package/dist/services/comment.d.ts.map +1 -1
- package/dist/services/comment.js +23 -2
- package/dist/services/comment.js.map +1 -1
- package/dist/services/conversation.d.ts.map +1 -1
- package/dist/services/conversation.js +9 -7
- package/dist/services/conversation.js.map +1 -1
- package/dist/services/worksheet.d.ts +3 -0
- package/dist/services/worksheet.d.ts.map +1 -1
- package/dist/services/worksheet.js +2 -2
- package/dist/services/worksheet.js.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +1 -0
- package/src/models/class.ts +7 -1
- package/src/models/comment.ts +1 -0
- package/src/models/conversation.ts +12 -0
- package/src/models/worksheet.ts +11 -5
- package/src/pipelines/gradeWorksheet.ts +66 -15
- package/src/routers/announcement.ts +4 -3
- package/src/routers/assignment.ts +2 -2
- package/src/routers/comment.ts +5 -0
- package/src/routers/worksheet.ts +2 -0
- package/src/services/assignment.ts +8 -7
- package/src/services/class.ts +10 -1
- package/src/services/comment.ts +22 -0
- package/src/services/conversation.ts +9 -4
- package/src/services/worksheet.ts +1 -0
- package/tests/integration/routers/conversation.test.ts +9 -7
package/dist/models/class.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export declare function findTeacherClasses(userId: string): import(".prisma/clie
|
|
|
17
17
|
assignments: {
|
|
18
18
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
19
19
|
id: string;
|
|
20
|
+
submissions: {
|
|
21
|
+
studentId: string;
|
|
22
|
+
submitted: boolean | null;
|
|
23
|
+
returned: boolean | null;
|
|
24
|
+
}[];
|
|
20
25
|
title: string;
|
|
21
26
|
dueDate: Date;
|
|
22
27
|
}[];
|
|
@@ -65,6 +70,11 @@ export declare function findStudentClasses(userId: string): import(".prisma/clie
|
|
|
65
70
|
assignments: {
|
|
66
71
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
67
72
|
id: string;
|
|
73
|
+
submissions: {
|
|
74
|
+
studentId: string;
|
|
75
|
+
submitted: boolean | null;
|
|
76
|
+
returned: boolean | null;
|
|
77
|
+
}[];
|
|
68
78
|
title: string;
|
|
69
79
|
dueDate: Date;
|
|
70
80
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.ts","sourceRoot":"/","sources":["models/class.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,EAAc,KAAK,EAAE,MAAM,EAAgE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"class.d.ts","sourceRoot":"/","sources":["models/class.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,EAAc,KAAK,EAAE,MAAM,EAAgE,MAAM,gBAAgB,CAAC;AAuEzH,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKhD;AAED,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKhD;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;GAO/D;AAyHD,qFAAqF;AACrF,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCjD;AAED,sCAAsC;AACtC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;GAIjD;AAED,qCAAqC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MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG;IAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6HjK"}
|
package/dist/models/class.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* grading boundaries, syllabus, lab drafts, invite codes.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
!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]="
|
|
6
|
+
!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]="964a7e54-f2fa-5229-8330-925e025a577f")}catch(e){}}();
|
|
7
7
|
import { SessionType } from "@prisma/client";
|
|
8
8
|
import { prisma } from "../lib/prisma.js";
|
|
9
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
@@ -12,7 +12,6 @@ import { classMemberOrSchoolAdminWhere, classTeacherOrSchoolAdminWhere, } from "
|
|
|
12
12
|
const classIncludeForGetAll = {
|
|
13
13
|
assignments: {
|
|
14
14
|
where: {
|
|
15
|
-
dueDate: { lte: new Date(new Date().setHours(23, 59, 59, 999)) },
|
|
16
15
|
template: false,
|
|
17
16
|
},
|
|
18
17
|
select: {
|
|
@@ -20,6 +19,13 @@ const classIncludeForGetAll = {
|
|
|
20
19
|
title: true,
|
|
21
20
|
type: true,
|
|
22
21
|
dueDate: true,
|
|
22
|
+
submissions: {
|
|
23
|
+
select: {
|
|
24
|
+
studentId: true,
|
|
25
|
+
submitted: true,
|
|
26
|
+
returned: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
23
29
|
},
|
|
24
30
|
},
|
|
25
31
|
students: {
|
|
@@ -666,4 +672,4 @@ export async function createClassByImport(classId, userId, year, classData) {
|
|
|
666
672
|
return newClassId;
|
|
667
673
|
}
|
|
668
674
|
//# sourceMappingURL=class.js.map
|
|
669
|
-
//# debugId=
|
|
675
|
+
//# debugId=964a7e54-f2fa-5229-8330-925e025a577f
|
package/dist/models/class.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sources":["models/class.ts"],"sourceRoot":"/","sourcesContent":["\n/**\n * Class model – classes, members, assignments, grades, mark schemes,\n * grading boundaries, syllabus, lab drafts, invite codes.\n */\n\nimport { Assignment, Class, Folder, GradingBoundary, MarkScheme, Section, SessionType, Worksheet } from \"@prisma/client\";\nimport type { PrismaClient, WorksheetQuestion } from \"@prisma/client\";\n\nimport { prisma } from \"../lib/prisma.js\";\nimport { v4 as uuidv4 } from 'uuid';\nimport { copyFile } from \"../lib/googleCloudStorage.js\";\nimport {\n classMemberOrSchoolAdminWhere,\n classTeacherOrSchoolAdminWhere,\n} from \"./access.js\";\n\nconst classIncludeForGetAll = {\n assignments: {\n where: {\n dueDate: { lte: new Date(new Date().setHours(23, 59, 59, 999)) },\n template: false,\n },\n select: {\n id: true,\n title: true,\n type: true,\n dueDate: true,\n },\n },\n students: {\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 teachers: {\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 school: {\n select: {\n id: true,\n name: true,\n },\n },\n department: {\n select: {\n id: true,\n name: true,\n color: true,\n },\n },\n} as const;\n\n/** @returns Classes where user is a teacher. */\nexport function findTeacherClasses(userId: string) {\n return prisma.class.findMany({\n where: classTeacherOrSchoolAdminWhere(userId),\n include: classIncludeForGetAll,\n });\n}\n\n/** @returns Classes where user is a student. */\nexport function findStudentClasses(userId: string) {\n return prisma.class.findMany({\n where: { students: { some: { id: userId } } },\n include: classIncludeForGetAll,\n });\n}\n\n/** @returns Class if user is a teacher or school admin. */\nexport function isTeacherInClass(classId: string, userId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classTeacherOrSchoolAdminWhere(userId),\n },\n });\n}\n\nconst classIncludeForGet = {\n teachers: {\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 students: {\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 announcements: {\n orderBy: { createdAt: \"desc\" as const },\n select: {\n id: true,\n remarks: true,\n createdAt: true,\n modifiedAt: true,\n teacher: {\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 assignments: {\n select: {\n type: true,\n id: true,\n title: true,\n dueDate: true,\n createdAt: true,\n weight: true,\n order: true,\n graded: true,\n maxGrade: true,\n instructions: true,\n inProgress: true,\n section: {\n select: { id: true, name: true },\n },\n markScheme: {\n select: { id: true, structured: true },\n },\n gradingBoundary: {\n select: { id: true, structured: true },\n },\n submissions: {\n select: {\n studentId: true,\n id: true,\n submitted: true,\n gradeReceived: true,\n rubricState: true,\n teacherComments: true,\n returned: true,\n submittedAt: true,\n },\n },\n },\n },\n discussionsEnabled: true,\n studentsCanCreateDiscussions: true,\n studentsCanReply: true,\n} as const;\n\nconst assignmentSelect = {\n type: true,\n id: true,\n title: true,\n dueDate: true,\n createdAt: true,\n weight: true,\n order: true,\n graded: true,\n maxGrade: true,\n instructions: true,\n inProgress: true,\n section: { select: { id: true, name: true } },\n markScheme: { select: { id: true, structured: true } },\n gradingBoundary: { select: { id: true, structured: true } },\n submissions: {\n select: {\n studentId: true,\n id: true,\n submitted: true,\n gradeReceived: true,\n rubricState: true,\n teacherComments: true,\n returned: true,\n submittedAt: true,\n },\n },\n} as const;\n\n/** @returns Class with assignments. Students see only assigned; teachers see all. */\nexport function findClassWithAssignments(\n classId: string,\n options: { isTeacher: boolean; userId?: string }\n) {\n const assignmentWhere = !options.isTeacher &&\n options.userId\n ? {\n OR: [\n { assignedTo: { some: { id: options.userId } } },\n { assignedTo: { none: {} } },\n ],\n }\n : undefined;\n\n const submissionWhere =\n !options.isTeacher && options.userId\n ? { studentId: options.userId }\n : undefined;\n\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...(options.userId\n ? classMemberOrSchoolAdminWhere(options.userId)\n : {}),\n },\n include: {\n teachers: classIncludeForGet.teachers,\n students: classIncludeForGet.students,\n announcements: classIncludeForGet.announcements,\n assignments: {\n ...(assignmentWhere && { where: assignmentWhere }),\n select: {\n ...assignmentSelect,\n submissions: {\n ...(submissionWhere && { where: submissionWhere }),\n select: assignmentSelect.submissions.select,\n },\n },\n },\n },\n });\n}\n\n/** @returns Class by ID (minimal). */\nexport function findClassByIdBasic(classId: string) {\n return prisma.class.findUnique({\n where: { id: classId },\n });\n}\n\n/** @returns Sections for a class. */\nexport function findSectionsByClassId(classId: string) {\n return prisma.section.findMany({\n where: { classId },\n });\n}\n\n/** @returns User by ID (id, username only). */\nexport function findUserById(userId: string) {\n return prisma.user.findUnique({\n where: { id: userId },\n select: { id: true, username: true },\n });\n}\n\n/** @returns Session by class invite code. */\nexport function findSessionByClassCode(classCode: string) {\n return prisma.session.findFirst({\n where: {\n id: { equals: classCode, mode: \"insensitive\" },\n type: SessionType.CLASS_INVITE,\n },\n });\n}\n\n/** @returns Session for a class. */\nexport function findSessionByClassId(classId: string) {\n return prisma.session.findFirst({\n where: { classId },\n });\n}\n\n/** @returns User's graded submissions for grade calculation. */\nexport function findSubmissionsForGrades(userId: string, classId: string) {\n return prisma.submission.findMany({\n where: {\n studentId: userId,\n assignment: { classId, graded: true },\n },\n include: {\n assignment: {\n select: {\n id: true,\n title: true,\n maxGrade: true,\n weight: true,\n markSchemeId: true,\n dueDate: true,\n markScheme: { select: { structured: true } },\n gradingBoundaryId: true,\n gradingBoundary: { select: { structured: true } },\n },\n },\n },\n });\n}\n\n/** @returns Events for a class. */\nexport function findEventsByClassId(classId: string) {\n return prisma.event.findMany({\n where: { class: { id: classId } },\n select: { name: true, startTime: true, endTime: true },\n });\n}\n\n/** @returns Mark schemes for a class. */\nexport function findMarkSchemesByClassId(classId: string) {\n return prisma.markScheme.findMany({\n where: { class: { id: classId } },\n });\n}\n\n/** @returns Grading boundaries for a class. */\nexport function findGradingBoundariesByClassId(classId: string) {\n return prisma.gradingBoundary.findMany({\n where: { class: { id: classId } },\n });\n}\n\n/** @returns Class syllabus. */\nexport function findClassSyllabus(classId: string) {\n return prisma.class.findUnique({\n where: { id: classId },\n select: { syllabus: true },\n });\n}\n\n/** @returns In-progress lab drafts for a teacher. */\nexport function findLabDraftsByClass(classId: string, teacherId: string) {\n return prisma.assignment.findMany({\n where: {\n classId,\n teacherId,\n inProgress: true,\n },\n orderBy: { modifiedAt: \"desc\" as const },\n });\n}\n\n/** @returns Assignments with attachments and submissions. */\nexport function findAssignmentsWithFiles(classId: string) {\n return prisma.assignment.findMany({\n where: { classId },\n include: {\n attachments: {\n select: {\n id: true,\n name: true,\n type: true,\n size: true,\n path: true,\n thumbnailId: true,\n uploadedAt: true,\n user: { select: { id: true, username: true } },\n },\n },\n submissions: {\n include: {\n attachments: {\n select: {\n id: true,\n name: true,\n type: true,\n size: true,\n path: true,\n thumbnailId: true,\n uploadedAt: true,\n user: { select: { id: true, username: true } },\n },\n },\n annotations: {\n select: {\n id: true,\n name: true,\n type: true,\n size: true,\n path: true,\n thumbnailId: true,\n uploadedAt: true,\n user: { select: { id: true, username: true } },\n },\n },\n student: { select: { id: true, username: true } },\n },\n },\n teacher: { select: { id: true, username: true } },\n },\n orderBy: { createdAt: \"desc\" as const },\n });\n}\n\nasync function recursivelyIncludeFiles(folderId: string) {\n if (!folderId.length) {\n return null;\n }\n\n const folder = await prisma.folder.findUnique({\n where: { id: folderId },\n include: {\n files: {\n select: { id: true, name: true, type: true, size: true, path: true },\n },\n childFolders: {\n select: { id: true },\n },\n },\n });\n if (!folder) {\n return null;\n }\n return {\n ...folder,\n files: folder.files.map(file => file.id),\n childFolders: await Promise.all(folder.childFolders.map(folder => recursivelyIncludeFiles(folder.id))),\n };\n}\n\n/** Copy all files in folder tree to GCS (outside transaction). Returns map of sourcePath -> newPath. */\nasync function recursivelyCopyFilesToGcs(folderId: string): Promise<Map<string, string>> {\n const pathMap = new Map<string, string>();\n if (!folderId.length) return pathMap;\n\n const folder = await prisma.folder.findUnique({\n where: { id: folderId },\n include: {\n files: { select: { path: true, name: true } },\n childFolders: { select: { id: true } },\n },\n });\n if (!folder) return pathMap;\n\n for (const file of folder.files) {\n const ext = file.name.split('.').pop() || '';\n const newPath = `imported/${uuidv4()}${ext ? `.${ext}` : ''}`;\n await copyFile(file.path, newPath);\n pathMap.set(file.path, newPath);\n }\n for (const child of folder.childFolders) {\n const childMap = await recursivelyCopyFilesToGcs(child.id);\n childMap.forEach((v, k) => pathMap.set(k, v));\n }\n return pathMap;\n}\n\nasync function recursivelyCreateFiles(\n tx: PrismaClient | Omit<PrismaClient, \"$connect\" | \"$disconnect\" | \"$on\" | \"$transaction\" | \"$use\" | \"$extends\">,\n folderId: string,\n targetFolderId: string | undefined,\n pathMap: Map<string, string>\n) {\n if (!folderId.length) return;\n\n const parentFolder = await tx.folder.findUnique({\n where: { id: folderId },\n include: {\n files: { select: { id: true, name: true, type: true, size: true, path: true } },\n childFolders: { select: { id: true, name: true, color: true, parentFolderId: true } },\n },\n });\n if (!parentFolder) return;\n\n for (const file of parentFolder.files) {\n const newPath = pathMap.get(file.path);\n if (!newPath) continue;\n await tx.file.create({\n data: {\n name: file.name,\n type: file.type,\n size: file.size,\n path: newPath,\n uploadStatus: 'COMPLETED',\n ...(targetFolderId && { folder: { connect: { id: targetFolderId } } }),\n },\n });\n }\n\n for (const childFolder of parentFolder.childFolders) {\n const newFolder = await tx.folder.create({\n data: {\n name: childFolder.name,\n color: childFolder.color,\n parentFolderId: targetFolderId ?? parentFolder.id,\n },\n });\n await recursivelyCreateFiles(tx, childFolder.id, newFolder.id, pathMap);\n }\n}\n\n\nexport async function findFullExportableClass(classId: string) {\n const baseClass = await prisma.class.findUnique({\n where: { id: classId },\n include: {\n assignments: {\n select: {\n ...assignmentSelect,\n submissions: false,\n worksheets: { select: { id: true } },\n teacherId: true,\n classId: true,\n sectionId: true,\n markSchemeId: true,\n gradingBoundaryId: true,\n eventId: true,\n acceptFiles: true,\n acceptExtendedResponse: true,\n acceptWorksheet: true,\n gradeWithAI: true,\n aiPolicyLevel: true,\n },\n },\n classFiles: {\n select: {\n id: true,\n },\n },\n worksheets: {\n select: {\n id: true,\n name: true,\n classId: true,\n questions: {\n select: {\n type: true,\n question: true,\n answer: true,\n points: true,\n options: true,\n markScheme: true,\n order: true,\n worksheetId: true,\n },\n },\n },\n },\n markSchemes: {\n select: {\n id: true,\n classId: true,\n structured: true,\n },\n },\n gradingBoundaries: {\n select: {\n id: true,\n classId: true,\n structured: true,\n },\n },\n sections: {\n select: {\n id: true,\n name: true,\n classId: true,\n color: true,\n order: true,\n },\n },\n },\n });\n\n if (!baseClass) {\n return null;\n }\n\n const classFiles = await recursivelyIncludeFiles(baseClass.classFiles?.id ?? \"\");\n\n const formattedClass = {\n ...baseClass,\n classFiles,\n };\n\n return formattedClass;\n}\n\nexport async function createClassByImport(classId: string, userId: string, year: number, classData: Class & { classFiles: Folder | null }): Promise<string | null> {\n const pathMap = classData.classFiles?.id\n ? await recursivelyCopyFilesToGcs(classData.classFiles.id)\n : new Map<string, string>();\n\n const newClassId = await prisma.$transaction(async (tx) => {\n const createdClass = await tx.class.create({\n data: {\n name: classData.name,\n subject: classData.subject,\n color: classData.color,\n section: classData.section,\n syllabus: classData.syllabus,\n teachers: { connect: { id: userId } },\n classFiles: { create: { name: \"Class Files\" } },\n },\n include: {\n classFiles: true,\n },\n });\n\n const oldSectionIdToNew = new Map<string, string>();\n const oldMarkSchemeIdToNew = new Map<string, string>();\n const oldGradingBoundaryIdToNew = new Map<string, string>();\n const oldWorksheetIdToNew = new Map<string, string>();\n\n const sections = (classData as unknown as Class & { sections: Section[] }).sections ?? [];\n await Promise.all(\n sections.map(async (section, index) => {\n const newSection = await tx.section.create({\n data: {\n name: section.name,\n classId: createdClass.id,\n color: section.color,\n order: section.order ?? index,\n },\n });\n oldSectionIdToNew.set(section.id, newSection.id);\n return newSection;\n })\n );\n\n const markSchemes = (classData as unknown as Class & { markSchemes: MarkScheme[] }).markSchemes ?? [];\n await Promise.all(\n markSchemes.map(async (ms) => {\n const newMs = await tx.markScheme.create({\n data: { classId: createdClass.id, structured: ms.structured },\n });\n oldMarkSchemeIdToNew.set(ms.id, newMs.id);\n return newMs;\n })\n );\n\n const gradingBoundaries = (classData as unknown as Class & { gradingBoundaries: GradingBoundary[] }).gradingBoundaries ?? [];\n await Promise.all(\n gradingBoundaries.map(async (gb) => {\n const newGb = await tx.gradingBoundary.create({\n data: { classId: createdClass.id, structured: gb.structured },\n });\n oldGradingBoundaryIdToNew.set(gb.id, newGb.id);\n return newGb;\n })\n );\n\n const worksheets = (classData as unknown as Class & { worksheets: Array<Worksheet & { questions: WorksheetQuestion[] }> }).worksheets ?? [];\n for (const worksheet of worksheets) {\n const newWorksheet = await tx.worksheet.create({\n data: {\n name: worksheet.name,\n classId: createdClass.id,\n questions: {\n create: (worksheet.questions ?? []).map((q, i) => ({\n type: q.type,\n question: q.question,\n answer: q.answer,\n points: q.points ?? 0,\n options: q.options ?? {},\n markScheme: q.markScheme ?? {},\n order: q.order ?? i,\n })),\n },\n },\n });\n oldWorksheetIdToNew.set(worksheet.id, newWorksheet.id);\n }\n\n const assignments = (classData as unknown as Class & { assignments: Array<Assignment & { worksheets?: { id: string }[] }> }).assignments ?? [];\n for (const assignment of assignments) {\n const date = new Date(assignment.dueDate);\n date.setFullYear(year);\n const worksheetIds = (assignment as { worksheets?: { id: string }[] }).worksheets?.map((w) => oldWorksheetIdToNew.get(w.id)).filter(Boolean) as string[] | undefined;\n await tx.assignment.create({\n data: {\n title: assignment.title,\n type: assignment.type,\n dueDate: date,\n instructions: assignment.instructions,\n teacherId: userId,\n classId: createdClass.id,\n sectionId: assignment.sectionId ? oldSectionIdToNew.get(assignment.sectionId) ?? undefined : undefined,\n markSchemeId: assignment.markSchemeId ? oldMarkSchemeIdToNew.get(assignment.markSchemeId) ?? undefined : undefined,\n gradingBoundaryId: assignment.gradingBoundaryId ? oldGradingBoundaryIdToNew.get(assignment.gradingBoundaryId) ?? undefined : undefined,\n weight: assignment.weight ?? 1,\n maxGrade: assignment.maxGrade ?? 0,\n graded: assignment.graded ?? false,\n inProgress: assignment.inProgress ?? false,\n template: assignment.template ?? false,\n acceptFiles: assignment.acceptFiles ?? false,\n acceptExtendedResponse: assignment.acceptExtendedResponse ?? false,\n acceptWorksheet: assignment.acceptWorksheet ?? false,\n gradeWithAI: assignment.gradeWithAI ?? false,\n aiPolicyLevel: assignment.aiPolicyLevel ?? 0,\n ...(worksheetIds?.length && { worksheets: { connect: worksheetIds.map((id) => ({ id })) } }),\n },\n });\n }\n\n if (classData.classFiles?.id) {\n await recursivelyCreateFiles(tx, classData.classFiles.id, createdClass.classFiles?.id, pathMap);\n }\n\n return createdClass.id;\n }, { timeout: 30000 });\n\n return newClassId;\n}\n"],"names":[],"mappings":"AACA;;;GAGG;;;AAEH,OAAO,EAAmE,WAAW,EAAa,MAAM,gBAAgB,CAAC;AAGzH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AAErB,MAAM,qBAAqB,G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,CAAC;IAEvB,OAAO,UAAU,CAAC;AACpB,CAAC","debug_id":"85b77847-e1a4-5c08-b348-83de7bac1f6e"}
|
|
1
|
+
{"version":3,"file":"class.js","sources":["models/class.ts"],"sourceRoot":"/","sourcesContent":["\n/**\n * Class model – classes, members, assignments, grades, mark schemes,\n * grading boundaries, syllabus, lab drafts, invite codes.\n */\n\nimport { Assignment, Class, Folder, GradingBoundary, MarkScheme, Section, SessionType, Worksheet } from \"@prisma/client\";\nimport type { PrismaClient, WorksheetQuestion } from \"@prisma/client\";\n\nimport { prisma } from \"../lib/prisma.js\";\nimport { v4 as uuidv4 } from 'uuid';\nimport { copyFile } from \"../lib/googleCloudStorage.js\";\nimport {\n classMemberOrSchoolAdminWhere,\n classTeacherOrSchoolAdminWhere,\n} from \"./access.js\";\n\nconst classIncludeForGetAll = {\n assignments: {\n where: {\n template: false,\n },\n select: {\n id: true,\n title: true,\n type: true,\n dueDate: true,\n submissions: {\n select: {\n studentId: true,\n submitted: true,\n returned: true,\n },\n },\n },\n },\n students: {\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 teachers: {\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 school: {\n select: {\n id: true,\n name: true,\n },\n },\n department: {\n select: {\n id: true,\n name: true,\n color: true,\n },\n },\n} as const;\n\n/** @returns Classes where user is a teacher. */\nexport function findTeacherClasses(userId: string) {\n return prisma.class.findMany({\n where: classTeacherOrSchoolAdminWhere(userId),\n include: classIncludeForGetAll,\n });\n}\n\n/** @returns Classes where user is a student. */\nexport function findStudentClasses(userId: string) {\n return prisma.class.findMany({\n where: { students: { some: { id: userId } } },\n include: classIncludeForGetAll,\n });\n}\n\n/** @returns Class if user is a teacher or school admin. */\nexport function isTeacherInClass(classId: string, userId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classTeacherOrSchoolAdminWhere(userId),\n },\n });\n}\n\nconst classIncludeForGet = {\n teachers: {\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 students: {\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 announcements: {\n orderBy: { createdAt: \"desc\" as const },\n select: {\n id: true,\n remarks: true,\n createdAt: true,\n modifiedAt: true,\n teacher: {\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 assignments: {\n select: {\n type: true,\n id: true,\n title: true,\n dueDate: true,\n createdAt: true,\n weight: true,\n order: true,\n graded: true,\n maxGrade: true,\n instructions: true,\n inProgress: true,\n section: {\n select: { id: true, name: true },\n },\n markScheme: {\n select: { id: true, structured: true },\n },\n gradingBoundary: {\n select: { id: true, structured: true },\n },\n submissions: {\n select: {\n studentId: true,\n id: true,\n submitted: true,\n gradeReceived: true,\n rubricState: true,\n teacherComments: true,\n returned: true,\n submittedAt: true,\n },\n },\n },\n },\n discussionsEnabled: true,\n studentsCanCreateDiscussions: true,\n studentsCanReply: true,\n} as const;\n\nconst assignmentSelect = {\n type: true,\n id: true,\n title: true,\n dueDate: true,\n createdAt: true,\n weight: true,\n order: true,\n graded: true,\n maxGrade: true,\n instructions: true,\n inProgress: true,\n section: { select: { id: true, name: true } },\n markScheme: { select: { id: true, structured: true } },\n gradingBoundary: { select: { id: true, structured: true } },\n submissions: {\n select: {\n studentId: true,\n id: true,\n submitted: true,\n gradeReceived: true,\n rubricState: true,\n teacherComments: true,\n returned: true,\n submittedAt: true,\n },\n },\n} as const;\n\n/** @returns Class with assignments. Students see only assigned; teachers see all. */\nexport function findClassWithAssignments(\n classId: string,\n options: { isTeacher: boolean; userId?: string }\n) {\n const assignmentWhere = !options.isTeacher &&\n options.userId\n ? {\n OR: [\n { assignedTo: { some: { id: options.userId } } },\n { assignedTo: { none: {} } },\n ],\n }\n : undefined;\n\n const submissionWhere =\n !options.isTeacher && options.userId\n ? { studentId: options.userId }\n : undefined;\n\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...(options.userId\n ? classMemberOrSchoolAdminWhere(options.userId)\n : {}),\n },\n include: {\n teachers: classIncludeForGet.teachers,\n students: classIncludeForGet.students,\n announcements: classIncludeForGet.announcements,\n assignments: {\n ...(assignmentWhere && { where: assignmentWhere }),\n select: {\n ...assignmentSelect,\n submissions: {\n ...(submissionWhere && { where: submissionWhere }),\n select: assignmentSelect.submissions.select,\n },\n },\n },\n },\n });\n}\n\n/** @returns Class by ID (minimal). */\nexport function findClassByIdBasic(classId: string) {\n return prisma.class.findUnique({\n where: { id: classId },\n });\n}\n\n/** @returns Sections for a class. */\nexport function findSectionsByClassId(classId: string) {\n return prisma.section.findMany({\n where: { classId },\n });\n}\n\n/** @returns User by ID (id, username only). */\nexport function findUserById(userId: string) {\n return prisma.user.findUnique({\n where: { id: userId },\n select: { id: true, username: true },\n });\n}\n\n/** @returns Session by class invite code. */\nexport function findSessionByClassCode(classCode: string) {\n return prisma.session.findFirst({\n where: {\n id: { equals: classCode, mode: \"insensitive\" },\n type: SessionType.CLASS_INVITE,\n },\n });\n}\n\n/** @returns Session for a class. */\nexport function findSessionByClassId(classId: string) {\n return prisma.session.findFirst({\n where: { classId },\n });\n}\n\n/** @returns User's graded submissions for grade calculation. */\nexport function findSubmissionsForGrades(userId: string, classId: string) {\n return prisma.submission.findMany({\n where: {\n studentId: userId,\n assignment: { classId, graded: true },\n },\n include: {\n assignment: {\n select: {\n id: true,\n title: true,\n maxGrade: true,\n weight: true,\n markSchemeId: true,\n dueDate: true,\n markScheme: { select: { structured: true } },\n gradingBoundaryId: true,\n gradingBoundary: { select: { structured: true } },\n },\n },\n },\n });\n}\n\n/** @returns Events for a class. */\nexport function findEventsByClassId(classId: string) {\n return prisma.event.findMany({\n where: { class: { id: classId } },\n select: { name: true, startTime: true, endTime: true },\n });\n}\n\n/** @returns Mark schemes for a class. */\nexport function findMarkSchemesByClassId(classId: string) {\n return prisma.markScheme.findMany({\n where: { class: { id: classId } },\n });\n}\n\n/** @returns Grading boundaries for a class. */\nexport function findGradingBoundariesByClassId(classId: string) {\n return prisma.gradingBoundary.findMany({\n where: { class: { id: classId } },\n });\n}\n\n/** @returns Class syllabus. */\nexport function findClassSyllabus(classId: string) {\n return prisma.class.findUnique({\n where: { id: classId },\n select: { syllabus: true },\n });\n}\n\n/** @returns In-progress lab drafts for a teacher. */\nexport function findLabDraftsByClass(classId: string, teacherId: string) {\n return prisma.assignment.findMany({\n where: {\n classId,\n teacherId,\n inProgress: true,\n },\n orderBy: { modifiedAt: \"desc\" as const },\n });\n}\n\n/** @returns Assignments with attachments and submissions. */\nexport function findAssignmentsWithFiles(classId: string) {\n return prisma.assignment.findMany({\n where: { classId },\n include: {\n attachments: {\n select: {\n id: true,\n name: true,\n type: true,\n size: true,\n path: true,\n thumbnailId: true,\n uploadedAt: true,\n user: { select: { id: true, username: true } },\n },\n },\n submissions: {\n include: {\n attachments: {\n select: {\n id: true,\n name: true,\n type: true,\n size: true,\n path: true,\n thumbnailId: true,\n uploadedAt: true,\n user: { select: { id: true, username: true } },\n },\n },\n annotations: {\n select: {\n id: true,\n name: true,\n type: true,\n size: true,\n path: true,\n thumbnailId: true,\n uploadedAt: true,\n user: { select: { id: true, username: true } },\n },\n },\n student: { select: { id: true, username: true } },\n },\n },\n teacher: { select: { id: true, username: true } },\n },\n orderBy: { createdAt: \"desc\" as const },\n });\n}\n\nasync function recursivelyIncludeFiles(folderId: string) {\n if (!folderId.length) {\n return null;\n }\n\n const folder = await prisma.folder.findUnique({\n where: { id: folderId },\n include: {\n files: {\n select: { id: true, name: true, type: true, size: true, path: true },\n },\n childFolders: {\n select: { id: true },\n },\n },\n });\n if (!folder) {\n return null;\n }\n return {\n ...folder,\n files: folder.files.map(file => file.id),\n childFolders: await Promise.all(folder.childFolders.map(folder => recursivelyIncludeFiles(folder.id))),\n };\n}\n\n/** Copy all files in folder tree to GCS (outside transaction). Returns map of sourcePath -> newPath. */\nasync function recursivelyCopyFilesToGcs(folderId: string): Promise<Map<string, string>> {\n const pathMap = new Map<string, string>();\n if (!folderId.length) return pathMap;\n\n const folder = await prisma.folder.findUnique({\n where: { id: folderId },\n include: {\n files: { select: { path: true, name: true } },\n childFolders: { select: { id: true } },\n },\n });\n if (!folder) return pathMap;\n\n for (const file of folder.files) {\n const ext = file.name.split('.').pop() || '';\n const newPath = `imported/${uuidv4()}${ext ? `.${ext}` : ''}`;\n await copyFile(file.path, newPath);\n pathMap.set(file.path, newPath);\n }\n for (const child of folder.childFolders) {\n const childMap = await recursivelyCopyFilesToGcs(child.id);\n childMap.forEach((v, k) => pathMap.set(k, v));\n }\n return pathMap;\n}\n\nasync function recursivelyCreateFiles(\n tx: PrismaClient | Omit<PrismaClient, \"$connect\" | \"$disconnect\" | \"$on\" | \"$transaction\" | \"$use\" | \"$extends\">,\n folderId: string,\n targetFolderId: string | undefined,\n pathMap: Map<string, string>\n) {\n if (!folderId.length) return;\n\n const parentFolder = await tx.folder.findUnique({\n where: { id: folderId },\n include: {\n files: { select: { id: true, name: true, type: true, size: true, path: true } },\n childFolders: { select: { id: true, name: true, color: true, parentFolderId: true } },\n },\n });\n if (!parentFolder) return;\n\n for (const file of parentFolder.files) {\n const newPath = pathMap.get(file.path);\n if (!newPath) continue;\n await tx.file.create({\n data: {\n name: file.name,\n type: file.type,\n size: file.size,\n path: newPath,\n uploadStatus: 'COMPLETED',\n ...(targetFolderId && { folder: { connect: { id: targetFolderId } } }),\n },\n });\n }\n\n for (const childFolder of parentFolder.childFolders) {\n const newFolder = await tx.folder.create({\n data: {\n name: childFolder.name,\n color: childFolder.color,\n parentFolderId: targetFolderId ?? parentFolder.id,\n },\n });\n await recursivelyCreateFiles(tx, childFolder.id, newFolder.id, pathMap);\n }\n}\n\n\nexport async function findFullExportableClass(classId: string) {\n const baseClass = await prisma.class.findUnique({\n where: { id: classId },\n include: {\n assignments: {\n select: {\n ...assignmentSelect,\n submissions: false,\n worksheets: { select: { id: true } },\n teacherId: true,\n classId: true,\n sectionId: true,\n markSchemeId: true,\n gradingBoundaryId: true,\n eventId: true,\n acceptFiles: true,\n acceptExtendedResponse: true,\n acceptWorksheet: true,\n gradeWithAI: true,\n aiPolicyLevel: true,\n },\n },\n classFiles: {\n select: {\n id: true,\n },\n },\n worksheets: {\n select: {\n id: true,\n name: true,\n classId: true,\n questions: {\n select: {\n type: true,\n question: true,\n answer: true,\n points: true,\n options: true,\n markScheme: true,\n order: true,\n worksheetId: true,\n },\n },\n },\n },\n markSchemes: {\n select: {\n id: true,\n classId: true,\n structured: true,\n },\n },\n gradingBoundaries: {\n select: {\n id: true,\n classId: true,\n structured: true,\n },\n },\n sections: {\n select: {\n id: true,\n name: true,\n classId: true,\n color: true,\n order: true,\n },\n },\n },\n });\n\n if (!baseClass) {\n return null;\n }\n\n const classFiles = await recursivelyIncludeFiles(baseClass.classFiles?.id ?? \"\");\n\n const formattedClass = {\n ...baseClass,\n classFiles,\n };\n\n return formattedClass;\n}\n\nexport async function createClassByImport(classId: string, userId: string, year: number, classData: Class & { classFiles: Folder | null }): Promise<string | null> {\n const pathMap = classData.classFiles?.id\n ? await recursivelyCopyFilesToGcs(classData.classFiles.id)\n : new Map<string, string>();\n\n const newClassId = await prisma.$transaction(async (tx) => {\n const createdClass = await tx.class.create({\n data: {\n name: classData.name,\n subject: classData.subject,\n color: classData.color,\n section: classData.section,\n syllabus: classData.syllabus,\n teachers: { connect: { id: userId } },\n classFiles: { create: { name: \"Class Files\" } },\n },\n include: {\n classFiles: true,\n },\n });\n\n const oldSectionIdToNew = new Map<string, string>();\n const oldMarkSchemeIdToNew = new Map<string, string>();\n const oldGradingBoundaryIdToNew = new Map<string, string>();\n const oldWorksheetIdToNew = new Map<string, string>();\n\n const sections = (classData as unknown as Class & { sections: Section[] }).sections ?? [];\n await Promise.all(\n sections.map(async (section, index) => {\n const newSection = await tx.section.create({\n data: {\n name: section.name,\n classId: createdClass.id,\n color: section.color,\n order: section.order ?? index,\n },\n });\n oldSectionIdToNew.set(section.id, newSection.id);\n return newSection;\n })\n );\n\n const markSchemes = (classData as unknown as Class & { markSchemes: MarkScheme[] }).markSchemes ?? [];\n await Promise.all(\n markSchemes.map(async (ms) => {\n const newMs = await tx.markScheme.create({\n data: { classId: createdClass.id, structured: ms.structured },\n });\n oldMarkSchemeIdToNew.set(ms.id, newMs.id);\n return newMs;\n })\n );\n\n const gradingBoundaries = (classData as unknown as Class & { gradingBoundaries: GradingBoundary[] }).gradingBoundaries ?? [];\n await Promise.all(\n gradingBoundaries.map(async (gb) => {\n const newGb = await tx.gradingBoundary.create({\n data: { classId: createdClass.id, structured: gb.structured },\n });\n oldGradingBoundaryIdToNew.set(gb.id, newGb.id);\n return newGb;\n })\n );\n\n const worksheets = (classData as unknown as Class & { worksheets: Array<Worksheet & { questions: WorksheetQuestion[] }> }).worksheets ?? [];\n for (const worksheet of worksheets) {\n const newWorksheet = await tx.worksheet.create({\n data: {\n name: worksheet.name,\n classId: createdClass.id,\n questions: {\n create: (worksheet.questions ?? []).map((q, i) => ({\n type: q.type,\n question: q.question,\n answer: q.answer,\n points: q.points ?? 0,\n options: q.options ?? {},\n markScheme: q.markScheme ?? {},\n order: q.order ?? i,\n })),\n },\n },\n });\n oldWorksheetIdToNew.set(worksheet.id, newWorksheet.id);\n }\n\n const assignments = (classData as unknown as Class & { assignments: Array<Assignment & { worksheets?: { id: string }[] }> }).assignments ?? [];\n for (const assignment of assignments) {\n const date = new Date(assignment.dueDate);\n date.setFullYear(year);\n const worksheetIds = (assignment as { worksheets?: { id: string }[] }).worksheets?.map((w) => oldWorksheetIdToNew.get(w.id)).filter(Boolean) as string[] | undefined;\n await tx.assignment.create({\n data: {\n title: assignment.title,\n type: assignment.type,\n dueDate: date,\n instructions: assignment.instructions,\n teacherId: userId,\n classId: createdClass.id,\n sectionId: assignment.sectionId ? oldSectionIdToNew.get(assignment.sectionId) ?? undefined : undefined,\n markSchemeId: assignment.markSchemeId ? oldMarkSchemeIdToNew.get(assignment.markSchemeId) ?? undefined : undefined,\n gradingBoundaryId: assignment.gradingBoundaryId ? oldGradingBoundaryIdToNew.get(assignment.gradingBoundaryId) ?? undefined : undefined,\n weight: assignment.weight ?? 1,\n maxGrade: assignment.maxGrade ?? 0,\n graded: assignment.graded ?? false,\n inProgress: assignment.inProgress ?? false,\n template: assignment.template ?? false,\n acceptFiles: assignment.acceptFiles ?? false,\n acceptExtendedResponse: assignment.acceptExtendedResponse ?? false,\n acceptWorksheet: assignment.acceptWorksheet ?? false,\n gradeWithAI: assignment.gradeWithAI ?? false,\n aiPolicyLevel: assignment.aiPolicyLevel ?? 0,\n ...(worksheetIds?.length && { worksheets: { connect: worksheetIds.map((id) => ({ id })) } }),\n },\n });\n }\n\n if (classData.classFiles?.id) {\n await recursivelyCreateFiles(tx, classData.classFiles.id, createdClass.classFiles?.id, pathMap);\n }\n\n return createdClass.id;\n }, { timeout: 30000 });\n\n return newClassId;\n}\n"],"names":[],"mappings":"AACA;;;GAGG;;;AAEH,OAAO,EAAmE,WAAW,EAAa,MAAM,gBAAgB,CAAC;AAGzH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AAErB,MAAM,qBAAqB,GAAG;IAC5B,WAAW,EAAE;QACX,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK;SAChB;QACD,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,WAAW,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,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;oBAC9B,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;oBAClC,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,KAAK;oBAClC,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,KAAK;oBAC1C,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,KAAK;oBACtC,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,KAAK;oBAC5C,sBAAsB,EAAE,UAAU,CAAC,sBAAsB,IAAI,KAAK;oBAClE,eAAe,EAAE,UAAU,CAAC,eAAe,IAAI,KAAK;oBACpD,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,KAAK;oBAC5C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,CAAC;oBAC5C,GAAG,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;iBAC7F;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,SAAS,CAAC,UAAU,EAAE,EAAE,EAAE,CAAC;YAC7B,MAAM,sBAAsB,CAAC,EAAE,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,EAAE,YAAY,CAAC,UAAU,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAClG,CAAC;QAED,OAAO,YAAY,CAAC,EAAE,CAAC;IACzB,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvB,OAAO,UAAU,CAAC;AACpB,CAAC","debug_id":"964a7e54-f2fa-5229-8330-925e025a577f"}
|
package/dist/models/comment.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const commentSelect: {
|
|
|
5
5
|
readonly assignmentId: true;
|
|
6
6
|
readonly submissionId: true;
|
|
7
7
|
readonly parentCommentId: true;
|
|
8
|
+
readonly isPinned: true;
|
|
8
9
|
readonly createdAt: true;
|
|
9
10
|
readonly modifiedAt: true;
|
|
10
11
|
readonly author: {
|
|
@@ -61,6 +62,7 @@ export declare function findCommentById(id: string): import(".prisma/client").Pr
|
|
|
61
62
|
modifiedAt: Date | null;
|
|
62
63
|
content: string;
|
|
63
64
|
parentCommentId: string | null;
|
|
65
|
+
isPinned: boolean;
|
|
64
66
|
author: {
|
|
65
67
|
id: string;
|
|
66
68
|
username: string;
|
|
@@ -98,6 +100,7 @@ export declare function findRepliesByCommentId(commentId: string): import(".pris
|
|
|
98
100
|
content: string;
|
|
99
101
|
authorId: string;
|
|
100
102
|
parentCommentId: string | null;
|
|
103
|
+
isPinned: boolean;
|
|
101
104
|
studentQuestionProgressId: string | null;
|
|
102
105
|
})[]>;
|
|
103
106
|
/** Create a comment (reply). */
|
|
@@ -119,6 +122,7 @@ export declare function createComment(data: {
|
|
|
119
122
|
content: string;
|
|
120
123
|
authorId: string;
|
|
121
124
|
parentCommentId: string | null;
|
|
125
|
+
isPinned: boolean;
|
|
122
126
|
studentQuestionProgressId: string | null;
|
|
123
127
|
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
124
128
|
datasources: {
|
|
@@ -207,6 +211,7 @@ export declare function findCommentWithAnnouncement(commentId: string): import("
|
|
|
207
211
|
content: string;
|
|
208
212
|
authorId: string;
|
|
209
213
|
parentCommentId: string | null;
|
|
214
|
+
isPinned: boolean;
|
|
210
215
|
studentQuestionProgressId: string | null;
|
|
211
216
|
}) | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
212
217
|
datasources: {
|
|
@@ -378,6 +383,7 @@ export declare function findCommentWithContext(commentId: string): import(".pris
|
|
|
378
383
|
content: string;
|
|
379
384
|
authorId: string;
|
|
380
385
|
parentCommentId: string | null;
|
|
386
|
+
isPinned: boolean;
|
|
381
387
|
studentQuestionProgressId: string | null;
|
|
382
388
|
}) | null;
|
|
383
389
|
} & {
|
|
@@ -390,6 +396,7 @@ export declare function findCommentWithContext(commentId: string): import(".pris
|
|
|
390
396
|
content: string;
|
|
391
397
|
authorId: string;
|
|
392
398
|
parentCommentId: string | null;
|
|
399
|
+
isPinned: boolean;
|
|
393
400
|
studentQuestionProgressId: string | null;
|
|
394
401
|
}) | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
395
402
|
datasources: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.d.ts","sourceRoot":"/","sources":["models/comment.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"/","sources":["models/comment.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyChB,CAAC;AAmBX,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKzC;AAED,qCAAqC;AACrC,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;MAmBvD;AAED,gCAAgC;AAChC,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,yBAAyB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3C;;;;;;;;;;;;;;;;;;GAIA;AAED,6CAA6C;AAC7C,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;GAM7E;AAED,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;;;;;;;;;;;;;;;;;;;;;;;;;GA0BA;AAED,yBAAyB;AACzB,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;GAI5C;AAED,kDAAkD;AAClD,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;GAO5D;AAED,wEAAwE;AACxE,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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]="6bc45608-cd32-5d3e-ae63-a06b1f3dacef")}catch(e){}}();
|
|
6
6
|
import { prisma } from "../lib/prisma.js";
|
|
7
7
|
export const commentSelect = {
|
|
8
8
|
id: true,
|
|
@@ -11,6 +11,7 @@ export const commentSelect = {
|
|
|
11
11
|
assignmentId: true,
|
|
12
12
|
submissionId: true,
|
|
13
13
|
parentCommentId: true,
|
|
14
|
+
isPinned: true,
|
|
14
15
|
createdAt: true,
|
|
15
16
|
modifiedAt: true,
|
|
16
17
|
author: {
|
|
@@ -261,4 +262,4 @@ export function getReactionCountsByCommentId(commentId) {
|
|
|
261
262
|
});
|
|
262
263
|
}
|
|
263
264
|
//# sourceMappingURL=comment.js.map
|
|
264
|
-
//# debugId=
|
|
265
|
+
//# debugId=6bc45608-cd32-5d3e-ae63-a06b1f3dacef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.js","sources":["models/comment.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Comment model – comments, replies, and reactions.\n */\nimport { prisma } from \"../lib/prisma.js\";\nimport type { ReactionType } from \"@prisma/client\";\n\nexport const commentSelect = {\n id: true,\n content: true,\n announcementId: true,\n assignmentId: true,\n submissionId: true,\n parentCommentId: true,\n createdAt: true,\n modifiedAt: true,\n author: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n reactions: {\n select: {\n type: true,\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n },\n} as const;\n\nconst commentClassAuthSelect = {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n school: {\n select: {\n 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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qBACF;oBACD,UAAU,EAAE;wBACV,MAAM,EAAE;4BACN,SAAS,EAAE,IAAI;4BACf,UAAU,EAAE;gCACV,MAAM,EAAE;oCACN,KAAK,EAAE;wCACL,MAAM,EAAE,sBAAsB;qCAC/B;iCACF;6BACF;yBACF;qBACF;oBACD,uBAAuB,EAAE;wBACvB,MAAM,EAAE;4BACN,SAAS,EAAE,IAAI;4BACf,wBAAwB,EAAE;gCACxB,MAAM,EAAE;oCACN,UAAU,EAAE;wCACV,MAAM,EAAE;4CACN,SAAS,EAAE,IAAI;4CACf,UAAU,EAAE;gDACV,MAAM,EAAE;oDACN,KAAK,EAAE;wDACL,MAAM,EAAE,sBAAsB;qDAC/B;iDACF;6CACF;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,4BAA4B,CAAC,SAAiB;IAC5D,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC7B,EAAE,EAAE,CAAC,MAAM,CAAC;QACZ,KAAK,EAAE,EAAE,SAAS,EAAE;QACpB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KACvB,CAAC,CAAC;AACL,CAAC","debug_id":"8dbc1c18-53a6-535e-8af0-25c781796a36"}
|
|
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 isPinned: true,\n createdAt: true,\n modifiedAt: true,\n author: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n reactions: {\n select: {\n type: true,\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n },\n} as const;\n\nconst commentClassAuthSelect = {\n id: true,\n teachers: { select: { id: true } },\n students: { select: { id: true } },\n school: {\n select: {\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n} as const;\n\n/** @returns Comment by ID with author and reactions. */\nexport function findCommentById(id: string) {\n return prisma.comment.findUnique({\n where: { id },\n select: commentSelect,\n });\n}\n\n/** @returns Replies to a comment. */\nexport function findRepliesByCommentId(commentId: string) {\n return prisma.comment.findMany({\n where: { parentCommentId: commentId },\n include: {\n author: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n });\n}\n\n/** Create a comment (reply). */\nexport function createComment(data: {\n parentCommentId: string;\n content: string;\n authorId: string;\n announcementId?: string | null;\n assignmentId?: string | null;\n submissionId?: string | null;\n studentQuestionProgressId?: string | null;\n}) {\n return prisma.comment.create({\n data,\n });\n}\n\n/** @returns User's reaction on a comment. */\nexport function findReactionByUserAndComment(userId: string, commentId: string) {\n return prisma.reaction.findUnique({\n where: {\n userId_commentId: { userId, commentId },\n },\n });\n}\n\n/** Add or update reaction on a comment. */\nexport function upsertReaction(data: {\n userId: string;\n commentId: string;\n type: string;\n}) {\n return prisma.reaction.upsert({\n where: {\n userId_commentId: {\n userId: data.userId,\n commentId: data.commentId,\n },\n },\n update: { type: data.type as ReactionType },\n create: { ...data, type: data.type as ReactionType },\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n },\n },\n },\n });\n}\n\n/** Delete a reaction. */\nexport function deleteReactionById(id: string) {\n return prisma.reaction.delete({\n where: { id },\n });\n}\n\n/** @returns Comment with announcement classId. */\nexport function findCommentWithAnnouncement(commentId: string) {\n return prisma.comment.findUnique({\n where: { id: commentId },\n include: {\n announcement: { select: { classId: true } },\n },\n });\n}\n\n/** @returns Comment with the owning class context for authorization. */\nexport function findCommentWithContext(commentId: string) {\n return prisma.comment.findUnique({\n where: { id: commentId },\n include: {\n announcement: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n studentQuestionProgress: {\n select: {\n studentId: true,\n studentWorksheetResponse: {\n select: {\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n parentComment: {\n include: {\n announcement: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n studentQuestionProgress: {\n select: {\n studentId: true,\n studentWorksheetResponse: {\n select: {\n submission: {\n select: {\n studentId: true,\n assignment: {\n select: {\n class: {\n select: commentClassAuthSelect,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Reaction counts by type for a comment. */\nexport function getReactionCountsByCommentId(commentId: string) {\n return prisma.reaction.groupBy({\n by: [\"type\"],\n where: { commentId },\n _count: { type: true },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,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
|
@@ -213,6 +213,23 @@ export declare function hideConversationMember(userId: string, conversationId: s
|
|
|
213
213
|
};
|
|
214
214
|
};
|
|
215
215
|
}>;
|
|
216
|
+
/** Unhide a conversation for a single member. */
|
|
217
|
+
export declare function unhideConversationMember(userId: string, conversationId: string): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
|
|
218
|
+
id: string;
|
|
219
|
+
userId: string;
|
|
220
|
+
role: import(".prisma/client").$Enums.ConversationRole;
|
|
221
|
+
conversationId: string;
|
|
222
|
+
joinedAt: Date;
|
|
223
|
+
hiddenAt: Date | null;
|
|
224
|
+
lastViewedAt: Date | null;
|
|
225
|
+
lastViewedMentionAt: Date | null;
|
|
226
|
+
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
227
|
+
datasources: {
|
|
228
|
+
db: {
|
|
229
|
+
url: string;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
}>;
|
|
216
233
|
/** Remove a member from a conversation. */
|
|
217
234
|
export declare function deleteConversationMember(userId: string, conversationId: string): import(".prisma/client").Prisma.Prisma__ConversationMemberClient<{
|
|
218
235
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"/","sources":["models/conversation.ts"],"names":[],"mappings":"AAmCA,mEAAmE;AACnE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQvD;AAED,sDAAsD;AACtD,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,IAAI,yDASb;AAED,sDAAsD;AACtD,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,IAAI,yDAYb;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM;;;;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;;;;;;;;;;;;;GAQA;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;;;;;;;;;;;;;;;GAS5E;AAED,iDAAiD;AACjD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;;;;;;;;;;;;;;;GAS9E;AAED,2CAA2C;AAC3C,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;;;;;;;;;;;;;;;GAM9E"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Conversation model – DM/group conversations, members, unread counts.
|
|
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]="2295b446-148c-59a6-bc18-dc7afb38d77f")}catch(e){}}();
|
|
6
6
|
import { prisma } from "../lib/prisma.js";
|
|
7
7
|
const conversationListInclude = {
|
|
8
8
|
labChat: { select: { id: true, title: true } },
|
|
@@ -222,6 +222,17 @@ export function hideConversationMember(userId, conversationId) {
|
|
|
222
222
|
},
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
+
/** Unhide a conversation for a single member. */
|
|
226
|
+
export function unhideConversationMember(userId, conversationId) {
|
|
227
|
+
return prisma.conversationMember.update({
|
|
228
|
+
where: {
|
|
229
|
+
userId_conversationId: { userId, conversationId },
|
|
230
|
+
},
|
|
231
|
+
data: {
|
|
232
|
+
hiddenAt: null,
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
}
|
|
225
236
|
/** Remove a member from a conversation. */
|
|
226
237
|
export function deleteConversationMember(userId, conversationId) {
|
|
227
238
|
return prisma.conversationMember.delete({
|
|
@@ -231,4 +242,4 @@ export function deleteConversationMember(userId, conversationId) {
|
|
|
231
242
|
});
|
|
232
243
|
}
|
|
233
244
|
//# sourceMappingURL=conversation.js.map
|
|
234
|
-
//# debugId=
|
|
245
|
+
//# debugId=2295b446-148c-59a6-bc18-dc7afb38d77f
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sources":["models/conversation.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Conversation model – DM/group conversations, members, unread counts.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\nconst conversationListInclude = {\n labChat: { select: { id: true, title: true } },\n members: {\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: { displayName: true, profilePicture: true },\n },\n },\n },\n },\n },\n messages: {\n orderBy: { createdAt: \"desc\" as const },\n take: 1,\n include: {\n sender: {\n select: {\n id: true,\n username: true,\n profile: { select: { displayName: true } },\n },\n },\n },\n },\n};\n\n/** @returns User's conversations with members and last message. */\nexport function findConversationsByUserId(userId: string) {\n return prisma.conversation.findMany({\n where: {\n members: { some: { userId } },\n },\n include: conversationListInclude,\n orderBy: { updatedAt: \"desc\" },\n });\n}\n\n/** Count unread messages in conversation for user. */\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 unread mentions for user in conversation. */\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\n/** @returns User by username (id, username only). */\nexport function findUserByUsername(username: string) {\n return prisma.user.findFirst({\n where: { username },\n select: { id: true, username: true },\n });\n}\n\n/**\n * Search users who share at least one active school membership with the\n * requester and match the query by username or profile display name.\n *\n * The requester is always excluded so the result set can be used directly as\n * conversation member suggestions.\n */\nexport async function searchInstitutionConversationMembers(\n userId: string,\n query: string,\n limit: number\n) {\n const memberships = await prisma.schoolMembership.findMany({\n where: { userId, status: \"ACTIVE\" },\n select: { schoolId: true },\n });\n const schoolIds = memberships.map((membership) => membership.schoolId);\n\n if (schoolIds.length === 0) return [];\n\n return prisma.user.findMany({\n where: {\n id: { not: userId },\n schoolMemberships: {\n some: {\n schoolId: { in: schoolIds },\n status: \"ACTIVE\",\n },\n },\n OR: [\n { username: { contains: query, mode: \"insensitive\" } },\n {\n profile: {\n is: { displayName: { contains: query, mode: \"insensitive\" } },\n },\n },\n ],\n },\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 orderBy: { username: \"asc\" },\n take: limit,\n });\n}\n\n/** @returns User's DM conversations. */\nexport function findDmConversationsByUserId(userId: string) {\n return prisma.conversation.findMany({\n where: {\n type: \"DM\",\n members: { some: { userId } },\n },\n include: {\n members: { select: { userId: true } },\n },\n });\n}\n\n/** @returns Users by IDs or usernames. */\nexport function findUsersByIdsOrUsernames(identifiers: string[]) {\n if (identifiers.length === 0) return Promise.resolve([]);\n return prisma.user.findMany({\n where: {\n OR: [\n { id: { in: identifiers } },\n { username: { in: identifiers } },\n ],\n },\n select: { id: true, username: true },\n });\n}\n\n/** Create a DM or group conversation with members. */\nexport function createConversation(data: {\n type: \"DM\" | \"GROUP\";\n name?: string;\n members: { userId: string; role: string }[];\n}) {\n return prisma.conversation.create({\n data: {\n type: data.type,\n name: data.name,\n members: {\n create: data.members.map((m) => ({\n userId: m.userId,\n role: m.role as \"ADMIN\" | \"MEMBER\",\n })),\n },\n },\n include: {\n members: {\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: { displayName: true, profilePicture: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Conversation if user is a member. */\nexport function findConversationByIdAndMember(\n conversationId: string,\n userId: string\n) {\n return prisma.conversation.findFirst({\n where: {\n id: conversationId,\n members: { some: { userId } },\n },\n include: {\n members: {\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: { displayName: true, profilePicture: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** Add a member to a conversation. */\nexport function createConversationMember(data: {\n userId: string;\n conversationId: string;\n role: string;\n}) {\n return prisma.conversationMember.create({\n data: {\n userId: data.userId,\n conversationId: data.conversationId,\n role: data.role as \"ADMIN\" | \"MEMBER\",\n },\n });\n}\n\n/** Hide a conversation for a single member until new activity occurs. */\nexport function hideConversationMember(userId: string, conversationId: string) {\n return prisma.conversationMember.update({\n where: {\n userId_conversationId: { userId, conversationId },\n },\n data: {\n hiddenAt: new Date(),\n },\n });\n}\n\n/** Remove a member from a conversation. */\nexport function deleteConversationMember(userId: string, conversationId: string) {\n return prisma.conversationMember.delete({\n where: {\n userId_conversationId: { userId, conversationId },\n },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,uBAAuB,GAAG;IAC9B,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAC9C,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,MAAM,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE;wBACP,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;qBACpD;iBACF;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,SAAS,EAAE,MAAe,EAAE;QACvC,IAAI,EAAE,CAAC;QACP,OAAO,EAAE;YACP,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;AACL,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,sBAAsB,CAAC,MAAc,EAAE,cAAsB;IAC3E,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACtC,KAAK,EAAE;YACL,qBAAqB,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;SAClD;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,IAAI,IAAI,EAAE;SACrB;KACF,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,wBAAwB,CAAC,MAAc,EAAE,cAAsB;IAC7E,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACtC,KAAK,EAAE;YACL,qBAAqB,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;SAClD;KACF,CAAC,CAAC;AACL,CAAC","debug_id":"14c80725-5a2b-5e37-aa01-49cb94535659"}
|
|
1
|
+
{"version":3,"file":"conversation.js","sources":["models/conversation.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Conversation model – DM/group conversations, members, unread counts.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\nconst conversationListInclude = {\n labChat: { select: { id: true, title: true } },\n members: {\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: { displayName: true, profilePicture: true },\n },\n },\n },\n },\n },\n messages: {\n orderBy: { createdAt: \"desc\" as const },\n take: 1,\n include: {\n sender: {\n select: {\n id: true,\n username: true,\n profile: { select: { displayName: true } },\n },\n },\n },\n },\n};\n\n/** @returns User's conversations with members and last message. */\nexport function findConversationsByUserId(userId: string) {\n return prisma.conversation.findMany({\n where: {\n members: { some: { userId } },\n },\n include: conversationListInclude,\n orderBy: { updatedAt: \"desc\" },\n });\n}\n\n/** Count unread messages in conversation for user. */\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 unread mentions for user in conversation. */\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\n/** @returns User by username (id, username only). */\nexport function findUserByUsername(username: string) {\n return prisma.user.findFirst({\n where: { username },\n select: { id: true, username: true },\n });\n}\n\n/**\n * Search users who share at least one active school membership with the\n * requester and match the query by username or profile display name.\n *\n * The requester is always excluded so the result set can be used directly as\n * conversation member suggestions.\n */\nexport async function searchInstitutionConversationMembers(\n userId: string,\n query: string,\n limit: number\n) {\n const memberships = await prisma.schoolMembership.findMany({\n where: { userId, status: \"ACTIVE\" },\n select: { schoolId: true },\n });\n const schoolIds = memberships.map((membership) => membership.schoolId);\n\n if (schoolIds.length === 0) return [];\n\n return prisma.user.findMany({\n where: {\n id: { not: userId },\n schoolMemberships: {\n some: {\n schoolId: { in: schoolIds },\n status: \"ACTIVE\",\n },\n },\n OR: [\n { username: { contains: query, mode: \"insensitive\" } },\n {\n profile: {\n is: { displayName: { contains: query, mode: \"insensitive\" } },\n },\n },\n ],\n },\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 orderBy: { username: \"asc\" },\n take: limit,\n });\n}\n\n/** @returns User's DM conversations. */\nexport function findDmConversationsByUserId(userId: string) {\n return prisma.conversation.findMany({\n where: {\n type: \"DM\",\n members: { some: { userId } },\n },\n include: {\n members: { select: { userId: true } },\n },\n });\n}\n\n/** @returns Users by IDs or usernames. */\nexport function findUsersByIdsOrUsernames(identifiers: string[]) {\n if (identifiers.length === 0) return Promise.resolve([]);\n return prisma.user.findMany({\n where: {\n OR: [\n { id: { in: identifiers } },\n { username: { in: identifiers } },\n ],\n },\n select: { id: true, username: true },\n });\n}\n\n/** Create a DM or group conversation with members. */\nexport function createConversation(data: {\n type: \"DM\" | \"GROUP\";\n name?: string;\n members: { userId: string; role: string }[];\n}) {\n return prisma.conversation.create({\n data: {\n type: data.type,\n name: data.name,\n members: {\n create: data.members.map((m) => ({\n userId: m.userId,\n role: m.role as \"ADMIN\" | \"MEMBER\",\n })),\n },\n },\n include: {\n members: {\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: { displayName: true, profilePicture: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Conversation if user is a member. */\nexport function findConversationByIdAndMember(\n conversationId: string,\n userId: string\n) {\n return prisma.conversation.findFirst({\n where: {\n id: conversationId,\n members: { some: { userId } },\n },\n include: {\n members: {\n include: {\n user: {\n select: {\n id: true,\n username: true,\n profile: {\n select: { displayName: true, profilePicture: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** Add a member to a conversation. */\nexport function createConversationMember(data: {\n userId: string;\n conversationId: string;\n role: string;\n}) {\n return prisma.conversationMember.create({\n data: {\n userId: data.userId,\n conversationId: data.conversationId,\n role: data.role as \"ADMIN\" | \"MEMBER\",\n },\n });\n}\n\n/** Hide a conversation for a single member until new activity occurs. */\nexport function hideConversationMember(userId: string, conversationId: string) {\n return prisma.conversationMember.update({\n where: {\n userId_conversationId: { userId, conversationId },\n },\n data: {\n hiddenAt: new Date(),\n },\n });\n}\n\n/** Unhide a conversation for a single member. */\nexport function unhideConversationMember(userId: string, conversationId: string) {\n return prisma.conversationMember.update({\n where: {\n userId_conversationId: { userId, conversationId },\n },\n data: {\n hiddenAt: null,\n },\n });\n}\n\n/** Remove a member from a conversation. */\nexport function deleteConversationMember(userId: string, conversationId: string) {\n return prisma.conversationMember.delete({\n where: {\n userId_conversationId: { userId, conversationId },\n },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,uBAAuB,GAAG;IAC9B,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,E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AAW,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;6BACpD;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,wBAAwB,CAAC,IAIxC;IACC,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACtC,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,IAAI,EAAE,IAAI,CAAC,IAA0B;SACtC;KACF,CAAC,CAAC;AACL,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,sBAAsB,CAAC,MAAc,EAAE,cAAsB;IAC3E,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACtC,KAAK,EAAE;YACL,qBAAqB,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;SAClD;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,IAAI,IAAI,EAAE;SACrB;KACF,CAAC,CAAC;AACL,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,wBAAwB,CAAC,MAAc,EAAE,cAAsB;IAC7E,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACtC,KAAK,EAAE;YACL,qBAAqB,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;SAClD;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,IAAI;SACf;KACF,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,wBAAwB,CAAC,MAAc,EAAE,cAAsB;IAC7E,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACtC,KAAK,EAAE;YACL,qBAAqB,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;SAClD;KACF,CAAC,CAAC;AACL,CAAC","debug_id":"2295b446-148c-59a6-bc18-dc7afb38d77f"}
|
|
@@ -437,6 +437,7 @@ export declare function findWorksheetResponseBySubmissionAndWorksheet(submission
|
|
|
437
437
|
responses: ({
|
|
438
438
|
comments: {
|
|
439
439
|
id: string;
|
|
440
|
+
isPinned: boolean;
|
|
440
441
|
}[];
|
|
441
442
|
} & {
|
|
442
443
|
status: import(".prisma/client").$Enums.JobStatus | null;
|
|
@@ -474,6 +475,7 @@ export declare function findOrCreateWorksheetResponse(submissionId: string, work
|
|
|
474
475
|
responses: ({
|
|
475
476
|
comments: {
|
|
476
477
|
id: string;
|
|
478
|
+
isPinned: boolean;
|
|
477
479
|
}[];
|
|
478
480
|
} & {
|
|
479
481
|
status: import(".prisma/client").$Enums.JobStatus | null;
|
|
@@ -509,6 +511,7 @@ export declare function createWorksheetResponse(data: {
|
|
|
509
511
|
responses: ({
|
|
510
512
|
comments: {
|
|
511
513
|
id: string;
|
|
514
|
+
isPinned: boolean;
|
|
512
515
|
}[];
|
|
513
516
|
} & {
|
|
514
517
|
status: import(".prisma/client").$Enums.JobStatus | null;
|
|
@@ -1092,6 +1095,7 @@ export declare function createComment(data: {
|
|
|
1092
1095
|
content: string;
|
|
1093
1096
|
authorId: string;
|
|
1094
1097
|
parentCommentId: string | null;
|
|
1098
|
+
isPinned: boolean;
|
|
1095
1099
|
studentQuestionProgressId: string | null;
|
|
1096
1100
|
}, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
|
|
1097
1101
|
datasources: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet.d.ts","sourceRoot":"/","sources":["models/worksheet.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAcvE,mDAAmD;AACnD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQ3C;AAED,0CAA0C;AAC1C,wBAAgB,wBAAwB,CAAC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