@studious-lms/server 1.2.47 → 1.2.49

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 (38) hide show
  1. package/dist/index.js +22 -18
  2. package/dist/index.js.map +1 -1
  3. package/dist/middleware/security.d.ts.map +1 -1
  4. package/dist/middleware/security.js +4 -4
  5. package/dist/middleware/security.js.map +1 -1
  6. package/dist/routers/_app.d.ts +186 -0
  7. package/dist/routers/_app.d.ts.map +1 -1
  8. package/dist/routers/agenda.d.ts +52 -0
  9. package/dist/routers/agenda.d.ts.map +1 -1
  10. package/dist/routers/agenda.js +4 -2
  11. package/dist/routers/agenda.js.map +1 -1
  12. package/dist/routers/announcement.d.ts +20 -0
  13. package/dist/routers/announcement.d.ts.map +1 -1
  14. package/dist/routers/announcement.js +9 -2
  15. package/dist/routers/announcement.js.map +1 -1
  16. package/dist/routers/assignment.d.ts +3 -0
  17. package/dist/routers/assignment.d.ts.map +1 -1
  18. package/dist/routers/assignment.js +5 -2
  19. package/dist/routers/assignment.js.map +1 -1
  20. package/dist/routers/class.d.ts +18 -0
  21. package/dist/routers/class.d.ts.map +1 -1
  22. package/dist/routers/class.js +56 -2
  23. package/dist/routers/class.js.map +1 -1
  24. package/dist/routers/newtonChat.d.ts.map +1 -1
  25. package/dist/routers/newtonChat.js +5 -6
  26. package/dist/routers/newtonChat.js.map +1 -1
  27. package/dist/seedDatabase.d.ts.map +1 -1
  28. package/dist/seedDatabase.js +34 -8
  29. package/dist/seedDatabase.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/index.ts +24 -22
  32. package/src/middleware/security.ts +2 -2
  33. package/src/routers/agenda.ts +2 -0
  34. package/src/routers/announcement.ts +7 -0
  35. package/src/routers/assignment.ts +3 -0
  36. package/src/routers/class.ts +55 -0
  37. package/src/routers/newtonChat.ts +7 -9
  38. package/src/seedDatabase.ts +38 -6
@@ -1,5 +1,5 @@
1
1
 
2
- !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]="09930a12-9a9b-58e3-b149-ce107a08a4b0")}catch(e){}}();
2
+ !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]="4e5c4562-c500-5409-8250-b98dc8416587")}catch(e){}}();
3
3
  import { prisma } from "./lib/prisma.js";
4
4
  import { hash } from "bcryptjs";
5
5
  import { logger } from "./utils/logger.js";
@@ -8,6 +8,17 @@ export async function clearDatabase() {
8
8
  // Delete notifications first (they reference users)
9
9
  logger.info('Clearing database');
10
10
  await prisma.notification.deleteMany();
11
+ // Delete worksheet-related records
12
+ await prisma.studentQuestionProgress.deleteMany();
13
+ await prisma.studentWorksheetResponse.deleteMany();
14
+ await prisma.worksheetQuestion.deleteMany();
15
+ await prisma.worksheet.deleteMany();
16
+ // Delete reactions (they reference announcements and comments)
17
+ await prisma.reaction.deleteMany();
18
+ // Delete comments (they reference announcements and users)
19
+ await prisma.comment.deleteMany();
20
+ // Delete NewtonChat (they reference submissions and conversations)
21
+ await prisma.newtonChat.deleteMany();
11
22
  // Delete chat-related records
12
23
  await prisma.mention.deleteMany();
13
24
  await prisma.message.deleteMany();
@@ -33,9 +44,16 @@ export async function clearDatabase() {
33
44
  await prisma.user.deleteMany();
34
45
  // Delete schools (which reference files for logos) - this will cascade delete the file references
35
46
  await prisma.school.deleteMany();
47
+ // Delete marketing-related records
48
+ await prisma.schoolDevelopementProgram.deleteMany();
49
+ await prisma.earlyAccessRequest.deleteMany();
36
50
  // Finally delete all files
37
51
  await prisma.file.deleteMany();
38
52
  }
53
+ // Helper function to generate DiceBear avatar URL
54
+ function getDiceBearAvatar(seed) {
55
+ return `https://api.dicebear.com/7.x/avataaars/svg?seed=${encodeURIComponent(seed)}`;
56
+ }
39
57
  export async function createUser(email, password, username) {
40
58
  logger.debug("Creating user", { email, username, password });
41
59
  const hashedPassword = await hash(password, 10);
@@ -93,7 +111,7 @@ export const seedDatabase = async () => {
93
111
  createUser('lucas.lewis@student.riverside.edu', 'student123', 'lucas.lewis'),
94
112
  createUser('charlotte.walker@student.riverside.edu', 'student123', 'charlotte.walker'),
95
113
  ]);
96
- // 4. Create User Profiles
114
+ // 4. Create User Profiles with DiceBear avatars
97
115
  await Promise.all([
98
116
  prisma.userProfile.create({
99
117
  data: {
@@ -102,6 +120,7 @@ export const seedDatabase = async () => {
102
120
  bio: 'Biology teacher with 15 years of experience. Passionate about making science accessible to all students.',
103
121
  location: 'Riverside, CA',
104
122
  website: 'https://sarahjohnson-bio.com',
123
+ profilePicture: getDiceBearAvatar(teachers[0].username),
105
124
  }
106
125
  }),
107
126
  prisma.userProfile.create({
@@ -110,6 +129,7 @@ export const seedDatabase = async () => {
110
129
  displayName: 'Mr. Michael Chen',
111
130
  bio: 'Mathematics teacher and department head. Specializes in AP Calculus and Statistics.',
112
131
  location: 'Riverside, CA',
132
+ profilePicture: getDiceBearAvatar(teachers[1].username),
113
133
  }
114
134
  }),
115
135
  prisma.userProfile.create({
@@ -118,17 +138,23 @@ export const seedDatabase = async () => {
118
138
  displayName: 'Ms. Emma Davis',
119
139
  bio: 'English Literature teacher. Loves fostering creative writing and critical thinking.',
120
140
  location: 'Riverside, CA',
141
+ profilePicture: getDiceBearAvatar(teachers[2].username),
121
142
  }
122
143
  }),
123
144
  ]);
124
- // Add profiles for some students
125
- await Promise.all(students.slice(0, 6).map((student, index) => {
126
- const names = ['Alex Martinez', 'Sophia Williams', 'James Brown', 'Olivia Taylor', 'Ethan Anderson', 'Ava Thomas'];
145
+ // Add profiles for all students with DiceBear avatars
146
+ await Promise.all(students.map((student, index) => {
147
+ const names = [
148
+ 'Alex Martinez', 'Sophia Williams', 'James Brown', 'Olivia Taylor',
149
+ 'Ethan Anderson', 'Ava Thomas', 'Noah Jackson', 'Isabella White',
150
+ 'Liam Harris', 'Mia Clark', 'Lucas Lewis', 'Charlotte Walker'
151
+ ];
127
152
  return prisma.userProfile.create({
128
153
  data: {
129
154
  userId: student.id,
130
- displayName: names[index],
131
- bio: `Grade 11 student at Riverside High School.`,
155
+ displayName: names[index] || student.username,
156
+ bio: index < 6 ? `Grade 11 student at Riverside High School.` : undefined,
157
+ profilePicture: getDiceBearAvatar(student.username),
132
158
  }
133
159
  });
134
160
  }));
@@ -1503,4 +1529,4 @@ if (isSeedScript) {
1503
1529
  })();
1504
1530
  }
1505
1531
  //# sourceMappingURL=seedDatabase.js.map
1506
- //# debugId=09930a12-9a9b-58e3-b149-ce107a08a4b0
1532
+ //# debugId=4e5c4562-c500-5409-8250-b98dc8416587