@studious-lms/server 1.2.30 → 1.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/routers/_app.d.ts +228 -14
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/assignment.d.ts +84 -5
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +46 -2
- package/dist/routers/class.d.ts +22 -1
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +32 -6
- package/dist/routers/event.d.ts +8 -1
- package/dist/routers/event.d.ts.map +1 -1
- package/dist/seedDatabase.d.ts +0 -1
- package/dist/seedDatabase.d.ts.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +17 -8
- package/src/routers/assignment.ts +47 -3
- package/src/routers/class.ts +32 -6
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -81,8 +81,6 @@ model User {
|
|
|
81
81
|
verified Boolean @default(false)
|
|
82
82
|
role UserRole @default(NONE)
|
|
83
83
|
|
|
84
|
-
profileId String? @unique
|
|
85
|
-
|
|
86
84
|
teacherIn Class[] @relation("UserTeacherToClass")
|
|
87
85
|
studentIn Class[] @relation("UserStudentToClass")
|
|
88
86
|
|
|
@@ -90,6 +88,7 @@ model User {
|
|
|
90
88
|
sessions Session[]
|
|
91
89
|
files File[]
|
|
92
90
|
assignments Assignment[]
|
|
91
|
+
specificAssignments Assignment[] @relation("SpecificAssignmentAssignedTo")
|
|
93
92
|
events Event[]
|
|
94
93
|
announcements Announcement[]
|
|
95
94
|
notificationsSent Notification[] @relation("SentNotifications")
|
|
@@ -143,15 +142,16 @@ model Class {
|
|
|
143
142
|
events Event[]
|
|
144
143
|
sections Section[]
|
|
145
144
|
sessions Session[]
|
|
146
|
-
worksheets
|
|
145
|
+
worksheets Worksheet[]
|
|
147
146
|
students User[] @relation("UserStudentToClass")
|
|
148
147
|
teachers User[] @relation("UserTeacherToClass")
|
|
149
|
-
markSchemes MarkScheme[] @relation("ClassToMarkScheme")
|
|
150
|
-
gradingBoundaries GradingBoundary[] @relation("ClassToGradingBoundary")
|
|
148
|
+
// markSchemes MarkScheme[] @relation("ClassToMarkScheme")
|
|
149
|
+
// gradingBoundaries GradingBoundary[] @relation("ClassToGradingBoundary")
|
|
151
150
|
draftFiles File[] @relation("ClassDraftFiles")
|
|
152
151
|
classFiles Folder? @relation("ClassFiles")
|
|
153
152
|
labChats LabChat[] @relation("ClassLabChats")
|
|
154
|
-
|
|
153
|
+
markSchemes MarkScheme[]
|
|
154
|
+
gradingBoundaries GradingBoundary[]
|
|
155
155
|
school School? @relation(fields: [schoolId], references: [id])
|
|
156
156
|
schoolId String?
|
|
157
157
|
}
|
|
@@ -159,7 +159,8 @@ model Class {
|
|
|
159
159
|
model MarkScheme {
|
|
160
160
|
id String @id @default(uuid())
|
|
161
161
|
classId String
|
|
162
|
-
class Class[] @relation("ClassToMarkScheme")
|
|
162
|
+
// class Class[] @relation("ClassToMarkScheme")
|
|
163
|
+
class Class? @relation(fields: [classId], references: [id], onDelete: Cascade)
|
|
163
164
|
structured String
|
|
164
165
|
assignments Assignment[]
|
|
165
166
|
}
|
|
@@ -167,7 +168,8 @@ model MarkScheme {
|
|
|
167
168
|
model GradingBoundary {
|
|
168
169
|
id String @id @default(uuid())
|
|
169
170
|
classId String
|
|
170
|
-
class Class[] @relation("ClassToGradingBoundary")
|
|
171
|
+
// class Class[] @relation("ClassToGradingBoundary")
|
|
172
|
+
class Class? @relation(fields: [classId], references: [id], onDelete: Cascade)
|
|
171
173
|
structured String
|
|
172
174
|
assignments Assignment[]
|
|
173
175
|
}
|
|
@@ -251,7 +253,13 @@ model Assignment {
|
|
|
251
253
|
class Class @relation(fields: [classId], references: [id], onDelete: Cascade)
|
|
252
254
|
classId String
|
|
253
255
|
attachments File[]
|
|
256
|
+
acceptFiles Boolean @default(false)
|
|
257
|
+
acceptExtendedResponse Boolean @default(false)
|
|
258
|
+
acceptWorksheet Boolean @default(false)
|
|
259
|
+
gradeWithAI Boolean @default(false)
|
|
260
|
+
|
|
254
261
|
submissions Submission[]
|
|
262
|
+
assignedTo User[] @relation("SpecificAssignmentAssignedTo")
|
|
255
263
|
section Section? @relation(fields: [sectionId], references: [id], onDelete: Cascade)
|
|
256
264
|
sectionId String?
|
|
257
265
|
graded Boolean @default(false)
|
|
@@ -333,6 +341,7 @@ model Submission {
|
|
|
333
341
|
attachments File[] @relation("SubmissionFile")
|
|
334
342
|
annotations File[] @relation("SubmissionAnnotations")
|
|
335
343
|
worksheetResponses StudentWorksheetResponse[]
|
|
344
|
+
extendedResponse String?
|
|
336
345
|
|
|
337
346
|
gradeReceived Int?
|
|
338
347
|
|
|
@@ -25,6 +25,13 @@ const createAssignmentSchema = z.object({
|
|
|
25
25
|
dueDate: z.string(),
|
|
26
26
|
files: z.array(directFileSchema).optional(), // Use direct file schema
|
|
27
27
|
existingFileIds: z.array(z.string()).optional(),
|
|
28
|
+
aiPolicyLevel: z.number().default(0),
|
|
29
|
+
acceptFiles: z.boolean().optional(),
|
|
30
|
+
acceptExtendedResponse: z.boolean().optional(),
|
|
31
|
+
acceptWorksheet: z.boolean().optional(),
|
|
32
|
+
worksheetIds: z.array(z.string()).optional(),
|
|
33
|
+
gradeWithAI: z.boolean().optional(),
|
|
34
|
+
studentIds: z.array(z.string()).optional(),
|
|
28
35
|
maxGrade: z.number().optional(),
|
|
29
36
|
graded: z.boolean().optional(),
|
|
30
37
|
weight: z.number().optional(),
|
|
@@ -42,6 +49,13 @@ const updateAssignmentSchema = z.object({
|
|
|
42
49
|
instructions: z.string().optional(),
|
|
43
50
|
dueDate: z.string().optional(),
|
|
44
51
|
files: z.array(directFileSchema).optional(), // Use direct file schema
|
|
52
|
+
aiPolicyLevel: z.number().default(0),
|
|
53
|
+
acceptFiles: z.boolean().optional(),
|
|
54
|
+
acceptExtendedResponse: z.boolean().optional(),
|
|
55
|
+
acceptWorksheet: z.boolean().optional(),
|
|
56
|
+
worksheetIds: z.array(z.string()).optional(),
|
|
57
|
+
gradeWithAI: z.boolean().optional(),
|
|
58
|
+
studentIds: z.array(z.string()).optional(),
|
|
45
59
|
existingFileIds: z.array(z.string()).optional(),
|
|
46
60
|
removedAttachments: z.array(z.string()).optional(),
|
|
47
61
|
maxGrade: z.number().optional(),
|
|
@@ -307,7 +321,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
307
321
|
create: protectedProcedure
|
|
308
322
|
.input(createAssignmentSchema)
|
|
309
323
|
.mutation(async ({ ctx, input }) => {
|
|
310
|
-
const { classId, title, instructions, dueDate, files, existingFileIds, maxGrade, graded, weight, sectionId, type, markSchemeId, gradingBoundaryId, inProgress } = input;
|
|
324
|
+
const { classId, title, instructions, dueDate, files, existingFileIds, aiPolicyLevel, acceptFiles, acceptExtendedResponse, acceptWorksheet, worksheetIds, gradeWithAI, studentIds, maxGrade, graded, weight, sectionId, type, markSchemeId, gradingBoundaryId, inProgress } = input;
|
|
311
325
|
|
|
312
326
|
if (!ctx.user) {
|
|
313
327
|
throw new TRPCError({
|
|
@@ -364,7 +378,22 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
364
378
|
graded,
|
|
365
379
|
weight,
|
|
366
380
|
type,
|
|
367
|
-
|
|
381
|
+
...(aiPolicyLevel !== undefined && { aiPolicyLevel }),
|
|
382
|
+
acceptFiles,
|
|
383
|
+
acceptExtendedResponse,
|
|
384
|
+
acceptWorksheet,
|
|
385
|
+
...(worksheetIds && {
|
|
386
|
+
worksheets: {
|
|
387
|
+
connect: worksheetIds.map(id => ({ id }))
|
|
388
|
+
}
|
|
389
|
+
}),
|
|
390
|
+
gradeWithAI,
|
|
391
|
+
...(studentIds && {
|
|
392
|
+
assignedTo: {
|
|
393
|
+
connect: studentIds.map(id => ({ id }))
|
|
394
|
+
}
|
|
395
|
+
}),
|
|
396
|
+
order: 1,
|
|
368
397
|
inProgress: inProgress || false,
|
|
369
398
|
class: {
|
|
370
399
|
connect: { id: classId }
|
|
@@ -499,7 +528,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
499
528
|
update: protectedProcedure
|
|
500
529
|
.input(updateAssignmentSchema)
|
|
501
530
|
.mutation(async ({ ctx, input }) => {
|
|
502
|
-
const { id, title, instructions, dueDate, files, existingFileIds, maxGrade, graded, weight, sectionId, type, inProgress } = input;
|
|
531
|
+
const { id, title, instructions, dueDate, files, existingFileIds, worksheetIds, aiPolicyLevel, maxGrade, graded, weight, sectionId, type, inProgress, acceptFiles, acceptExtendedResponse, acceptWorksheet, gradeWithAI, studentIds } = input;
|
|
503
532
|
|
|
504
533
|
if (!ctx.user) {
|
|
505
534
|
throw new TRPCError({
|
|
@@ -590,6 +619,16 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
590
619
|
...(weight && { weight }),
|
|
591
620
|
...(type && { type }),
|
|
592
621
|
...(inProgress !== undefined && { inProgress }),
|
|
622
|
+
...(acceptFiles !== undefined && { acceptFiles }),
|
|
623
|
+
...(acceptExtendedResponse !== undefined && { acceptExtendedResponse }),
|
|
624
|
+
...(acceptWorksheet !== undefined && { acceptWorksheet }),
|
|
625
|
+
...(gradeWithAI !== undefined && { gradeWithAI }),
|
|
626
|
+
...(studentIds && {
|
|
627
|
+
assignedTo: {
|
|
628
|
+
connect: studentIds.map(id => ({ id }))
|
|
629
|
+
}
|
|
630
|
+
}),
|
|
631
|
+
...(aiPolicyLevel !== undefined && { aiPolicyLevel }),
|
|
593
632
|
...(sectionId !== undefined && {
|
|
594
633
|
section: sectionId ? {
|
|
595
634
|
connect: { id: sectionId }
|
|
@@ -597,6 +636,11 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
597
636
|
disconnect: true
|
|
598
637
|
}
|
|
599
638
|
}),
|
|
639
|
+
...(worksheetIds && {
|
|
640
|
+
worksheets: {
|
|
641
|
+
connect: worksheetIds.map(id => ({ id }))
|
|
642
|
+
}
|
|
643
|
+
}),
|
|
600
644
|
...(uploadedFiles.length > 0 && {
|
|
601
645
|
attachments: {
|
|
602
646
|
create: uploadedFiles.map(file => ({
|
package/src/routers/class.ts
CHANGED
|
@@ -669,7 +669,9 @@ export const classRouter = createTRPCRouter({
|
|
|
669
669
|
|
|
670
670
|
const markSchemes = await prisma.markScheme.findMany({
|
|
671
671
|
where: {
|
|
672
|
-
|
|
672
|
+
class: {
|
|
673
|
+
id: classId,
|
|
674
|
+
},
|
|
673
675
|
},
|
|
674
676
|
});
|
|
675
677
|
|
|
@@ -687,7 +689,11 @@ export const classRouter = createTRPCRouter({
|
|
|
687
689
|
|
|
688
690
|
const markScheme = await prisma.markScheme.create({
|
|
689
691
|
data: {
|
|
690
|
-
|
|
692
|
+
class: {
|
|
693
|
+
connect: {
|
|
694
|
+
id: classId,
|
|
695
|
+
},
|
|
696
|
+
},
|
|
691
697
|
structured: validatedStructure,
|
|
692
698
|
},
|
|
693
699
|
});
|
|
@@ -707,7 +713,14 @@ export const classRouter = createTRPCRouter({
|
|
|
707
713
|
|
|
708
714
|
const markScheme = await prisma.markScheme.update({
|
|
709
715
|
where: { id: markSchemeId },
|
|
710
|
-
data: {
|
|
716
|
+
data: {
|
|
717
|
+
class: {
|
|
718
|
+
connect: {
|
|
719
|
+
id: classId,
|
|
720
|
+
},
|
|
721
|
+
},
|
|
722
|
+
structured: validatedStructure,
|
|
723
|
+
},
|
|
711
724
|
});
|
|
712
725
|
|
|
713
726
|
return markScheme;
|
|
@@ -735,7 +748,9 @@ export const classRouter = createTRPCRouter({
|
|
|
735
748
|
|
|
736
749
|
const gradingBoundaries = await prisma.gradingBoundary.findMany({
|
|
737
750
|
where: {
|
|
738
|
-
|
|
751
|
+
class: {
|
|
752
|
+
id: classId,
|
|
753
|
+
},
|
|
739
754
|
},
|
|
740
755
|
});
|
|
741
756
|
|
|
@@ -753,7 +768,11 @@ export const classRouter = createTRPCRouter({
|
|
|
753
768
|
|
|
754
769
|
const gradingBoundary = await prisma.gradingBoundary.create({
|
|
755
770
|
data: {
|
|
756
|
-
|
|
771
|
+
class: {
|
|
772
|
+
connect: {
|
|
773
|
+
id: classId,
|
|
774
|
+
},
|
|
775
|
+
},
|
|
757
776
|
structured: validatedStructure,
|
|
758
777
|
},
|
|
759
778
|
});
|
|
@@ -773,7 +792,14 @@ export const classRouter = createTRPCRouter({
|
|
|
773
792
|
|
|
774
793
|
const gradingBoundary = await prisma.gradingBoundary.update({
|
|
775
794
|
where: { id: gradingBoundaryId },
|
|
776
|
-
data: {
|
|
795
|
+
data: {
|
|
796
|
+
class: {
|
|
797
|
+
connect: {
|
|
798
|
+
id: classId,
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
structured: validatedStructure,
|
|
802
|
+
},
|
|
777
803
|
});
|
|
778
804
|
|
|
779
805
|
return gradingBoundary;
|