@studious-lms/server 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/models/class.d.ts +24 -2
  2. package/dist/models/class.d.ts.map +1 -1
  3. package/dist/models/class.js +180 -81
  4. package/dist/models/class.js.map +1 -1
  5. package/dist/models/worksheet.d.ts +34 -34
  6. package/dist/pipelines/aiLabChat.d.ts +57 -2
  7. package/dist/pipelines/aiLabChat.d.ts.map +1 -1
  8. package/dist/pipelines/aiLabChat.js +252 -113
  9. package/dist/pipelines/aiLabChat.js.map +1 -1
  10. package/dist/pipelines/gradeWorksheet.d.ts +4 -4
  11. package/dist/routers/_app.d.ts +138 -56
  12. package/dist/routers/_app.d.ts.map +1 -1
  13. package/dist/routers/class.d.ts +24 -3
  14. package/dist/routers/class.d.ts.map +1 -1
  15. package/dist/routers/class.js +3 -3
  16. package/dist/routers/class.js.map +1 -1
  17. package/dist/routers/labChat.d.ts +10 -1
  18. package/dist/routers/labChat.d.ts.map +1 -1
  19. package/dist/routers/labChat.js +6 -3
  20. package/dist/routers/labChat.js.map +1 -1
  21. package/dist/routers/message.d.ts +11 -0
  22. package/dist/routers/message.d.ts.map +1 -1
  23. package/dist/routers/message.js +10 -3
  24. package/dist/routers/message.js.map +1 -1
  25. package/dist/routers/worksheet.d.ts +24 -24
  26. package/dist/services/class.d.ts +24 -2
  27. package/dist/services/class.d.ts.map +1 -1
  28. package/dist/services/class.js +18 -6
  29. package/dist/services/class.js.map +1 -1
  30. package/dist/services/labChat.d.ts +5 -1
  31. package/dist/services/labChat.d.ts.map +1 -1
  32. package/dist/services/labChat.js +96 -4
  33. package/dist/services/labChat.js.map +1 -1
  34. package/dist/services/message.d.ts +8 -0
  35. package/dist/services/message.d.ts.map +1 -1
  36. package/dist/services/message.js +74 -2
  37. package/dist/services/message.js.map +1 -1
  38. package/dist/services/worksheet.d.ts +18 -18
  39. package/package.json +1 -1
  40. package/prisma/schema.prisma +1 -1
  41. package/src/models/class.ts +189 -84
  42. package/src/pipelines/aiLabChat.ts +291 -118
  43. package/src/routers/class.ts +1 -1
  44. package/src/routers/labChat.ts +7 -0
  45. package/src/routers/message.ts +13 -0
  46. package/src/services/class.ts +14 -7
  47. package/src/services/labChat.ts +108 -2
  48. package/src/services/message.ts +93 -0
@@ -380,18 +380,32 @@ export declare function findFullExportableClass(classId: string): Promise<{
380
380
  type: import(".prisma/client").$Enums.AssignmentType;
381
381
  id: string;
382
382
  createdAt: Date | null;
383
+ classId: string;
383
384
  section: {
384
385
  id: string;
385
386
  name: string;
386
387
  } | null;
388
+ worksheets: {
389
+ id: string;
390
+ }[];
387
391
  title: string;
388
392
  dueDate: Date;
389
393
  maxGrade: number | null;
394
+ eventId: string | null;
390
395
  instructions: string;
396
+ teacherId: string;
397
+ acceptFiles: boolean;
398
+ acceptExtendedResponse: boolean;
399
+ acceptWorksheet: boolean;
400
+ gradeWithAI: boolean;
401
+ aiPolicyLevel: number;
402
+ sectionId: string | null;
391
403
  graded: boolean;
392
404
  weight: number;
393
405
  inProgress: boolean;
406
+ markSchemeId: string | null;
394
407
  order: number | null;
408
+ gradingBoundaryId: string | null;
395
409
  markScheme: {
396
410
  id: string;
397
411
  structured: string;
@@ -410,10 +424,18 @@ export declare function findFullExportableClass(classId: string): Promise<{
410
424
  }[];
411
425
  worksheets: {
412
426
  id: string;
413
- createdAt: Date;
414
- updatedAt: Date;
415
427
  classId: string;
416
428
  name: string;
429
+ questions: {
430
+ options: import("@prisma/client/runtime/library.js").JsonValue;
431
+ type: import(".prisma/client").$Enums.WorksheetQuestionType;
432
+ order: number | null;
433
+ markScheme: import("@prisma/client/runtime/library.js").JsonValue;
434
+ worksheetId: string;
435
+ question: string;
436
+ answer: string;
437
+ points: number;
438
+ }[];
417
439
  }[];
418
440
  markSchemes: {
419
441
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"class.d.ts","sourceRoot":"/","sources":["models/class.ts"],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;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiDvD;AAoGD,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoF5D;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,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"}
@@ -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]="54432db2-f825-5389-b87d-93bdbf37bcf2")}catch(e){}}();
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]="a5a21161-a4bb-58bf-9c4b-a48cc39cfbdb")}catch(e){}}();
7
7
  import { prisma } from "../lib/prisma.js";
8
8
  import { v4 as uuidv4 } from 'uuid';
9
9
  import { copyFile } from "../lib/googleCloudStorage.js";
@@ -386,29 +386,48 @@ async function recursivelyIncludeFiles(folderId) {
386
386
  childFolders: await Promise.all(folder.childFolders.map(folder => recursivelyIncludeFiles(folder.id))),
387
387
  };
388
388
  }
389
- async function recursivelyCreateFiles(tx, folderId, targetFolderId) {
390
- if (!folderId.length) {
391
- return null;
392
- }
393
- const parentFolder = await tx.folder.findUnique({
389
+ /** Copy all files in folder tree to GCS (outside transaction). Returns map of sourcePath -> newPath. */
390
+ async function recursivelyCopyFilesToGcs(folderId) {
391
+ const pathMap = new Map();
392
+ if (!folderId.length)
393
+ return pathMap;
394
+ const folder = await prisma.folder.findUnique({
394
395
  where: { id: folderId },
395
396
  include: {
396
- files: {
397
- select: { id: true, name: true, type: true, size: true, path: true },
398
- },
399
- childFolders: {
400
- select: { id: true, name: true, color: true, parentFolderId: true },
401
- },
397
+ files: { select: { path: true, name: true } },
398
+ childFolders: { select: { id: true } },
402
399
  },
403
400
  });
404
- if (!parentFolder) {
405
- return null;
406
- }
407
- const createdFiles = { count: 0 };
408
- for (const file of parentFolder.files) {
401
+ if (!folder)
402
+ return pathMap;
403
+ for (const file of folder.files) {
409
404
  const ext = file.name.split('.').pop() || '';
410
405
  const newPath = `imported/${uuidv4()}${ext ? `.${ext}` : ''}`;
411
406
  await copyFile(file.path, newPath);
407
+ pathMap.set(file.path, newPath);
408
+ }
409
+ for (const child of folder.childFolders) {
410
+ const childMap = await recursivelyCopyFilesToGcs(child.id);
411
+ childMap.forEach((v, k) => pathMap.set(k, v));
412
+ }
413
+ return pathMap;
414
+ }
415
+ async function recursivelyCreateFiles(tx, folderId, targetFolderId, pathMap) {
416
+ if (!folderId.length)
417
+ return;
418
+ const parentFolder = await tx.folder.findUnique({
419
+ where: { id: folderId },
420
+ include: {
421
+ files: { select: { id: true, name: true, type: true, size: true, path: true } },
422
+ childFolders: { select: { id: true, name: true, color: true, parentFolderId: true } },
423
+ },
424
+ });
425
+ if (!parentFolder)
426
+ return;
427
+ for (const file of parentFolder.files) {
428
+ const newPath = pathMap.get(file.path);
429
+ if (!newPath)
430
+ continue;
412
431
  await tx.file.create({
413
432
  data: {
414
433
  name: file.name,
@@ -419,9 +438,7 @@ async function recursivelyCreateFiles(tx, folderId, targetFolderId) {
419
438
  ...(targetFolderId && { folder: { connect: { id: targetFolderId } } }),
420
439
  },
421
440
  });
422
- createdFiles.count += 1;
423
441
  }
424
- const childFolders = [];
425
442
  for (const childFolder of parentFolder.childFolders) {
426
443
  const newFolder = await tx.folder.create({
427
444
  data: {
@@ -430,14 +447,8 @@ async function recursivelyCreateFiles(tx, folderId, targetFolderId) {
430
447
  parentFolderId: targetFolderId ?? parentFolder.id,
431
448
  },
432
449
  });
433
- const result = await recursivelyCreateFiles(tx, childFolder.id, newFolder.id);
434
- if (result)
435
- childFolders.push(result);
450
+ await recursivelyCreateFiles(tx, childFolder.id, newFolder.id, pathMap);
436
451
  }
437
- return {
438
- files: createdFiles,
439
- childFolders,
440
- };
441
452
  }
442
453
  export async function findFullExportableClass(classId) {
443
454
  const baseClass = await prisma.class.findUnique({
@@ -447,6 +458,18 @@ export async function findFullExportableClass(classId) {
447
458
  select: {
448
459
  ...assignmentSelect,
449
460
  submissions: false,
461
+ worksheets: { select: { id: true } },
462
+ teacherId: true,
463
+ classId: true,
464
+ sectionId: true,
465
+ markSchemeId: true,
466
+ gradingBoundaryId: true,
467
+ eventId: true,
468
+ acceptFiles: true,
469
+ acceptExtendedResponse: true,
470
+ acceptWorksheet: true,
471
+ gradeWithAI: true,
472
+ aiPolicyLevel: true,
450
473
  },
451
474
  },
452
475
  classFiles: {
@@ -454,10 +477,48 @@ export async function findFullExportableClass(classId) {
454
477
  id: true,
455
478
  },
456
479
  },
457
- worksheets: true,
458
- markSchemes: true,
459
- gradingBoundaries: true,
460
- sections: true,
480
+ worksheets: {
481
+ select: {
482
+ id: true,
483
+ name: true,
484
+ classId: true,
485
+ questions: {
486
+ select: {
487
+ type: true,
488
+ question: true,
489
+ answer: true,
490
+ points: true,
491
+ options: true,
492
+ markScheme: true,
493
+ order: true,
494
+ worksheetId: true,
495
+ },
496
+ },
497
+ },
498
+ },
499
+ markSchemes: {
500
+ select: {
501
+ id: true,
502
+ classId: true,
503
+ structured: true,
504
+ },
505
+ },
506
+ gradingBoundaries: {
507
+ select: {
508
+ id: true,
509
+ classId: true,
510
+ structured: true,
511
+ },
512
+ },
513
+ sections: {
514
+ select: {
515
+ id: true,
516
+ name: true,
517
+ classId: true,
518
+ color: true,
519
+ order: true,
520
+ },
521
+ },
461
522
  },
462
523
  });
463
524
  if (!baseClass) {
@@ -471,6 +532,9 @@ export async function findFullExportableClass(classId) {
471
532
  return formattedClass;
472
533
  }
473
534
  export async function createClassByImport(classId, userId, year, classData) {
535
+ const pathMap = classData.classFiles?.id
536
+ ? await recursivelyCopyFilesToGcs(classData.classFiles.id)
537
+ : new Map();
474
538
  const newClassId = await prisma.$transaction(async (tx) => {
475
539
  const createdClass = await tx.class.create({
476
540
  data: {
@@ -486,61 +550,96 @@ export async function createClassByImport(classId, userId, year, classData) {
486
550
  classFiles: true,
487
551
  },
488
552
  });
489
- const assignments = await prisma.assignment.createMany({
490
- data: classData.assignments.map((assignment) => {
491
- const newDate = new Date(assignment.dueDate).setFullYear(year);
492
- return {
493
- ...assignment,
494
- id: assignment.id,
553
+ const oldSectionIdToNew = new Map();
554
+ const oldMarkSchemeIdToNew = new Map();
555
+ const oldGradingBoundaryIdToNew = new Map();
556
+ const oldWorksheetIdToNew = new Map();
557
+ const sections = classData.sections ?? [];
558
+ await Promise.all(sections.map(async (section, index) => {
559
+ const newSection = await tx.section.create({
560
+ data: {
561
+ name: section.name,
562
+ classId: createdClass.id,
563
+ color: section.color,
564
+ order: section.order ?? index,
565
+ },
566
+ });
567
+ oldSectionIdToNew.set(section.id, newSection.id);
568
+ return newSection;
569
+ }));
570
+ const markSchemes = classData.markSchemes ?? [];
571
+ await Promise.all(markSchemes.map(async (ms) => {
572
+ const newMs = await tx.markScheme.create({
573
+ data: { classId: createdClass.id, structured: ms.structured },
574
+ });
575
+ oldMarkSchemeIdToNew.set(ms.id, newMs.id);
576
+ return newMs;
577
+ }));
578
+ const gradingBoundaries = classData.gradingBoundaries ?? [];
579
+ await Promise.all(gradingBoundaries.map(async (gb) => {
580
+ const newGb = await tx.gradingBoundary.create({
581
+ data: { classId: createdClass.id, structured: gb.structured },
582
+ });
583
+ oldGradingBoundaryIdToNew.set(gb.id, newGb.id);
584
+ return newGb;
585
+ }));
586
+ const worksheets = classData.worksheets ?? [];
587
+ for (const worksheet of worksheets) {
588
+ const newWorksheet = await tx.worksheet.create({
589
+ data: {
590
+ name: worksheet.name,
591
+ classId: createdClass.id,
592
+ questions: {
593
+ create: (worksheet.questions ?? []).map((q, i) => ({
594
+ type: q.type,
595
+ question: q.question,
596
+ answer: q.answer,
597
+ points: q.points ?? 0,
598
+ options: q.options ?? {},
599
+ markScheme: q.markScheme ?? {},
600
+ order: q.order ?? i,
601
+ })),
602
+ },
603
+ },
604
+ });
605
+ oldWorksheetIdToNew.set(worksheet.id, newWorksheet.id);
606
+ }
607
+ const assignments = classData.assignments ?? [];
608
+ for (const assignment of assignments) {
609
+ const date = new Date(assignment.dueDate);
610
+ date.setFullYear(year);
611
+ const worksheetIds = assignment.worksheets?.map((w) => oldWorksheetIdToNew.get(w.id)).filter(Boolean);
612
+ await tx.assignment.create({
613
+ data: {
495
614
  title: assignment.title,
496
615
  type: assignment.type,
497
- dueDate: newDate,
498
- };
499
- })
500
- });
501
- const worksheets = await prisma.worksheet.createMany({
502
- data: classData.worksheets.map((worksheet) => {
503
- return {
504
- ...worksheet,
505
- id: worksheet.id,
506
- name: worksheet.name,
507
- };
508
- })
509
- });
510
- const markSchemes = await prisma.markScheme.createMany({
511
- data: classData.markSchemes.map((markScheme) => {
512
- return {
513
- ...markScheme,
514
- id: markScheme.id,
515
- structured: markScheme.structured,
516
- };
517
- })
518
- });
519
- const gradingBoundaries = await prisma.gradingBoundary.createMany({
520
- data: classData.gradingBoundaries.map((gradingBoundary) => {
521
- return {
522
- ...gradingBoundary,
523
- id: gradingBoundary.id,
524
- structured: gradingBoundary.structured,
525
- };
526
- })
527
- });
528
- const sections = await prisma.section.createMany({
529
- data: classData.sections.map((section) => {
530
- return {
531
- ...section,
532
- id: section.id,
533
- name: section.name,
534
- };
535
- })
536
- });
537
- const classFiles = await recursivelyCreateFiles(tx, classData.classFiles?.id ?? uuidv4(), createdClass.classFiles?.id);
538
- if (!classFiles) {
539
- return null;
616
+ dueDate: date,
617
+ instructions: assignment.instructions,
618
+ teacherId: userId,
619
+ classId: createdClass.id,
620
+ sectionId: assignment.sectionId ? oldSectionIdToNew.get(assignment.sectionId) ?? undefined : undefined,
621
+ markSchemeId: assignment.markSchemeId ? oldMarkSchemeIdToNew.get(assignment.markSchemeId) ?? undefined : undefined,
622
+ gradingBoundaryId: assignment.gradingBoundaryId ? oldGradingBoundaryIdToNew.get(assignment.gradingBoundaryId) ?? undefined : undefined,
623
+ weight: assignment.weight ?? 1,
624
+ maxGrade: assignment.maxGrade ?? 0,
625
+ graded: assignment.graded ?? false,
626
+ inProgress: assignment.inProgress ?? false,
627
+ template: assignment.template ?? false,
628
+ acceptFiles: assignment.acceptFiles ?? false,
629
+ acceptExtendedResponse: assignment.acceptExtendedResponse ?? false,
630
+ acceptWorksheet: assignment.acceptWorksheet ?? false,
631
+ gradeWithAI: assignment.gradeWithAI ?? false,
632
+ aiPolicyLevel: assignment.aiPolicyLevel ?? 0,
633
+ ...(worksheetIds?.length && { worksheets: { connect: worksheetIds.map((id) => ({ id })) } }),
634
+ },
635
+ });
636
+ }
637
+ if (classData.classFiles?.id) {
638
+ await recursivelyCreateFiles(tx, classData.classFiles.id, createdClass.classFiles?.id, pathMap);
540
639
  }
541
640
  return createdClass.id;
542
- });
641
+ }, { timeout: 30000 });
543
642
  return newClassId;
544
643
  }
545
644
  //# sourceMappingURL=class.js.map
546
- //# debugId=54432db2-f825-5389-b87d-93bdbf37bcf2
645
+ //# debugId=a5a21161-a4bb-58bf-9c4b-a48cc39cfbdb
@@ -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, Worksheet } from \"@prisma/client\";\nimport type { PrismaClient } from \"@prisma/client\";\n\nimport { prisma } from \"../lib/prisma.js\";\nimport { v4 as uuidv4 } from 'uuid';\nimport { copyFile } from \"../lib/googleCloudStorage.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} as const;\n\n/** @returns Classes where user is a teacher. */\nexport function findTeacherClasses(userId: string) {\n return prisma.class.findMany({\n where: { teachers: { some: { id: 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. */\nexport function isTeacherInClass(classId: string, userId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n teachers: { some: { id: 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} 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.findUnique({\n where: { id: classId },\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 },\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\nasync function recursivelyCreateFiles(\n tx: PrismaClient | Omit<PrismaClient, \"$connect\" | \"$disconnect\" | \"$on\" | \"$transaction\" | \"$use\" | \"$extends\">,\n folderId: string,\n targetFolderId?: string\n) {\n if (!folderId.length) {\n return null;\n }\n\n const parentFolder = await tx.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, name: true, color: true, parentFolderId: true },\n },\n },\n });\n if (!parentFolder) {\n return null;\n }\n\n const createdFiles: { count: number } = { count: 0 };\n for (const file of parentFolder.files) {\n const ext = file.name.split('.').pop() || '';\n const newPath = `imported/${uuidv4()}${ext ? `.${ext}` : ''}`;\n await copyFile(file.path, newPath);\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 createdFiles.count += 1;\n }\n\n const childFolders: { files: { count: number }; childFolders: unknown[] }[] = [];\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 const result = await recursivelyCreateFiles(tx, childFolder.id, newFolder.id);\n if (result) childFolders.push(result);\n }\n\n return {\n files: createdFiles,\n childFolders,\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 },\n },\n classFiles: {\n select: {\n id: true,\n },\n },\n worksheets: true,\n markSchemes: true,\n gradingBoundaries: true,\n sections: true,\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 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 assignments = await prisma.assignment.createMany({\n data: (classData as unknown as Class & { assignments: Assignment[] }).assignments.map((assignment) => {\n const newDate = new Date(assignment.dueDate).setFullYear(year);\n return {\n ...assignment,\n id: assignment.id,\n title: assignment.title,\n type: assignment.type,\n dueDate: newDate as unknown as Date,\n };\n })\n });\n\n const worksheets = await prisma.worksheet.createMany({\n data: (classData as unknown as Class & { worksheets: Worksheet[] }).worksheets.map((worksheet) => {\n return {\n ...worksheet,\n id: worksheet.id,\n name: worksheet.name,\n };\n })\n });\n\n const markSchemes = await prisma.markScheme.createMany({\n data: (classData as unknown as Class & { markSchemes: MarkScheme[] }).markSchemes.map((markScheme) => {\n return {\n ...markScheme,\n id: markScheme.id,\n structured: markScheme.structured,\n };\n })\n });\n\n const gradingBoundaries = await prisma.gradingBoundary.createMany({\n data: (classData as unknown as Class & { gradingBoundaries: GradingBoundary[] }).gradingBoundaries.map((gradingBoundary) => {\n return {\n ...gradingBoundary,\n id: gradingBoundary.id,\n structured: gradingBoundary.structured,\n };\n })\n });\n\n const sections = await prisma.section.createMany({\n data: (classData as unknown as Class & { sections: Section[] }).sections.map((section) => {\n return {\n ...section,\n id: section.id,\n name: section.name,\n };\n })\n });\n\n const classFiles = await recursivelyCreateFiles(tx, classData.classFiles?.id ?? uuidv4(), createdClass.classFiles?.id);\n if (!classFiles) {\n return null;\n }\n\n return createdClass.id;\n\n });\n\n return newClassId;\n}\n"],"names":[],"mappings":"AACA;;;GAGG;;;AAKH,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;AAExD,MAAM,qBAAqB,GAAG;IAC5B,WAAW,EAAE;QACX,KAAK,EAAE;YACL,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE;YAChE,QAAQ,EAAE,KAAK;SAChB;QACD,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;SACd;KAC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AC,EAAE;oBACtB,UAAU,EAAE,eAAe,CAAC,UAAU;iBACvC,CAAC;YACJ,CAAC,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;YAC/C,IAAI,EAAG,SAAwD,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBACvF,OAAO;oBACL,GAAG,OAAO;oBACV,EAAE,EAAE,OAAO,CAAC,EAAE;oBACd,IAAI,EAAE,OAAO,CAAC,IAAI;iBACnB,CAAC;YACJ,CAAC,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,EAAE,EAAE,SAAS,CAAC,UAAU,EAAE,EAAE,IAAI,MAAM,EAAE,EAAE,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACvH,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,YAAY,CAAC,EAAE,CAAC;IAEzB,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC","debug_id":"54432db2-f825-5389-b87d-93bdbf37bcf2"}
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, 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\";\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} as const;\n\n/** @returns Classes where user is a teacher. */\nexport function findTeacherClasses(userId: string) {\n return prisma.class.findMany({\n where: { teachers: { some: { id: 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. */\nexport function isTeacherInClass(classId: string, userId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n teachers: { some: { id: 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} 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.findUnique({\n where: { id: classId },\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 },\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}"],"names":[],"mappings":"AACA;;;GAGG;;;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,QAAQ,EA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