@studious-lms/server 1.1.15 → 1.1.17

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.
@@ -5,13 +5,18 @@ export async function clearDatabase() {
5
5
  // Delete in order to respect foreign key constraints
6
6
  // Delete notifications first (they reference users)
7
7
  await prisma.notification.deleteMany();
8
+ // Delete chat-related records
9
+ await prisma.mention.deleteMany();
10
+ await prisma.message.deleteMany();
11
+ await prisma.conversationMember.deleteMany();
12
+ await prisma.labChat.deleteMany();
13
+ await prisma.conversation.deleteMany();
8
14
  // Delete other records that reference users
9
15
  await prisma.submission.deleteMany();
10
16
  await prisma.assignment.deleteMany();
11
17
  await prisma.announcement.deleteMany();
12
18
  await prisma.event.deleteMany();
13
19
  await prisma.attendance.deleteMany();
14
- await prisma.file.deleteMany();
15
20
  // Delete class-related records
16
21
  await prisma.section.deleteMany();
17
22
  await prisma.markScheme.deleteMany();
@@ -21,9 +26,12 @@ export async function clearDatabase() {
21
26
  // Delete user-related records
22
27
  await prisma.session.deleteMany();
23
28
  await prisma.userProfile.deleteMany();
24
- // Finally delete users and schools
29
+ // Delete users first
25
30
  await prisma.user.deleteMany();
31
+ // Delete schools (which reference files for logos) - this will cascade delete the file references
26
32
  await prisma.school.deleteMany();
33
+ // Finally delete all files
34
+ await prisma.file.deleteMany();
27
35
  }
28
36
  export async function createUser(email, password, username) {
29
37
  logger.debug("Creating user", { email, username, password });
@@ -44,29 +52,1456 @@ export async function addNotification(userId, title, content) {
44
52
  export const seedDatabase = async () => {
45
53
  await clearDatabase();
46
54
  logger.info('Cleared database');
47
- // create two test users
48
- const teacher1 = await createUser('teacher1@studious.sh', '123456', 'teacher1');
49
- const student1 = await createUser('student1@studious.sh', '123456', 'student1');
50
- // create a class
51
- const class1 = await prisma.class.create({
55
+ // Create comprehensive demo data for teacher demo video
56
+ // 1. Create School
57
+ const demoFile = await prisma.file.create({
58
+ data: {
59
+ name: 'school_logo.png',
60
+ path: 'logos/demo_school.png',
61
+ type: 'image/png',
62
+ size: 15000,
63
+ }
64
+ });
65
+ const school = await prisma.school.create({
66
+ data: {
67
+ name: 'Riverside High School',
68
+ logoId: demoFile.id,
69
+ subdomain: 'riverside',
70
+ }
71
+ });
72
+ // 2. Create Teachers
73
+ const teachers = await Promise.all([
74
+ createUser('sarah.johnson@riverside.edu', 'demo123', 'sarah.johnson'),
75
+ createUser('michael.chen@riverside.edu', 'demo123', 'michael.chen'),
76
+ createUser('emma.davis@riverside.edu', 'demo123', 'emma.davis'),
77
+ ]);
78
+ // 3. Create Students (realistic names)
79
+ const students = await Promise.all([
80
+ createUser('alex.martinez@student.riverside.edu', 'student123', 'alex.martinez'),
81
+ createUser('sophia.williams@student.riverside.edu', 'student123', 'sophia.williams'),
82
+ createUser('james.brown@student.riverside.edu', 'student123', 'james.brown'),
83
+ createUser('olivia.taylor@student.riverside.edu', 'student123', 'olivia.taylor'),
84
+ createUser('ethan.anderson@student.riverside.edu', 'student123', 'ethan.anderson'),
85
+ createUser('ava.thomas@student.riverside.edu', 'student123', 'ava.thomas'),
86
+ createUser('noah.jackson@student.riverside.edu', 'student123', 'noah.jackson'),
87
+ createUser('isabella.white@student.riverside.edu', 'student123', 'isabella.white'),
88
+ createUser('liam.harris@student.riverside.edu', 'student123', 'liam.harris'),
89
+ createUser('mia.clark@student.riverside.edu', 'student123', 'mia.clark'),
90
+ createUser('lucas.lewis@student.riverside.edu', 'student123', 'lucas.lewis'),
91
+ createUser('charlotte.walker@student.riverside.edu', 'student123', 'charlotte.walker'),
92
+ ]);
93
+ // 4. Create User Profiles
94
+ await Promise.all([
95
+ prisma.userProfile.create({
96
+ data: {
97
+ userId: teachers[0].id,
98
+ displayName: 'Dr. Sarah Johnson',
99
+ bio: 'Biology teacher with 15 years of experience. Passionate about making science accessible to all students.',
100
+ location: 'Riverside, CA',
101
+ website: 'https://sarahjohnson-bio.com',
102
+ }
103
+ }),
104
+ prisma.userProfile.create({
105
+ data: {
106
+ userId: teachers[1].id,
107
+ displayName: 'Mr. Michael Chen',
108
+ bio: 'Mathematics teacher and department head. Specializes in AP Calculus and Statistics.',
109
+ location: 'Riverside, CA',
110
+ }
111
+ }),
112
+ prisma.userProfile.create({
113
+ data: {
114
+ userId: teachers[2].id,
115
+ displayName: 'Ms. Emma Davis',
116
+ bio: 'English Literature teacher. Loves fostering creative writing and critical thinking.',
117
+ location: 'Riverside, CA',
118
+ }
119
+ }),
120
+ ]);
121
+ // Add profiles for some students
122
+ await Promise.all(students.slice(0, 6).map((student, index) => {
123
+ const names = ['Alex Martinez', 'Sophia Williams', 'James Brown', 'Olivia Taylor', 'Ethan Anderson', 'Ava Thomas'];
124
+ return prisma.userProfile.create({
125
+ data: {
126
+ userId: student.id,
127
+ displayName: names[index],
128
+ bio: `Grade 11 student at Riverside High School.`,
129
+ }
130
+ });
131
+ }));
132
+ // 5. Create Classes with realistic subjects
133
+ const biologyClass = await prisma.class.create({
134
+ data: {
135
+ name: 'AP Biology',
136
+ subject: 'Biology',
137
+ section: 'Period 3',
138
+ color: '#10B981',
139
+ syllabus: 'Advanced Placement Biology covering molecular biology, genetics, evolution, ecology, and more.',
140
+ schoolId: school.id,
141
+ teachers: { connect: { id: teachers[0].id } },
142
+ students: { connect: students.slice(0, 8).map(s => ({ id: s.id })) },
143
+ },
144
+ });
145
+ const mathClass = await prisma.class.create({
146
+ data: {
147
+ name: 'AP Calculus BC',
148
+ subject: 'Mathematics',
149
+ section: 'Period 2',
150
+ color: '#3B82F6',
151
+ syllabus: 'Advanced calculus including limits, derivatives, integrals, and series.',
152
+ schoolId: school.id,
153
+ teachers: { connect: { id: teachers[1].id } },
154
+ students: { connect: students.slice(4, 12).map(s => ({ id: s.id })) },
155
+ },
156
+ });
157
+ const englishClass = await prisma.class.create({
158
+ data: {
159
+ name: 'English Literature',
160
+ subject: 'English',
161
+ section: 'Period 1',
162
+ color: '#8B5CF6',
163
+ syllabus: 'Study of classic and contemporary literature with focus on analysis and writing.',
164
+ schoolId: school.id,
165
+ teachers: { connect: { id: teachers[2].id } },
166
+ students: { connect: students.slice(0, 10).map(s => ({ id: s.id })) },
167
+ },
168
+ });
169
+ // 6. Create Sections for organization
170
+ const bioSections = await Promise.all([
171
+ prisma.section.create({
172
+ data: { name: 'Unit 1: Chemistry of Life', classId: biologyClass.id, color: '#EF4444', order: 1 }
173
+ }),
174
+ prisma.section.create({
175
+ data: { name: 'Unit 2: Cell Structure', classId: biologyClass.id, color: '#F97316', order: 2 }
176
+ }),
177
+ prisma.section.create({
178
+ data: { name: 'Unit 3: Cellular Processes', classId: biologyClass.id, color: '#EAB308', order: 3 }
179
+ }),
180
+ prisma.section.create({
181
+ data: { name: 'Unit 4: Genetics', classId: biologyClass.id, color: '#22C55E', order: 4 }
182
+ }),
183
+ ]);
184
+ const mathSections = await Promise.all([
185
+ prisma.section.create({
186
+ data: { name: 'Limits and Continuity', classId: mathClass.id, color: '#3B82F6', order: 1 }
187
+ }),
188
+ prisma.section.create({
189
+ data: { name: 'Derivatives', classId: mathClass.id, color: '#6366F1', order: 2 }
190
+ }),
191
+ prisma.section.create({
192
+ data: { name: 'Integrals', classId: mathClass.id, color: '#8B5CF6', order: 3 }
193
+ }),
194
+ ]);
195
+ // 7. Create mark schemes first
196
+ const bioMarkScheme = await prisma.markScheme.create({
197
+ data: {
198
+ classId: biologyClass.id,
199
+ structured: JSON.stringify({
200
+ name: 'Biology Assessment Rubric',
201
+ criteria: [
202
+ {
203
+ id: 'scientific-accuracy',
204
+ title: 'Scientific Accuracy',
205
+ description: 'Correct use of scientific terminology and concepts',
206
+ levels: [
207
+ {
208
+ id: 'excellent',
209
+ name: 'Excellent',
210
+ description: 'All scientific terms and concepts used correctly with precision',
211
+ points: 4,
212
+ color: '#10B981'
213
+ },
214
+ {
215
+ id: 'proficient',
216
+ name: 'Proficient',
217
+ description: 'Most scientific terms and concepts used correctly',
218
+ points: 3,
219
+ color: '#3B82F6'
220
+ },
221
+ {
222
+ id: 'developing',
223
+ name: 'Developing',
224
+ description: 'Some scientific terms used correctly, minor errors present',
225
+ points: 2,
226
+ color: '#F59E0B'
227
+ },
228
+ {
229
+ id: 'beginning',
230
+ name: 'Beginning',
231
+ description: 'Limited use of scientific terminology, significant errors',
232
+ points: 1,
233
+ color: '#EF4444'
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ id: 'analysis-reasoning',
239
+ title: 'Analysis & Reasoning',
240
+ description: 'Quality of analysis and logical reasoning',
241
+ levels: [
242
+ {
243
+ id: 'excellent',
244
+ name: 'Excellent',
245
+ description: 'Clear, sophisticated analysis with logical connections',
246
+ points: 4,
247
+ color: '#10B981'
248
+ },
249
+ {
250
+ id: 'proficient',
251
+ name: 'Proficient',
252
+ description: 'Good analysis with mostly logical reasoning',
253
+ points: 3,
254
+ color: '#3B82F6'
255
+ },
256
+ {
257
+ id: 'developing',
258
+ name: 'Developing',
259
+ description: 'Basic analysis with some logical gaps',
260
+ points: 2,
261
+ color: '#F59E0B'
262
+ },
263
+ {
264
+ id: 'beginning',
265
+ name: 'Beginning',
266
+ description: 'Limited analysis, unclear reasoning',
267
+ points: 1,
268
+ color: '#EF4444'
269
+ }
270
+ ]
271
+ },
272
+ {
273
+ id: 'communication',
274
+ title: 'Communication',
275
+ description: 'Clear writing and proper formatting',
276
+ levels: [
277
+ {
278
+ id: 'excellent',
279
+ name: 'Excellent',
280
+ description: 'Clear, well-organized writing with proper format',
281
+ points: 4,
282
+ color: '#10B981'
283
+ },
284
+ {
285
+ id: 'proficient',
286
+ name: 'Proficient',
287
+ description: 'Generally clear writing with good organization',
288
+ points: 3,
289
+ color: '#3B82F6'
290
+ },
291
+ {
292
+ id: 'developing',
293
+ name: 'Developing',
294
+ description: 'Adequate writing with some organizational issues',
295
+ points: 2,
296
+ color: '#F59E0B'
297
+ },
298
+ {
299
+ id: 'beginning',
300
+ name: 'Beginning',
301
+ description: 'Unclear writing, poor organization',
302
+ points: 1,
303
+ color: '#EF4444'
304
+ }
305
+ ]
306
+ },
307
+ {
308
+ id: 'evidence-examples',
309
+ title: 'Evidence & Examples',
310
+ description: 'Use of relevant examples and evidence',
311
+ levels: [
312
+ {
313
+ id: 'excellent',
314
+ name: 'Excellent',
315
+ description: 'Strong, relevant examples that enhance understanding',
316
+ points: 4,
317
+ color: '#10B981'
318
+ },
319
+ {
320
+ id: 'proficient',
321
+ name: 'Proficient',
322
+ description: 'Good examples that support main points',
323
+ points: 3,
324
+ color: '#3B82F6'
325
+ },
326
+ {
327
+ id: 'developing',
328
+ name: 'Developing',
329
+ description: 'Some examples provided, may lack relevance',
330
+ points: 2,
331
+ color: '#F59E0B'
332
+ },
333
+ {
334
+ id: 'beginning',
335
+ name: 'Beginning',
336
+ description: 'Few or no relevant examples provided',
337
+ points: 1,
338
+ color: '#EF4444'
339
+ }
340
+ ]
341
+ }
342
+ ]
343
+ })
344
+ }
345
+ });
346
+ const mathMarkScheme = await prisma.markScheme.create({
347
+ data: {
348
+ classId: mathClass.id,
349
+ structured: JSON.stringify({
350
+ name: 'Mathematics Assessment Rubric',
351
+ criteria: [
352
+ {
353
+ id: 'mathematical-accuracy',
354
+ title: 'Mathematical Accuracy',
355
+ description: 'Correct calculations and mathematical procedures',
356
+ levels: [
357
+ {
358
+ id: 'excellent',
359
+ name: 'Excellent',
360
+ description: 'All calculations correct, proper mathematical procedures',
361
+ points: 4,
362
+ color: '#10B981'
363
+ },
364
+ {
365
+ id: 'proficient',
366
+ name: 'Proficient',
367
+ description: 'Most calculations correct, minor computational errors',
368
+ points: 3,
369
+ color: '#3B82F6'
370
+ },
371
+ {
372
+ id: 'developing',
373
+ name: 'Developing',
374
+ description: 'Some calculations correct, several errors present',
375
+ points: 2,
376
+ color: '#F59E0B'
377
+ },
378
+ {
379
+ id: 'beginning',
380
+ name: 'Beginning',
381
+ description: 'Many calculation errors, incorrect procedures',
382
+ points: 1,
383
+ color: '#EF4444'
384
+ }
385
+ ]
386
+ },
387
+ {
388
+ id: 'problem-solving',
389
+ title: 'Problem-Solving Strategy',
390
+ description: 'Appropriate method selection and setup',
391
+ levels: [
392
+ {
393
+ id: 'excellent',
394
+ name: 'Excellent',
395
+ description: 'Optimal strategy chosen, excellent problem setup',
396
+ points: 4,
397
+ color: '#10B981'
398
+ },
399
+ {
400
+ id: 'proficient',
401
+ name: 'Proficient',
402
+ description: 'Good strategy, appropriate problem approach',
403
+ points: 3,
404
+ color: '#3B82F6'
405
+ },
406
+ {
407
+ id: 'developing',
408
+ name: 'Developing',
409
+ description: 'Adequate strategy, some setup issues',
410
+ points: 2,
411
+ color: '#F59E0B'
412
+ },
413
+ {
414
+ id: 'beginning',
415
+ name: 'Beginning',
416
+ description: 'Poor strategy choice, unclear setup',
417
+ points: 1,
418
+ color: '#EF4444'
419
+ }
420
+ ]
421
+ },
422
+ {
423
+ id: 'work-shown',
424
+ title: 'Work Shown',
425
+ description: 'Clear step-by-step work and explanations',
426
+ levels: [
427
+ {
428
+ id: 'excellent',
429
+ name: 'Excellent',
430
+ description: 'All work clearly shown with detailed explanations',
431
+ points: 4,
432
+ color: '#10B981'
433
+ },
434
+ {
435
+ id: 'proficient',
436
+ name: 'Proficient',
437
+ description: 'Most work shown, good explanations',
438
+ points: 3,
439
+ color: '#3B82F6'
440
+ },
441
+ {
442
+ id: 'developing',
443
+ name: 'Developing',
444
+ description: 'Some work shown, limited explanations',
445
+ points: 2,
446
+ color: '#F59E0B'
447
+ },
448
+ {
449
+ id: 'beginning',
450
+ name: 'Beginning',
451
+ description: 'Little work shown, unclear process',
452
+ points: 1,
453
+ color: '#EF4444'
454
+ }
455
+ ]
456
+ },
457
+ {
458
+ id: 'final-answer',
459
+ title: 'Final Answer',
460
+ description: 'Correct final answer with proper units/notation',
461
+ levels: [
462
+ {
463
+ id: 'excellent',
464
+ name: 'Excellent',
465
+ description: 'Correct answer with proper units and notation',
466
+ points: 4,
467
+ color: '#10B981'
468
+ },
469
+ {
470
+ id: 'proficient',
471
+ name: 'Proficient',
472
+ description: 'Correct answer, minor notation issues',
473
+ points: 3,
474
+ color: '#3B82F6'
475
+ },
476
+ {
477
+ id: 'developing',
478
+ name: 'Developing',
479
+ description: 'Answer close to correct, some notation errors',
480
+ points: 2,
481
+ color: '#F59E0B'
482
+ },
483
+ {
484
+ id: 'beginning',
485
+ name: 'Beginning',
486
+ description: 'Incorrect answer or missing units',
487
+ points: 1,
488
+ color: '#EF4444'
489
+ }
490
+ ]
491
+ }
492
+ ]
493
+ })
494
+ }
495
+ });
496
+ // 8. Create grading boundaries
497
+ const mathGradingBoundary = await prisma.gradingBoundary.create({
498
+ data: {
499
+ classId: mathClass.id,
500
+ structured: JSON.stringify({
501
+ name: 'AP Calculus BC Grading Scale',
502
+ boundaries: [
503
+ {
504
+ id: 'a-plus',
505
+ grade: 'A+',
506
+ minPercentage: 97,
507
+ maxPercentage: 100,
508
+ description: 'Exceptional mastery of all concepts',
509
+ color: '#059669'
510
+ },
511
+ {
512
+ id: 'a',
513
+ grade: 'A',
514
+ minPercentage: 93,
515
+ maxPercentage: 96,
516
+ description: 'Strong mastery of concepts',
517
+ color: '#10B981'
518
+ },
519
+ {
520
+ id: 'a-minus',
521
+ grade: 'A-',
522
+ minPercentage: 90,
523
+ maxPercentage: 92,
524
+ description: 'Good mastery with minor gaps',
525
+ color: '#34D399'
526
+ },
527
+ {
528
+ id: 'b-plus',
529
+ grade: 'B+',
530
+ minPercentage: 87,
531
+ maxPercentage: 89,
532
+ description: 'Above average understanding',
533
+ color: '#1D4ED8'
534
+ },
535
+ {
536
+ id: 'b',
537
+ grade: 'B',
538
+ minPercentage: 83,
539
+ maxPercentage: 86,
540
+ description: 'Solid understanding of most concepts',
541
+ color: '#3B82F6'
542
+ },
543
+ {
544
+ id: 'b-minus',
545
+ grade: 'B-',
546
+ minPercentage: 80,
547
+ maxPercentage: 82,
548
+ description: 'Adequate understanding with some gaps',
549
+ color: '#60A5FA'
550
+ },
551
+ {
552
+ id: 'c-plus',
553
+ grade: 'C+',
554
+ minPercentage: 77,
555
+ maxPercentage: 79,
556
+ description: 'Basic understanding, needs improvement',
557
+ color: '#D97706'
558
+ },
559
+ {
560
+ id: 'c',
561
+ grade: 'C',
562
+ minPercentage: 73,
563
+ maxPercentage: 76,
564
+ description: 'Minimal acceptable understanding',
565
+ color: '#F59E0B'
566
+ },
567
+ {
568
+ id: 'c-minus',
569
+ grade: 'C-',
570
+ minPercentage: 70,
571
+ maxPercentage: 72,
572
+ description: 'Below average, significant gaps',
573
+ color: '#FBBF24'
574
+ },
575
+ {
576
+ id: 'd',
577
+ grade: 'D',
578
+ minPercentage: 60,
579
+ maxPercentage: 69,
580
+ description: 'Poor understanding, major deficiencies',
581
+ color: '#F87171'
582
+ },
583
+ {
584
+ id: 'f',
585
+ grade: 'F',
586
+ minPercentage: 0,
587
+ maxPercentage: 59,
588
+ description: 'Inadequate understanding, does not meet standards',
589
+ color: '#EF4444'
590
+ }
591
+ ]
592
+ })
593
+ }
594
+ });
595
+ // 9. Create realistic assignments (more for Calc BC)
596
+ const now = new Date();
597
+ const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000);
598
+ const tomorrow = new Date(now.getTime() + 24 * 60 * 60 * 1000);
599
+ const nextWeek = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000);
600
+ const nextMonth = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000);
601
+ const lastWeek = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
602
+ const assignments = await Promise.all([
603
+ // Biology assignments
604
+ prisma.assignment.create({
605
+ data: {
606
+ title: 'Cell Structure Lab Report',
607
+ instructions: 'Complete the microscopy lab and write a detailed report on your observations of plant and animal cells. Include labeled diagrams and compare/contrast the structures you observed.',
608
+ dueDate: nextWeek,
609
+ teacherId: teachers[0].id,
610
+ classId: biologyClass.id,
611
+ sectionId: bioSections[1].id,
612
+ type: 'LAB',
613
+ maxGrade: 100,
614
+ weight: 1.5,
615
+ markSchemeId: bioMarkScheme.id,
616
+ }
617
+ }),
618
+ prisma.assignment.create({
619
+ data: {
620
+ title: 'Genetics Problem Set',
621
+ instructions: 'Solve the genetics problems on pages 234-237. Show all work including Punnett squares and probability calculations.',
622
+ dueDate: tomorrow,
623
+ teacherId: teachers[0].id,
624
+ classId: biologyClass.id,
625
+ sectionId: bioSections[3].id,
626
+ type: 'HOMEWORK',
627
+ maxGrade: 50,
628
+ weight: 1.0,
629
+ markSchemeId: bioMarkScheme.id,
630
+ }
631
+ }),
632
+ prisma.assignment.create({
633
+ data: {
634
+ title: 'Evolution Essay',
635
+ instructions: 'Write a 5-page essay on the evidence for evolution. Use at least 5 scientific sources and cite them properly.',
636
+ dueDate: nextMonth,
637
+ teacherId: teachers[0].id,
638
+ classId: biologyClass.id,
639
+ type: 'ESSAY',
640
+ maxGrade: 100,
641
+ weight: 2.0,
642
+ markSchemeId: bioMarkScheme.id,
643
+ }
644
+ }),
645
+ // Math assignments (expanded for demo)
646
+ prisma.assignment.create({
647
+ data: {
648
+ title: 'Limits and Continuity Test',
649
+ instructions: 'Comprehensive test covering limits, continuity, and the Intermediate Value Theorem. Calculators allowed for Section B only.',
650
+ dueDate: lastWeek, // Already completed
651
+ teacherId: teachers[1].id,
652
+ classId: mathClass.id,
653
+ sectionId: mathSections[0].id,
654
+ type: 'TEST',
655
+ maxGrade: 100,
656
+ weight: 2.5,
657
+ markSchemeId: mathMarkScheme.id,
658
+ gradingBoundaryId: mathGradingBoundary.id,
659
+ graded: true,
660
+ }
661
+ }),
662
+ prisma.assignment.create({
663
+ data: {
664
+ title: 'Limits Practice Problems',
665
+ instructions: 'Complete problems 1-25 on page 89. Focus on algebraic manipulation and graphical analysis.',
666
+ dueDate: yesterday, // Just submitted
667
+ teacherId: teachers[1].id,
668
+ classId: mathClass.id,
669
+ sectionId: mathSections[0].id,
670
+ type: 'HOMEWORK',
671
+ maxGrade: 25,
672
+ weight: 1.0,
673
+ markSchemeId: mathMarkScheme.id,
674
+ gradingBoundaryId: mathGradingBoundary.id,
675
+ }
676
+ }),
677
+ prisma.assignment.create({
678
+ data: {
679
+ title: 'Derivative Applications Quiz',
680
+ instructions: 'Quiz covering related rates, optimization, and curve sketching.',
681
+ dueDate: new Date(now.getTime() + 5 * 24 * 60 * 60 * 1000),
682
+ teacherId: teachers[1].id,
683
+ classId: mathClass.id,
684
+ sectionId: mathSections[1].id,
685
+ type: 'QUIZ',
686
+ maxGrade: 75,
687
+ weight: 1.5,
688
+ markSchemeId: mathMarkScheme.id,
689
+ gradingBoundaryId: mathGradingBoundary.id,
690
+ }
691
+ }),
692
+ prisma.assignment.create({
693
+ data: {
694
+ title: 'Integration Techniques Homework',
695
+ instructions: 'Complete problems 1-30 on pages 156-158. Practice integration by parts, substitution, and partial fractions.',
696
+ dueDate: new Date(now.getTime() + 3 * 24 * 60 * 60 * 1000),
697
+ teacherId: teachers[1].id,
698
+ classId: mathClass.id,
699
+ sectionId: mathSections[2].id,
700
+ type: 'HOMEWORK',
701
+ maxGrade: 30,
702
+ weight: 1.0,
703
+ markSchemeId: mathMarkScheme.id,
704
+ gradingBoundaryId: mathGradingBoundary.id,
705
+ }
706
+ }),
707
+ prisma.assignment.create({
708
+ data: {
709
+ title: 'AP Practice Test - Derivatives',
710
+ instructions: 'Complete this practice AP exam focusing on derivatives and their applications. Time limit: 90 minutes.',
711
+ dueDate: new Date(now.getTime() + 10 * 24 * 60 * 60 * 1000),
712
+ teacherId: teachers[1].id,
713
+ classId: mathClass.id,
714
+ sectionId: mathSections[1].id,
715
+ type: 'TEST',
716
+ maxGrade: 108, // AP style scoring
717
+ weight: 2.5,
718
+ markSchemeId: mathMarkScheme.id,
719
+ gradingBoundaryId: mathGradingBoundary.id,
720
+ }
721
+ }),
722
+ prisma.assignment.create({
723
+ data: {
724
+ title: 'Calculus Project: Real-World Applications',
725
+ instructions: 'Choose a real-world scenario and create a presentation showing how calculus is used. Include derivatives, integrals, and optimization. 10-minute presentation required.',
726
+ dueDate: new Date(now.getTime() + 21 * 24 * 60 * 60 * 1000),
727
+ teacherId: teachers[1].id,
728
+ classId: mathClass.id,
729
+ type: 'PROJECT',
730
+ maxGrade: 150,
731
+ weight: 3.0,
732
+ markSchemeId: mathMarkScheme.id,
733
+ gradingBoundaryId: mathGradingBoundary.id,
734
+ }
735
+ }),
736
+ ]);
737
+ // 10. Create comprehensive submissions for all students and assignments
738
+ const submissionsToCreate = [];
739
+ // Helper function to generate realistic grades based on assignment type and student performance
740
+ const generateGrade = (maxGrade, studentIndex, assignmentType) => {
741
+ // Create some variation in student performance
742
+ const basePerformance = [0.92, 0.88, 0.85, 0.90, 0.82, 0.87, 0.91, 0.84, 0.89, 0.86, 0.83, 0.88]; // Different performance levels
743
+ const performance = basePerformance[studentIndex % basePerformance.length];
744
+ // Adjust based on assignment type
745
+ let multiplier = performance;
746
+ if (assignmentType === 'TEST')
747
+ multiplier -= 0.05; // Tests are harder
748
+ if (assignmentType === 'QUIZ')
749
+ multiplier -= 0.02; // Quizzes slightly harder
750
+ if (assignmentType === 'HOMEWORK')
751
+ multiplier += 0.03; // Homework gets better grades
752
+ // Add some randomness
753
+ const randomFactor = (Math.random() - 0.5) * 0.1; // ±5%
754
+ const finalGrade = Math.round(maxGrade * (multiplier + randomFactor));
755
+ return Math.max(0, Math.min(maxGrade, finalGrade)); // Clamp between 0 and maxGrade
756
+ };
757
+ // Generate teacher comments based on grade
758
+ const generateComment = (grade, maxGrade, assignmentType) => {
759
+ const percentage = (grade / maxGrade) * 100;
760
+ const comments = {
761
+ excellent: [
762
+ 'Excellent work! Your understanding of the concepts is clear.',
763
+ 'Outstanding performance. Keep up the great work!',
764
+ 'Impressive analysis and problem-solving approach.',
765
+ 'Perfect execution. Your work demonstrates mastery of the material.'
766
+ ],
767
+ good: [
768
+ 'Good work overall. Minor areas for improvement noted.',
769
+ 'Solid understanding demonstrated. Watch calculation accuracy.',
770
+ 'Well done! A few small errors but good conceptual grasp.',
771
+ 'Nice job. Consider reviewing the highlighted sections.'
772
+ ],
773
+ average: [
774
+ 'Adequate work. Please review the concepts we discussed in class.',
775
+ 'Shows basic understanding but needs more practice.',
776
+ 'Fair attempt. Come see me during office hours for extra help.',
777
+ 'Meets expectations. Focus on showing more detailed work.'
778
+ ],
779
+ needs_improvement: [
780
+ 'Needs significant improvement. Please schedule a meeting to discuss.',
781
+ 'Below expectations. Additional practice and review required.',
782
+ 'Struggling with key concepts. Let\'s work together to improve.',
783
+ 'Requires more effort and attention to detail.'
784
+ ]
785
+ };
786
+ let category;
787
+ if (percentage >= 90)
788
+ category = 'excellent';
789
+ else if (percentage >= 80)
790
+ category = 'good';
791
+ else if (percentage >= 70)
792
+ category = 'average';
793
+ else
794
+ category = 'needs_improvement';
795
+ return comments[category][Math.floor(Math.random() * comments[category].length)];
796
+ };
797
+ // Create submissions for Biology assignments (students 0-7)
798
+ for (let i = 0; i < 3; i++) { // First 3 assignments are Biology
799
+ const assignment = assignments[i];
800
+ const maxGrade = assignment.maxGrade || 100; // Default to 100 if null
801
+ for (let j = 0; j < 8; j++) { // 8 students in Biology
802
+ const student = students[j];
803
+ const grade = generateGrade(maxGrade, j, assignment.type);
804
+ const isSubmitted = Math.random() > 0.1; // 90% submission rate
805
+ const isGraded = i < 2; // First 2 assignments are graded
806
+ submissionsToCreate.push({
807
+ assignmentId: assignment.id,
808
+ studentId: student.id,
809
+ submitted: isSubmitted,
810
+ submittedAt: isSubmitted ? new Date(assignment.dueDate.getTime() - Math.random() * 24 * 60 * 60 * 1000) : null,
811
+ gradeReceived: isGraded && isSubmitted ? grade : null,
812
+ teacherComments: isGraded && isSubmitted ? generateComment(grade, maxGrade, assignment.type) : null,
813
+ returned: isGraded && isSubmitted,
814
+ });
815
+ }
816
+ }
817
+ // Create submissions for Math assignments (students 4-11) - 8 students
818
+ for (let i = 3; i < assignments.length; i++) { // Math assignments start at index 3
819
+ const assignment = assignments[i];
820
+ const maxGrade = assignment.maxGrade || 100; // Default to 100 if null
821
+ for (let j = 4; j < 12; j++) { // Students 4-11 are in Math class
822
+ const student = students[j];
823
+ const grade = generateGrade(maxGrade, j, assignment.type);
824
+ // Determine submission and grading status based on due date
825
+ const isOverdue = assignment.dueDate < now;
826
+ const isDueSoon = assignment.dueDate < tomorrow;
827
+ const isSubmitted = isOverdue || (isDueSoon && Math.random() > 0.2) || Math.random() > 0.15; // Higher submission rate for math
828
+ const isGraded = isOverdue && assignment.graded; // Only grade overdue assignments
829
+ submissionsToCreate.push({
830
+ assignmentId: assignment.id,
831
+ studentId: student.id,
832
+ submitted: isSubmitted,
833
+ submittedAt: isSubmitted ? new Date(assignment.dueDate.getTime() - Math.random() * 48 * 60 * 60 * 1000) : null,
834
+ gradeReceived: isGraded && isSubmitted ? grade : null,
835
+ teacherComments: isGraded && isSubmitted ? generateComment(grade, maxGrade, assignment.type) : null,
836
+ returned: isGraded && isSubmitted,
837
+ rubricState: isGraded && isSubmitted ? JSON.stringify({
838
+ criteria: [
839
+ { name: 'Mathematical Accuracy', score: Math.round(grade * 0.5), maxScore: Math.round(maxGrade * 0.5) },
840
+ { name: 'Problem-Solving Strategy', score: Math.round(grade * 0.25), maxScore: Math.round(maxGrade * 0.25) },
841
+ { name: 'Work Shown', score: Math.round(grade * 0.15), maxScore: Math.round(maxGrade * 0.15) },
842
+ { name: 'Final Answer', score: Math.round(grade * 0.1), maxScore: Math.round(maxGrade * 0.1) }
843
+ ]
844
+ }) : null,
845
+ });
846
+ }
847
+ }
848
+ // Create all submissions
849
+ await Promise.all(submissionsToCreate.map(submission => prisma.submission.create({ data: submission })));
850
+ // 11. Create announcements
851
+ await Promise.all([
852
+ prisma.announcement.create({
853
+ data: {
854
+ remarks: 'Reminder: Lab safety quiz next Tuesday. Please review the safety protocols we discussed in class.',
855
+ teacherId: teachers[0].id,
856
+ classId: biologyClass.id,
857
+ createdAt: new Date(now.getTime() - 24 * 60 * 60 * 1000),
858
+ }
859
+ }),
860
+ prisma.announcement.create({
861
+ data: {
862
+ remarks: 'Great job on the recent quiz, everyone! The class average was 87%. Keep up the excellent work!',
863
+ teacherId: teachers[1].id,
864
+ classId: mathClass.id,
865
+ createdAt: new Date(now.getTime() - 6 * 60 * 60 * 1000),
866
+ }
867
+ }),
868
+ prisma.announcement.create({
869
+ data: {
870
+ remarks: 'Don\'t forget: Parent-teacher conferences are next week. Sign-up sheets are available in the main office.',
871
+ teacherId: teachers[2].id,
872
+ classId: englishClass.id,
873
+ createdAt: new Date(now.getTime() - 12 * 60 * 60 * 1000),
874
+ }
875
+ }),
876
+ ]);
877
+ // 12. Create events/calendar items (lots for Michael Chen's week of Oct 7)
878
+ const oct7 = new Date('2025-10-07T08:00:00');
879
+ const oct8 = new Date('2025-10-08T08:00:00');
880
+ const oct9 = new Date('2025-10-09T08:00:00');
881
+ const oct10 = new Date('2025-10-10T08:00:00');
882
+ const oct11 = new Date('2025-10-11T08:00:00');
883
+ await Promise.all([
884
+ // Monday Oct 7 - Michael Chen's busy day
885
+ prisma.event.create({
886
+ data: {
887
+ name: 'AP Calculus BC - Period 2',
888
+ startTime: new Date('2025-10-07T09:15:00'),
889
+ endTime: new Date('2025-10-07T10:05:00'),
890
+ location: 'Room 156',
891
+ remarks: 'Derivatives unit test review',
892
+ userId: teachers[1].id,
893
+ classId: mathClass.id,
894
+ color: '#3B82F6',
895
+ }
896
+ }),
897
+ prisma.event.create({
898
+ data: {
899
+ name: 'Department Head Meeting',
900
+ startTime: new Date('2025-10-07T10:30:00'),
901
+ endTime: new Date('2025-10-07T11:30:00'),
902
+ location: 'Conference Room A',
903
+ remarks: 'Monthly math department meeting - curriculum planning',
904
+ userId: teachers[1].id,
905
+ color: '#8B5CF6',
906
+ }
907
+ }),
908
+ prisma.event.create({
909
+ data: {
910
+ name: 'AP Statistics - Period 5',
911
+ startTime: new Date('2025-10-07T13:45:00'),
912
+ endTime: new Date('2025-10-07T14:35:00'),
913
+ location: 'Room 156',
914
+ remarks: 'Hypothesis testing introduction',
915
+ userId: teachers[1].id,
916
+ color: '#3B82F6',
917
+ }
918
+ }),
919
+ prisma.event.create({
920
+ data: {
921
+ name: 'Parent Conference - Williams Family',
922
+ startTime: new Date('2025-10-07T15:00:00'),
923
+ endTime: new Date('2025-10-07T15:30:00'),
924
+ location: 'Room 156',
925
+ remarks: 'Discuss Sophia\'s progress in AP Calculus',
926
+ userId: teachers[1].id,
927
+ color: '#F59E0B',
928
+ }
929
+ }),
930
+ prisma.event.create({
931
+ data: {
932
+ name: 'Math Tutoring Session',
933
+ startTime: new Date('2025-10-07T15:45:00'),
934
+ endTime: new Date('2025-10-07T16:45:00'),
935
+ location: 'Room 156',
936
+ remarks: 'Extra help for struggling students',
937
+ userId: teachers[1].id,
938
+ color: '#10B981',
939
+ }
940
+ }),
941
+ // Tuesday Oct 8
942
+ prisma.event.create({
943
+ data: {
944
+ name: 'AP Calculus BC - Period 2',
945
+ startTime: new Date('2025-10-08T09:15:00'),
946
+ endTime: new Date('2025-10-08T10:05:00'),
947
+ location: 'Room 156',
948
+ remarks: 'Derivatives unit test',
949
+ userId: teachers[1].id,
950
+ classId: mathClass.id,
951
+ color: '#3B82F6',
952
+ }
953
+ }),
954
+ prisma.event.create({
955
+ data: {
956
+ name: 'Faculty Meeting',
957
+ startTime: new Date('2025-10-08T12:00:00'),
958
+ endTime: new Date('2025-10-08T13:00:00'),
959
+ location: 'Main Auditorium',
960
+ remarks: 'All-school faculty meeting',
961
+ userId: teachers[1].id,
962
+ color: '#6B7280',
963
+ }
964
+ }),
965
+ prisma.event.create({
966
+ data: {
967
+ name: 'AP Statistics - Period 5',
968
+ startTime: new Date('2025-10-08T13:45:00'),
969
+ endTime: new Date('2025-10-08T14:35:00'),
970
+ location: 'Room 156',
971
+ remarks: 'Hypothesis testing practice problems',
972
+ userId: teachers[1].id,
973
+ color: '#3B82F6',
974
+ }
975
+ }),
976
+ prisma.event.create({
977
+ data: {
978
+ name: 'Grade Level Team Meeting',
979
+ startTime: new Date('2025-10-08T15:00:00'),
980
+ endTime: new Date('2025-10-08T16:00:00'),
981
+ location: 'Room 201',
982
+ remarks: '11th grade team coordination',
983
+ userId: teachers[1].id,
984
+ color: '#8B5CF6',
985
+ }
986
+ }),
987
+ // Wednesday Oct 9
988
+ prisma.event.create({
989
+ data: {
990
+ name: 'AP Calculus BC - Period 2',
991
+ startTime: new Date('2025-10-09T09:15:00'),
992
+ endTime: new Date('2025-10-09T10:05:00'),
993
+ location: 'Room 156',
994
+ remarks: 'Integration introduction',
995
+ userId: teachers[1].id,
996
+ classId: mathClass.id,
997
+ color: '#3B82F6',
998
+ }
999
+ }),
1000
+ prisma.event.create({
1001
+ data: {
1002
+ name: 'Professional Development',
1003
+ startTime: new Date('2025-10-09T11:00:00'),
1004
+ endTime: new Date('2025-10-09T12:30:00'),
1005
+ location: 'Library Conference Room',
1006
+ remarks: 'Technology in Mathematics Education workshop',
1007
+ userId: teachers[1].id,
1008
+ color: '#059669',
1009
+ }
1010
+ }),
1011
+ prisma.event.create({
1012
+ data: {
1013
+ name: 'AP Statistics - Period 5',
1014
+ startTime: new Date('2025-10-09T13:45:00'),
1015
+ endTime: new Date('2025-10-09T14:35:00'),
1016
+ location: 'Room 156',
1017
+ remarks: 'Chi-square tests',
1018
+ userId: teachers[1].id,
1019
+ color: '#3B82F6',
1020
+ }
1021
+ }),
1022
+ prisma.event.create({
1023
+ data: {
1024
+ name: 'Student Council Advisory',
1025
+ startTime: new Date('2025-10-09T15:00:00'),
1026
+ endTime: new Date('2025-10-09T16:00:00'),
1027
+ location: 'Room 105',
1028
+ remarks: 'Advisor meeting for student council',
1029
+ userId: teachers[1].id,
1030
+ color: '#DC2626',
1031
+ }
1032
+ }),
1033
+ // Thursday Oct 10
1034
+ prisma.event.create({
1035
+ data: {
1036
+ name: 'AP Calculus BC - Period 2',
1037
+ startTime: new Date('2025-10-10T09:15:00'),
1038
+ endTime: new Date('2025-10-10T10:05:00'),
1039
+ location: 'Room 156',
1040
+ remarks: 'Integration by substitution',
1041
+ userId: teachers[1].id,
1042
+ classId: mathClass.id,
1043
+ color: '#3B82F6',
1044
+ }
1045
+ }),
1046
+ prisma.event.create({
1047
+ data: {
1048
+ name: 'Curriculum Committee',
1049
+ startTime: new Date('2025-10-10T11:00:00'),
1050
+ endTime: new Date('2025-10-10T12:00:00'),
1051
+ location: 'Principal\'s Office',
1052
+ remarks: 'Review new AP curriculum standards',
1053
+ userId: teachers[1].id,
1054
+ color: '#8B5CF6',
1055
+ }
1056
+ }),
1057
+ prisma.event.create({
1058
+ data: {
1059
+ name: 'AP Statistics - Period 5',
1060
+ startTime: new Date('2025-10-10T13:45:00'),
1061
+ endTime: new Date('2025-10-10T14:35:00'),
1062
+ location: 'Room 156',
1063
+ remarks: 'ANOVA introduction',
1064
+ userId: teachers[1].id,
1065
+ color: '#3B82F6',
1066
+ }
1067
+ }),
1068
+ prisma.event.create({
1069
+ data: {
1070
+ name: 'Parent Conference - Anderson Family',
1071
+ startTime: new Date('2025-10-10T15:00:00'),
1072
+ endTime: new Date('2025-10-10T15:30:00'),
1073
+ location: 'Room 156',
1074
+ remarks: 'Discuss Ethan\'s improvement strategies',
1075
+ userId: teachers[1].id,
1076
+ color: '#F59E0B',
1077
+ }
1078
+ }),
1079
+ prisma.event.create({
1080
+ data: {
1081
+ name: 'Math Club Meeting',
1082
+ startTime: new Date('2025-10-10T15:45:00'),
1083
+ endTime: new Date('2025-10-10T16:45:00'),
1084
+ location: 'Room 156',
1085
+ remarks: 'Preparing for state math competition',
1086
+ userId: teachers[1].id,
1087
+ color: '#10B981',
1088
+ }
1089
+ }),
1090
+ // Friday Oct 11
1091
+ prisma.event.create({
1092
+ data: {
1093
+ name: 'AP Calculus BC - Period 2',
1094
+ startTime: new Date('2025-10-11T09:15:00'),
1095
+ endTime: new Date('2025-10-11T10:05:00'),
1096
+ location: 'Room 156',
1097
+ remarks: 'Integration by parts',
1098
+ userId: teachers[1].id,
1099
+ classId: mathClass.id,
1100
+ color: '#3B82F6',
1101
+ }
1102
+ }),
1103
+ prisma.event.create({
1104
+ data: {
1105
+ name: 'IEP Meeting - Student Support',
1106
+ startTime: new Date('2025-10-11T10:30:00'),
1107
+ endTime: new Date('2025-10-11T11:30:00'),
1108
+ location: 'Special Services Office',
1109
+ remarks: 'Individualized Education Plan review',
1110
+ userId: teachers[1].id,
1111
+ color: '#F59E0B',
1112
+ }
1113
+ }),
1114
+ prisma.event.create({
1115
+ data: {
1116
+ name: 'AP Statistics - Period 5',
1117
+ startTime: new Date('2025-10-11T13:45:00'),
1118
+ endTime: new Date('2025-10-11T14:35:00'),
1119
+ location: 'Room 156',
1120
+ remarks: 'ANOVA practice and review',
1121
+ userId: teachers[1].id,
1122
+ color: '#3B82F6',
1123
+ }
1124
+ }),
1125
+ prisma.event.create({
1126
+ data: {
1127
+ name: 'Weekend Prep Session',
1128
+ startTime: new Date('2025-10-11T15:00:00'),
1129
+ endTime: new Date('2025-10-11T17:00:00'),
1130
+ location: 'Room 156',
1131
+ remarks: 'Voluntary AP exam prep session',
1132
+ userId: teachers[1].id,
1133
+ color: '#059669',
1134
+ }
1135
+ }),
1136
+ // Some events for other teachers too
1137
+ prisma.event.create({
1138
+ data: {
1139
+ name: 'Cell Biology Lab',
1140
+ startTime: new Date(now.getTime() + 2 * 24 * 60 * 60 * 1000),
1141
+ endTime: new Date(now.getTime() + 2 * 24 * 60 * 60 * 1000 + 90 * 60 * 1000), // 90 minutes
1142
+ location: 'Science Lab Room 204',
1143
+ remarks: 'Bring lab notebooks and safety goggles',
1144
+ userId: teachers[0].id,
1145
+ classId: biologyClass.id,
1146
+ color: '#10B981',
1147
+ }
1148
+ }),
1149
+ prisma.event.create({
1150
+ data: {
1151
+ name: 'Poetry Reading',
1152
+ startTime: new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000),
1153
+ endTime: new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000 + 60 * 60 * 1000),
1154
+ location: 'Library',
1155
+ remarks: 'Students will present their original poetry',
1156
+ userId: teachers[2].id,
1157
+ classId: englishClass.id,
1158
+ color: '#8B5CF6',
1159
+ }
1160
+ }),
1161
+ ]);
1162
+ // 13. Create attendance records
1163
+ const attendanceDate = new Date(now.getTime() - 24 * 60 * 60 * 1000);
1164
+ await Promise.all([
1165
+ prisma.attendance.create({
1166
+ data: {
1167
+ date: attendanceDate,
1168
+ classId: biologyClass.id,
1169
+ present: { connect: students.slice(0, 6).map(s => ({ id: s.id })) },
1170
+ late: { connect: [{ id: students[6].id }] },
1171
+ absent: { connect: [{ id: students[7].id }] },
1172
+ }
1173
+ }),
1174
+ prisma.attendance.create({
1175
+ data: {
1176
+ date: attendanceDate,
1177
+ classId: mathClass.id,
1178
+ present: { connect: students.slice(4, 11).map(s => ({ id: s.id })) },
1179
+ late: { connect: [{ id: students[11].id }] },
1180
+ }
1181
+ }),
1182
+ ]);
1183
+ // 14. Create notifications for realistic teacher experience
1184
+ await Promise.all([
1185
+ // For main teacher (Sarah Johnson)
1186
+ addNotification(teachers[0].id, 'New Submission', 'Alex Martinez submitted Genetics Problem Set'),
1187
+ addNotification(teachers[0].id, 'Grade Reminder', 'You have 3 assignments pending grading'),
1188
+ addNotification(teachers[0].id, 'Lab Equipment', 'Microscopes for tomorrow\'s lab are ready in Room 204'),
1189
+ addNotification(teachers[0].id, 'Parent Contact', 'Mrs. Williams requested a meeting about Sophia\'s progress'),
1190
+ // For students
1191
+ addNotification(students[0].id, 'Assignment Graded', 'Your Genetics Problem Set has been graded: 45/50'),
1192
+ addNotification(students[1].id, 'Assignment Graded', 'Your Genetics Problem Set has been graded: 48/50'),
1193
+ addNotification(students[2].id, 'Assignment Due', 'Cell Structure Lab Report is due in 3 days'),
1194
+ addNotification(students[3].id, 'Class Announcement', 'New announcement in AP Biology'),
1195
+ ]);
1196
+ // 15. Create some lab chats for AI demo
1197
+ const labChatContext = JSON.stringify({
1198
+ subject: 'Biology',
1199
+ topic: 'Cell Structure and Function',
1200
+ gradeLevel: '11th Grade AP',
1201
+ difficulty: 'Advanced',
1202
+ objectives: [
1203
+ 'Understand prokaryotic vs eukaryotic cell structures',
1204
+ 'Identify organelles and their functions',
1205
+ 'Compare plant and animal cells'
1206
+ ],
1207
+ standards: ['NGSS HS-LS1-1', 'NGSS HS-LS1-2'],
1208
+ duration: '2 weeks',
1209
+ assessmentType: 'Lab report and quiz'
1210
+ });
1211
+ // Create conversation for lab chat
1212
+ const labConversation = await prisma.conversation.create({
52
1213
  data: {
53
- name: 'Class 1',
54
- subject: 'Math',
55
- section: 'A',
56
- teachers: {
57
- connect: {
58
- id: teacher1.id,
59
- }
60
- },
61
- students: {
62
- connect: {
63
- id: student1.id,
64
- }
65
- }
66
- },
67
- });
68
- await addNotification(teacher1.id, 'Welcome to Studious', 'Welcome to Studious');
69
- await addNotification(student1.id, 'Welcome to Studious', 'Welcome to Studious');
1214
+ type: 'GROUP',
1215
+ name: 'Lab: Cell Structure Materials',
1216
+ displayInChat: false,
1217
+ }
1218
+ });
1219
+ // Add teacher to conversation
1220
+ await prisma.conversationMember.create({
1221
+ data: {
1222
+ userId: teachers[0].id,
1223
+ conversationId: labConversation.id,
1224
+ role: 'ADMIN',
1225
+ }
1226
+ });
1227
+ // Create lab chat
1228
+ await prisma.labChat.create({
1229
+ data: {
1230
+ title: 'Cell Structure Teaching Materials',
1231
+ context: labChatContext,
1232
+ classId: biologyClass.id,
1233
+ conversationId: labConversation.id,
1234
+ createdById: teachers[0].id,
1235
+ }
1236
+ });
1237
+ // 16. Create chat conversations and messages
1238
+ // Teacher-to-teacher conversations
1239
+ const teacherConversation1 = await prisma.conversation.create({
1240
+ data: {
1241
+ type: 'GROUP',
1242
+ name: 'Math Department Chat',
1243
+ displayInChat: true,
1244
+ }
1245
+ });
1246
+ // Add all teachers to department chat
1247
+ await Promise.all([
1248
+ prisma.conversationMember.create({
1249
+ data: {
1250
+ userId: teachers[0].id, // Sarah (Biology)
1251
+ conversationId: teacherConversation1.id,
1252
+ role: 'MEMBER',
1253
+ }
1254
+ }),
1255
+ prisma.conversationMember.create({
1256
+ data: {
1257
+ userId: teachers[1].id, // Michael (Math)
1258
+ conversationId: teacherConversation1.id,
1259
+ role: 'ADMIN',
1260
+ }
1261
+ }),
1262
+ prisma.conversationMember.create({
1263
+ data: {
1264
+ userId: teachers[2].id, // Emma (English)
1265
+ conversationId: teacherConversation1.id,
1266
+ role: 'MEMBER',
1267
+ }
1268
+ }),
1269
+ ]);
1270
+ // Teacher-student conversations
1271
+ const studentConversation1 = await prisma.conversation.create({
1272
+ data: {
1273
+ type: 'DM',
1274
+ name: null,
1275
+ displayInChat: true,
1276
+ }
1277
+ });
1278
+ await Promise.all([
1279
+ prisma.conversationMember.create({
1280
+ data: {
1281
+ userId: teachers[1].id, // Michael Chen
1282
+ conversationId: studentConversation1.id,
1283
+ role: 'MEMBER',
1284
+ }
1285
+ }),
1286
+ prisma.conversationMember.create({
1287
+ data: {
1288
+ userId: students[4].id, // Ethan Anderson
1289
+ conversationId: studentConversation1.id,
1290
+ role: 'MEMBER',
1291
+ }
1292
+ }),
1293
+ ]);
1294
+ const studentConversation2 = await prisma.conversation.create({
1295
+ data: {
1296
+ type: 'DM',
1297
+ name: null,
1298
+ displayInChat: true,
1299
+ }
1300
+ });
1301
+ await Promise.all([
1302
+ prisma.conversationMember.create({
1303
+ data: {
1304
+ userId: teachers[1].id, // Michael Chen
1305
+ conversationId: studentConversation2.id,
1306
+ role: 'MEMBER',
1307
+ }
1308
+ }),
1309
+ prisma.conversationMember.create({
1310
+ data: {
1311
+ userId: students[1].id, // Sophia Williams
1312
+ conversationId: studentConversation2.id,
1313
+ role: 'MEMBER',
1314
+ }
1315
+ }),
1316
+ ]);
1317
+ // Create messages in conversations
1318
+ const chatMessages = [
1319
+ // Teacher department chat messages
1320
+ {
1321
+ content: 'Hey everyone! Hope you all had a great weekend. Quick reminder about the faculty meeting tomorrow at noon.',
1322
+ senderId: teachers[1].id,
1323
+ conversationId: teacherConversation1.id,
1324
+ createdAt: new Date('2024-10-07T07:30:00'),
1325
+ },
1326
+ {
1327
+ content: 'Thanks for the reminder, Michael! I\'ll be there. Are we discussing the new curriculum standards?',
1328
+ senderId: teachers[0].id,
1329
+ conversationId: teacherConversation1.id,
1330
+ createdAt: new Date('2024-10-07T07:45:00'),
1331
+ },
1332
+ {
1333
+ content: 'Yes, among other things. Also wanted to coordinate on the parent-teacher conferences next week.',
1334
+ senderId: teachers[1].id,
1335
+ conversationId: teacherConversation1.id,
1336
+ createdAt: new Date('2024-10-07T08:00:00'),
1337
+ },
1338
+ {
1339
+ content: 'Perfect timing! I have several parents asking about their kids\' progress in my English classes.',
1340
+ senderId: teachers[2].id,
1341
+ conversationId: teacherConversation1.id,
1342
+ createdAt: new Date('2024-10-07T08:15:00'),
1343
+ },
1344
+ {
1345
+ content: 'The integration unit is going well in AP Calc. Students seem to be grasping the concepts better this year.',
1346
+ senderId: teachers[1].id,
1347
+ conversationId: teacherConversation1.id,
1348
+ createdAt: new Date('2024-10-08T16:30:00'),
1349
+ },
1350
+ {
1351
+ content: 'That\'s great to hear! I\'ve been incorporating more hands-on labs in biology and seeing similar improvements.',
1352
+ senderId: teachers[0].id,
1353
+ conversationId: teacherConversation1.id,
1354
+ createdAt: new Date('2024-10-08T16:45:00'),
1355
+ },
1356
+ {
1357
+ content: 'Anyone free for coffee after school tomorrow? Would love to chat about cross-curricular projects.',
1358
+ senderId: teachers[2].id,
1359
+ conversationId: teacherConversation1.id,
1360
+ createdAt: new Date('2024-10-09T14:00:00'),
1361
+ },
1362
+ {
1363
+ content: 'I\'m in! Math Club ends at 4:45, so anytime after 5 works for me.',
1364
+ senderId: teachers[1].id,
1365
+ conversationId: teacherConversation1.id,
1366
+ createdAt: new Date('2024-10-09T14:15:00'),
1367
+ },
1368
+ // Michael Chen with Ethan Anderson (struggling student)
1369
+ {
1370
+ content: 'Hi Mr. Chen, I\'m really struggling with the integration problems from today\'s class. Could you help explain substitution method again?',
1371
+ senderId: students[4].id,
1372
+ conversationId: studentConversation1.id,
1373
+ createdAt: new Date('2024-10-09T15:30:00'),
1374
+ },
1375
+ {
1376
+ content: 'Of course, Ethan! I\'m glad you reached out. The key is identifying what to substitute. Can you tell me which problem you\'re stuck on specifically?',
1377
+ senderId: teachers[1].id,
1378
+ conversationId: studentConversation1.id,
1379
+ createdAt: new Date('2024-10-09T15:45:00'),
1380
+ },
1381
+ {
1382
+ content: 'Problem #7 from the homework. I don\'t know how to choose what u should equal.',
1383
+ senderId: students[4].id,
1384
+ conversationId: studentConversation1.id,
1385
+ createdAt: new Date('2024-10-09T16:00:00'),
1386
+ },
1387
+ {
1388
+ content: 'Great question! For u-substitution, look for a function whose derivative also appears in the integral. In #7, try setting u equal to the expression inside the parentheses. What do you get when you differentiate that?',
1389
+ senderId: teachers[1].id,
1390
+ conversationId: studentConversation1.id,
1391
+ createdAt: new Date('2024-10-09T16:15:00'),
1392
+ },
1393
+ {
1394
+ content: 'Oh! So u = 2x + 1, and du = 2dx? That means I need to adjust for the 2...',
1395
+ senderId: students[4].id,
1396
+ conversationId: studentConversation1.id,
1397
+ createdAt: new Date('2024-10-09T17:00:00'),
1398
+ },
1399
+ {
1400
+ content: 'Exactly! You\'ve got it. Remember to substitute back at the end. Feel free to come to tutoring tomorrow if you need more practice.',
1401
+ senderId: teachers[1].id,
1402
+ conversationId: studentConversation1.id,
1403
+ createdAt: new Date('2024-10-09T17:15:00'),
1404
+ },
1405
+ {
1406
+ content: 'Thank you so much! This makes way more sense now. I\'ll definitely come to tutoring.',
1407
+ senderId: students[4].id,
1408
+ conversationId: studentConversation1.id,
1409
+ createdAt: new Date('2024-10-09T17:30:00'),
1410
+ },
1411
+ // Michael Chen with Sophia Williams (high-achieving student)
1412
+ {
1413
+ content: 'Hi Mr. Chen! I finished the integration homework early. Are there any extra challenge problems I could work on?',
1414
+ senderId: students[1].id,
1415
+ conversationId: studentConversation2.id,
1416
+ createdAt: new Date('2024-10-10T19:00:00'),
1417
+ },
1418
+ {
1419
+ content: 'Sophia, I love your enthusiasm! Try problems 45-50 from chapter 6. They involve integration by parts, which we\'ll cover next week.',
1420
+ senderId: teachers[1].id,
1421
+ conversationId: studentConversation2.id,
1422
+ createdAt: new Date('2024-10-10T19:30:00'),
1423
+ },
1424
+ {
1425
+ content: 'Perfect! I looked ahead in the textbook and the integration by parts formula looks interesting. Is it similar to the product rule for derivatives?',
1426
+ senderId: students[1].id,
1427
+ conversationId: studentConversation2.id,
1428
+ createdAt: new Date('2024-10-10T20:00:00'),
1429
+ },
1430
+ {
1431
+ content: 'You\'re absolutely right! Integration by parts is essentially the reverse of the product rule. You have a great mathematical intuition.',
1432
+ senderId: teachers[1].id,
1433
+ conversationId: studentConversation2.id,
1434
+ createdAt: new Date('2024-10-10T20:15:00'),
1435
+ },
1436
+ {
1437
+ content: 'Also, I wanted to ask about the Math Club competition. What topics should I focus on for preparation?',
1438
+ senderId: students[1].id,
1439
+ conversationId: studentConversation2.id,
1440
+ createdAt: new Date('2024-10-11T12:00:00'),
1441
+ },
1442
+ {
1443
+ content: 'Great question! Focus on algebra, geometry, and basic calculus. I\'ll have practice problems ready for tomorrow\'s Math Club meeting.',
1444
+ senderId: teachers[1].id,
1445
+ conversationId: studentConversation2.id,
1446
+ createdAt: new Date('2024-10-11T12:30:00'),
1447
+ },
1448
+ ];
1449
+ // Create all messages
1450
+ await Promise.all(chatMessages.map(message => prisma.message.create({ data: message })));
1451
+ // 16. Create file structure for classes
1452
+ await Promise.all([
1453
+ prisma.folder.create({
1454
+ data: {
1455
+ name: 'Class Files',
1456
+ classId: biologyClass.id,
1457
+ color: '#10B981',
1458
+ }
1459
+ }),
1460
+ prisma.folder.create({
1461
+ data: {
1462
+ name: 'Class Files',
1463
+ classId: mathClass.id,
1464
+ color: '#3B82F6',
1465
+ }
1466
+ }),
1467
+ prisma.folder.create({
1468
+ data: {
1469
+ name: 'Class Files',
1470
+ classId: englishClass.id,
1471
+ color: '#8B5CF6',
1472
+ }
1473
+ }),
1474
+ ]);
1475
+ logger.info('✅ Comprehensive demo database seeded successfully!');
1476
+ logger.info('📚 Created:');
1477
+ logger.info(' - 1 School (Riverside High School)');
1478
+ logger.info(' - 3 Teachers with detailed profiles');
1479
+ logger.info(' - 12 Students with profiles');
1480
+ logger.info(' - 3 Classes (AP Biology, AP Calculus BC, English Literature)');
1481
+ logger.info(' - 7 Course sections with color coding');
1482
+ logger.info(' - 2 Mark schemes with detailed rubrics');
1483
+ logger.info(' - 1 Grading boundary with weighted categories');
1484
+ logger.info(' - 9 Assignments (6 for Calc BC demo class)');
1485
+ logger.info(' - 64+ Student submissions with realistic grades & comments');
1486
+ logger.info(' - 3 Announcements from different teachers');
1487
+ logger.info(' - 3 Calendar events');
1488
+ logger.info(' - Attendance records with present/late/absent tracking');
1489
+ logger.info(' - 1 Lab chat for AI demo');
1490
+ logger.info(' - Multiple realistic notifications');
1491
+ logger.info(' - File organization structure');
1492
+ logger.info('');
1493
+ logger.info('🎯 AP Calculus BC Class (Demo Focus):');
1494
+ logger.info(' - 6 assignments with varied due dates');
1495
+ logger.info(' - Complete mark scheme & grading boundaries');
1496
+ logger.info(' - All 8 students have submissions to all assignments');
1497
+ logger.info(' - Realistic grade distribution & teacher feedback');
1498
+ logger.info(' - Rubric-based grading with detailed breakdowns');
1499
+ logger.info('');
1500
+ logger.info('🎬 Demo accounts:');
1501
+ logger.info(' Main Teacher: sarah.johnson@riverside.edu / demo123');
1502
+ logger.info(' Math Teacher: michael.chen@riverside.edu / demo123');
1503
+ logger.info(' English Teacher: emma.davis@riverside.edu / demo123');
1504
+ logger.info(' Student: alex.martinez@student.riverside.edu / student123');
70
1505
  };
71
1506
  (async () => {
72
1507
  logger.info('Seeding database');