@studious-lms/server 1.2.32 → 1.2.34
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 +132 -88
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/announcement.js +9 -9
- package/dist/routers/assignment.d.ts +32 -18
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +337 -219
- package/dist/routers/class.d.ts +7 -7
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +18 -2
- package/dist/routers/event.d.ts +2 -2
- package/dist/routers/worksheet.d.ts +39 -31
- package/dist/routers/worksheet.d.ts.map +1 -1
- package/dist/routers/worksheet.js +40 -12
- package/package.json +1 -1
- package/prisma/schema.prisma +11 -9
- package/src/routers/announcement.ts +9 -9
- package/src/routers/assignment.ts +443 -310
- package/src/routers/class.ts +18 -2
- package/src/routers/worksheet.ts +44 -12
package/dist/routers/class.d.ts
CHANGED
|
@@ -75,8 +75,8 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
75
75
|
}[];
|
|
76
76
|
assignments: {
|
|
77
77
|
late: boolean;
|
|
78
|
-
submitted: boolean;
|
|
79
|
-
returned: boolean;
|
|
78
|
+
submitted: boolean | null | undefined;
|
|
79
|
+
returned: boolean | null | undefined;
|
|
80
80
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
81
81
|
id: string;
|
|
82
82
|
submissions: {
|
|
@@ -560,9 +560,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
560
560
|
acceptExtendedResponse: boolean;
|
|
561
561
|
acceptWorksheet: boolean;
|
|
562
562
|
gradeWithAI: boolean;
|
|
563
|
+
aiPolicyLevel: number;
|
|
563
564
|
inProgress: boolean;
|
|
564
565
|
order: number | null;
|
|
565
|
-
worksheetId: string | null;
|
|
566
566
|
}[];
|
|
567
567
|
meta: object;
|
|
568
568
|
}>;
|
|
@@ -603,9 +603,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
603
603
|
acceptExtendedResponse: boolean;
|
|
604
604
|
acceptWorksheet: boolean;
|
|
605
605
|
gradeWithAI: boolean;
|
|
606
|
+
aiPolicyLevel: number;
|
|
606
607
|
inProgress: boolean;
|
|
607
608
|
order: number | null;
|
|
608
|
-
worksheetId: string | null;
|
|
609
609
|
};
|
|
610
610
|
meta: object;
|
|
611
611
|
}>;
|
|
@@ -646,9 +646,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
646
646
|
acceptExtendedResponse: boolean;
|
|
647
647
|
acceptWorksheet: boolean;
|
|
648
648
|
gradeWithAI: boolean;
|
|
649
|
+
aiPolicyLevel: number;
|
|
649
650
|
inProgress: boolean;
|
|
650
651
|
order: number | null;
|
|
651
|
-
worksheetId: string | null;
|
|
652
652
|
};
|
|
653
653
|
meta: object;
|
|
654
654
|
}>;
|
|
@@ -680,9 +680,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
680
680
|
acceptExtendedResponse: boolean;
|
|
681
681
|
acceptWorksheet: boolean;
|
|
682
682
|
gradeWithAI: boolean;
|
|
683
|
+
aiPolicyLevel: number;
|
|
683
684
|
inProgress: boolean;
|
|
684
685
|
order: number | null;
|
|
685
|
-
worksheetId: string | null;
|
|
686
686
|
};
|
|
687
687
|
meta: object;
|
|
688
688
|
}>;
|
|
@@ -718,9 +718,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
718
718
|
acceptExtendedResponse: boolean;
|
|
719
719
|
acceptWorksheet: boolean;
|
|
720
720
|
gradeWithAI: boolean;
|
|
721
|
+
aiPolicyLevel: number;
|
|
721
722
|
inProgress: boolean;
|
|
722
723
|
order: number | null;
|
|
723
|
-
worksheetId: string | null;
|
|
724
724
|
};
|
|
725
725
|
meta: object;
|
|
726
726
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/routers/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/routers/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwnCtB,CAAC"}
|
package/dist/routers/class.js
CHANGED
|
@@ -149,6 +149,22 @@ export const classRouter = createTRPCRouter({
|
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
151
|
assignments: {
|
|
152
|
+
...(!isTeacher && {
|
|
153
|
+
where: { OR: [
|
|
154
|
+
{
|
|
155
|
+
assignedTo: {
|
|
156
|
+
some: {
|
|
157
|
+
id: ctx.user?.id,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
assignedTo: {
|
|
163
|
+
none: {},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
], }
|
|
167
|
+
}),
|
|
152
168
|
select: {
|
|
153
169
|
type: true,
|
|
154
170
|
id: true,
|
|
@@ -209,8 +225,8 @@ export const classRouter = createTRPCRouter({
|
|
|
209
225
|
assignments: classData.assignments.map(assignment => ({
|
|
210
226
|
...assignment,
|
|
211
227
|
late: assignment.dueDate < new Date(),
|
|
212
|
-
submitted: assignment.submissions.
|
|
213
|
-
returned: assignment.submissions.
|
|
228
|
+
submitted: assignment.submissions.find(submission => submission.studentId === ctx.user?.id)?.submitted,
|
|
229
|
+
returned: assignment.submissions.find(submission => submission.studentId === ctx.user?.id)?.returned,
|
|
214
230
|
})),
|
|
215
231
|
};
|
|
216
232
|
const sections = await prisma.section.findMany({
|
package/dist/routers/event.d.ts
CHANGED
|
@@ -185,9 +185,9 @@ export declare const eventRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
185
185
|
acceptExtendedResponse: boolean;
|
|
186
186
|
acceptWorksheet: boolean;
|
|
187
187
|
gradeWithAI: boolean;
|
|
188
|
+
aiPolicyLevel: number;
|
|
188
189
|
inProgress: boolean;
|
|
189
190
|
order: number | null;
|
|
190
|
-
worksheetId: string | null;
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
193
|
meta: object;
|
|
@@ -234,9 +234,9 @@ export declare const eventRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
234
234
|
acceptExtendedResponse: boolean;
|
|
235
235
|
acceptWorksheet: boolean;
|
|
236
236
|
gradeWithAI: boolean;
|
|
237
|
+
aiPolicyLevel: number;
|
|
237
238
|
inProgress: boolean;
|
|
238
239
|
order: number | null;
|
|
239
|
-
worksheetId: string | null;
|
|
240
240
|
};
|
|
241
241
|
};
|
|
242
242
|
meta: object;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
3
|
-
ctx: import("
|
|
3
|
+
ctx: import("../trpc.js").Context;
|
|
4
4
|
meta: object;
|
|
5
5
|
errorShape: {
|
|
6
6
|
data: {
|
|
7
7
|
zodError: z.typeToFlattenedError<any, string> | null;
|
|
8
|
-
prismaError: import("../utils/prismaErrorHandler").PrismaErrorInfo | null;
|
|
8
|
+
prismaError: import("../utils/prismaErrorHandler.js").PrismaErrorInfo | null;
|
|
9
9
|
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
10
10
|
httpStatus: number;
|
|
11
11
|
path?: string;
|
|
@@ -33,13 +33,14 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
33
33
|
questions: {
|
|
34
34
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
35
35
|
id: string;
|
|
36
|
-
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
36
|
+
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
37
37
|
createdAt: Date;
|
|
38
38
|
order: number | null;
|
|
39
|
-
|
|
40
|
-
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
39
|
+
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
41
40
|
updatedAt: Date;
|
|
41
|
+
points: number | null;
|
|
42
42
|
question: string;
|
|
43
|
+
worksheetId: string;
|
|
43
44
|
answer: string;
|
|
44
45
|
}[];
|
|
45
46
|
} & {
|
|
@@ -112,32 +113,34 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
112
113
|
addQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
113
114
|
input: {
|
|
114
115
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
115
|
-
worksheetId: string;
|
|
116
116
|
question: string;
|
|
117
|
+
worksheetId: string;
|
|
117
118
|
answer: string;
|
|
118
119
|
options?: any;
|
|
119
120
|
markScheme?: any;
|
|
121
|
+
points?: number | undefined;
|
|
120
122
|
};
|
|
121
123
|
output: {
|
|
122
124
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
123
125
|
id: string;
|
|
124
|
-
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
126
|
+
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
125
127
|
createdAt: Date;
|
|
126
128
|
order: number | null;
|
|
127
|
-
|
|
128
|
-
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
129
|
+
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
129
130
|
updatedAt: Date;
|
|
131
|
+
points: number | null;
|
|
130
132
|
question: string;
|
|
133
|
+
worksheetId: string;
|
|
131
134
|
answer: string;
|
|
132
135
|
};
|
|
133
136
|
meta: object;
|
|
134
137
|
}>;
|
|
135
138
|
reorderQuestions: import("@trpc/server").TRPCMutationProcedure<{
|
|
136
139
|
input: {
|
|
137
|
-
worksheetId: string;
|
|
138
140
|
movedId: string;
|
|
139
141
|
position: "before" | "after";
|
|
140
142
|
targetId: string;
|
|
143
|
+
worksheetId: string;
|
|
141
144
|
};
|
|
142
145
|
output: {
|
|
143
146
|
id: string;
|
|
@@ -151,19 +154,21 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
151
154
|
type?: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION" | undefined;
|
|
152
155
|
options?: any;
|
|
153
156
|
markScheme?: any;
|
|
157
|
+
points?: number | undefined;
|
|
154
158
|
question?: string | undefined;
|
|
155
159
|
answer?: string | undefined;
|
|
156
160
|
};
|
|
157
161
|
output: {
|
|
158
162
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
159
163
|
id: string;
|
|
160
|
-
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
164
|
+
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
161
165
|
createdAt: Date;
|
|
162
166
|
order: number | null;
|
|
163
|
-
|
|
164
|
-
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
167
|
+
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
165
168
|
updatedAt: Date;
|
|
169
|
+
points: number | null;
|
|
166
170
|
question: string;
|
|
171
|
+
worksheetId: string;
|
|
167
172
|
answer: string;
|
|
168
173
|
};
|
|
169
174
|
meta: object;
|
|
@@ -176,13 +181,14 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
176
181
|
output: {
|
|
177
182
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
178
183
|
id: string;
|
|
179
|
-
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
184
|
+
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
180
185
|
createdAt: Date;
|
|
181
186
|
order: number | null;
|
|
182
|
-
|
|
183
|
-
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
187
|
+
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
184
188
|
updatedAt: Date;
|
|
189
|
+
points: number | null;
|
|
185
190
|
question: string;
|
|
191
|
+
worksheetId: string;
|
|
186
192
|
answer: string;
|
|
187
193
|
};
|
|
188
194
|
meta: object;
|
|
@@ -192,7 +198,7 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
192
198
|
submissionId: string;
|
|
193
199
|
worksheetId: string;
|
|
194
200
|
};
|
|
195
|
-
output:
|
|
201
|
+
output: {
|
|
196
202
|
responses: {
|
|
197
203
|
id: string;
|
|
198
204
|
feedback: string | null;
|
|
@@ -209,11 +215,11 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
209
215
|
submissionId: string | null;
|
|
210
216
|
studentId: string;
|
|
211
217
|
createdAt: Date;
|
|
212
|
-
worksheetId: string;
|
|
213
218
|
updatedAt: Date;
|
|
214
219
|
submittedAt: Date | null;
|
|
215
220
|
submitted: boolean;
|
|
216
|
-
|
|
221
|
+
worksheetId: string;
|
|
222
|
+
};
|
|
217
223
|
meta: object;
|
|
218
224
|
}>;
|
|
219
225
|
answerQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -239,10 +245,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
239
245
|
submissionId: string | null;
|
|
240
246
|
studentId: string;
|
|
241
247
|
createdAt: Date;
|
|
242
|
-
worksheetId: string;
|
|
243
248
|
updatedAt: Date;
|
|
244
249
|
submittedAt: Date | null;
|
|
245
250
|
submitted: boolean;
|
|
251
|
+
worksheetId: string;
|
|
246
252
|
}) | null;
|
|
247
253
|
meta: object;
|
|
248
254
|
}>;
|
|
@@ -267,10 +273,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
267
273
|
submissionId: string | null;
|
|
268
274
|
studentId: string;
|
|
269
275
|
createdAt: Date;
|
|
270
|
-
worksheetId: string;
|
|
271
276
|
updatedAt: Date;
|
|
272
277
|
submittedAt: Date | null;
|
|
273
278
|
submitted: boolean;
|
|
279
|
+
worksheetId: string;
|
|
274
280
|
};
|
|
275
281
|
meta: object;
|
|
276
282
|
}>;
|
|
@@ -284,13 +290,14 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
284
290
|
question: {
|
|
285
291
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
286
292
|
id: string;
|
|
287
|
-
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
293
|
+
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
288
294
|
createdAt: Date;
|
|
289
295
|
order: number | null;
|
|
290
|
-
|
|
291
|
-
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
296
|
+
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
292
297
|
updatedAt: Date;
|
|
298
|
+
points: number | null;
|
|
293
299
|
question: string;
|
|
300
|
+
worksheetId: string;
|
|
294
301
|
answer: string;
|
|
295
302
|
};
|
|
296
303
|
} & {
|
|
@@ -309,14 +316,14 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
309
316
|
submissionId: string | null;
|
|
310
317
|
studentId: string;
|
|
311
318
|
createdAt: Date;
|
|
312
|
-
worksheetId: string;
|
|
313
319
|
updatedAt: Date;
|
|
314
320
|
submittedAt: Date | null;
|
|
315
321
|
submitted: boolean;
|
|
322
|
+
worksheetId: string;
|
|
316
323
|
};
|
|
317
324
|
meta: object;
|
|
318
325
|
}>;
|
|
319
|
-
|
|
326
|
+
getWorksheetResponse: import("@trpc/server").TRPCQueryProcedure<{
|
|
320
327
|
input: {
|
|
321
328
|
worksheetId: string;
|
|
322
329
|
};
|
|
@@ -333,13 +340,14 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
333
340
|
question: {
|
|
334
341
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
335
342
|
id: string;
|
|
336
|
-
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
343
|
+
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
337
344
|
createdAt: Date;
|
|
338
345
|
order: number | null;
|
|
339
|
-
|
|
340
|
-
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
346
|
+
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
341
347
|
updatedAt: Date;
|
|
348
|
+
points: number | null;
|
|
342
349
|
question: string;
|
|
350
|
+
worksheetId: string;
|
|
343
351
|
answer: string;
|
|
344
352
|
};
|
|
345
353
|
} & {
|
|
@@ -358,11 +366,11 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
358
366
|
submissionId: string | null;
|
|
359
367
|
studentId: string;
|
|
360
368
|
createdAt: Date;
|
|
361
|
-
worksheetId: string;
|
|
362
369
|
updatedAt: Date;
|
|
363
370
|
submittedAt: Date | null;
|
|
364
371
|
submitted: boolean;
|
|
365
|
-
|
|
372
|
+
worksheetId: string;
|
|
373
|
+
}) | null;
|
|
366
374
|
meta: object;
|
|
367
375
|
}>;
|
|
368
376
|
gradeAnswer: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet.d.ts","sourceRoot":"","sources":["../../src/routers/worksheet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"worksheet.d.ts","sourceRoot":"","sources":["../../src/routers/worksheet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA6KA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0UhC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TRPCError } from "@trpc/server";
|
|
2
|
-
import { createTRPCRouter, protectedProcedure } from "
|
|
2
|
+
import { createTRPCRouter, protectedProcedure } from "../trpc.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { prisma } from "
|
|
4
|
+
import { prisma } from "../lib/prisma.js";
|
|
5
5
|
export const worksheetRouter = createTRPCRouter({
|
|
6
6
|
// Get a single worksheet with all questions
|
|
7
7
|
getWorksheet: protectedProcedure
|
|
@@ -95,12 +95,13 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
95
95
|
worksheetId: z.string(),
|
|
96
96
|
question: z.string(),
|
|
97
97
|
answer: z.string(),
|
|
98
|
+
points: z.number().optional(),
|
|
98
99
|
options: z.any().optional(), // JSON field
|
|
99
100
|
markScheme: z.any().optional(), // JSON field
|
|
100
101
|
type: z.enum(['MULTIPLE_CHOICE', 'TRUE_FALSE', 'SHORT_ANSWER', 'LONG_ANSWER', 'MATH_EXPRESSION', 'ESSAY']),
|
|
101
102
|
}))
|
|
102
103
|
.mutation(async ({ ctx, input }) => {
|
|
103
|
-
const { worksheetId, question, answer, options, markScheme, type } = input;
|
|
104
|
+
const { worksheetId, question, points, answer, options, markScheme, type } = input;
|
|
104
105
|
const worksheet = await prisma.worksheet.findUnique({
|
|
105
106
|
where: { id: worksheetId },
|
|
106
107
|
});
|
|
@@ -111,6 +112,7 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
111
112
|
data: {
|
|
112
113
|
worksheetId,
|
|
113
114
|
type,
|
|
115
|
+
points,
|
|
114
116
|
question,
|
|
115
117
|
answer,
|
|
116
118
|
options,
|
|
@@ -167,12 +169,13 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
167
169
|
questionId: z.string(),
|
|
168
170
|
question: z.string().optional(),
|
|
169
171
|
answer: z.string().optional(),
|
|
172
|
+
points: z.number().optional(),
|
|
170
173
|
options: z.any().optional(), // JSON field
|
|
171
174
|
markScheme: z.any().optional(), // JSON field
|
|
172
175
|
type: z.enum(['MULTIPLE_CHOICE', 'TRUE_FALSE', 'SHORT_ANSWER', 'LONG_ANSWER', 'MATH_EXPRESSION', 'ESSAY']).optional(),
|
|
173
176
|
}))
|
|
174
177
|
.mutation(async ({ ctx, input }) => {
|
|
175
|
-
const { worksheetId, questionId, question, answer, options, markScheme, type } = input;
|
|
178
|
+
const { worksheetId, questionId, points, question, answer, options, markScheme, type } = input;
|
|
176
179
|
const worksheet = await prisma.worksheet.findUnique({
|
|
177
180
|
where: { id: worksheetId },
|
|
178
181
|
});
|
|
@@ -186,6 +189,8 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
186
189
|
...(answer !== undefined && { answer }),
|
|
187
190
|
...(markScheme !== undefined && { markScheme }),
|
|
188
191
|
...(type !== undefined && { type }),
|
|
192
|
+
...(options !== undefined && { options }),
|
|
193
|
+
...(points !== undefined && { points }),
|
|
189
194
|
},
|
|
190
195
|
});
|
|
191
196
|
return updatedQuestion;
|
|
@@ -221,13 +226,36 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
221
226
|
if (!submission) {
|
|
222
227
|
throw new TRPCError({ code: 'NOT_FOUND', message: 'Submission not found' });
|
|
223
228
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
// Find or create worksheet response for this submission
|
|
230
|
+
const worksheetResponse = await prisma.$transaction(async (tx) => {
|
|
231
|
+
// First check if a response exists
|
|
232
|
+
const existing = await tx.studentWorksheetResponse.findFirst({
|
|
233
|
+
where: {
|
|
234
|
+
submissionId,
|
|
235
|
+
worksheetId
|
|
236
|
+
},
|
|
237
|
+
include: {
|
|
238
|
+
responses: true,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
if (existing) {
|
|
242
|
+
return existing;
|
|
243
|
+
}
|
|
244
|
+
// Create new response if it doesn't exist
|
|
245
|
+
const created = await tx.studentWorksheetResponse.create({
|
|
246
|
+
data: {
|
|
247
|
+
worksheetId,
|
|
248
|
+
submissionId,
|
|
249
|
+
studentId: submission.studentId,
|
|
250
|
+
},
|
|
251
|
+
include: {
|
|
252
|
+
responses: true,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
return created;
|
|
229
256
|
});
|
|
230
|
-
|
|
257
|
+
console.log(worksheetResponse);
|
|
258
|
+
return worksheetResponse;
|
|
231
259
|
}),
|
|
232
260
|
answerQuestion: protectedProcedure
|
|
233
261
|
.input(z.object({
|
|
@@ -358,13 +386,13 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
358
386
|
return worksheetResponse;
|
|
359
387
|
}),
|
|
360
388
|
// Get all student responses for a worksheet (teacher view)
|
|
361
|
-
|
|
389
|
+
getWorksheetResponse: protectedProcedure
|
|
362
390
|
.input(z.object({
|
|
363
391
|
worksheetId: z.string(),
|
|
364
392
|
}))
|
|
365
393
|
.query(async ({ ctx, input }) => {
|
|
366
394
|
const { worksheetId } = input;
|
|
367
|
-
const responses = await prisma.studentWorksheetResponse.
|
|
395
|
+
const responses = await prisma.studentWorksheetResponse.findFirst({
|
|
368
396
|
where: { worksheetId },
|
|
369
397
|
include: {
|
|
370
398
|
student: {
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -108,7 +108,7 @@ model User {
|
|
|
108
108
|
sentMessages Message[] @relation("SentMessages")
|
|
109
109
|
mentions Mention[] @relation("UserMentions")
|
|
110
110
|
createdLabChats LabChat[] @relation("CreatedLabChats")
|
|
111
|
-
|
|
111
|
+
comments Comment[]
|
|
112
112
|
reactions Reaction[]
|
|
113
113
|
|
|
114
114
|
}
|
|
@@ -258,6 +258,8 @@ model Assignment {
|
|
|
258
258
|
acceptWorksheet Boolean @default(false)
|
|
259
259
|
gradeWithAI Boolean @default(false)
|
|
260
260
|
|
|
261
|
+
aiPolicyLevel Int @default(0)
|
|
262
|
+
|
|
261
263
|
submissions Submission[]
|
|
262
264
|
assignedTo User[] @relation("SpecificAssignmentAssignedTo")
|
|
263
265
|
section Section? @relation(fields: [sectionId], references: [id], onDelete: Cascade)
|
|
@@ -275,8 +277,7 @@ model Assignment {
|
|
|
275
277
|
order Int?
|
|
276
278
|
gradingBoundary GradingBoundary? @relation(fields: [gradingBoundaryId], references: [id], onDelete: Cascade)
|
|
277
279
|
gradingBoundaryId String?
|
|
278
|
-
|
|
279
|
-
worksheetId String?
|
|
280
|
+
worksheets Worksheet[] @relation("AssignmentWorksheets")
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
|
|
@@ -291,20 +292,20 @@ model Announcement {
|
|
|
291
292
|
class Class @relation(fields: [classId], references: [id], onDelete: Cascade)
|
|
292
293
|
classId String
|
|
293
294
|
attachments File[] @relation("AnnouncementAttachments")
|
|
294
|
-
comments
|
|
295
|
+
comments Comment[]
|
|
295
296
|
reactions Reaction[]
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
model
|
|
299
|
+
model Comment {
|
|
299
300
|
id String @id @default(uuid())
|
|
300
301
|
content String
|
|
301
302
|
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
|
|
302
303
|
authorId String
|
|
303
304
|
announcement Announcement @relation(fields: [announcementId], references: [id], onDelete: Cascade)
|
|
304
305
|
announcementId String
|
|
305
|
-
parentComment
|
|
306
|
+
parentComment Comment? @relation("CommentReplies", fields: [parentCommentId], references: [id], onDelete: Cascade)
|
|
306
307
|
parentCommentId String?
|
|
307
|
-
replies
|
|
308
|
+
replies Comment[] @relation("CommentReplies")
|
|
308
309
|
reactions Reaction[]
|
|
309
310
|
createdAt DateTime @default(now())
|
|
310
311
|
modifiedAt DateTime? @updatedAt
|
|
@@ -317,7 +318,7 @@ model Reaction {
|
|
|
317
318
|
userId String
|
|
318
319
|
announcement Announcement? @relation(fields: [announcementId], references: [id], onDelete: Cascade)
|
|
319
320
|
announcementId String?
|
|
320
|
-
comment
|
|
321
|
+
comment Comment? @relation(fields: [commentId], references: [id], onDelete: Cascade)
|
|
321
322
|
commentId String?
|
|
322
323
|
createdAt DateTime @default(now())
|
|
323
324
|
|
|
@@ -502,7 +503,7 @@ model Worksheet {
|
|
|
502
503
|
updatedAt DateTime @updatedAt
|
|
503
504
|
classId String
|
|
504
505
|
class Class? @relation(fields: [classId], references: [id], onDelete: Cascade)
|
|
505
|
-
assignments Assignment[]
|
|
506
|
+
assignments Assignment[] @relation("AssignmentWorksheets")
|
|
506
507
|
questions WorksheetQuestion[]
|
|
507
508
|
studentWorksheetResponses StudentWorksheetResponse[]
|
|
508
509
|
}
|
|
@@ -516,6 +517,7 @@ model WorksheetQuestion {
|
|
|
516
517
|
answer String
|
|
517
518
|
options Json? @default("{}")
|
|
518
519
|
markScheme Json? @default("{}")
|
|
520
|
+
points Int? @default(0)
|
|
519
521
|
order Int? @default(0)
|
|
520
522
|
createdAt DateTime @default(now())
|
|
521
523
|
updatedAt DateTime @updatedAt
|
|
@@ -523,7 +523,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
523
523
|
|
|
524
524
|
// If replying to a comment, verify parent comment exists and belongs to the same announcement
|
|
525
525
|
if (input.parentCommentId) {
|
|
526
|
-
const parentComment = await prisma.
|
|
526
|
+
const parentComment = await prisma.comment.findFirst({
|
|
527
527
|
where: {
|
|
528
528
|
id: input.parentCommentId,
|
|
529
529
|
announcementId: input.announcementId,
|
|
@@ -538,7 +538,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
-
const comment = await prisma.
|
|
541
|
+
const comment = await prisma.comment.create({
|
|
542
542
|
data: {
|
|
543
543
|
content: input.content,
|
|
544
544
|
author: {
|
|
@@ -586,7 +586,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
586
586
|
});
|
|
587
587
|
}
|
|
588
588
|
|
|
589
|
-
const comment = await prisma.
|
|
589
|
+
const comment = await prisma.comment.findUnique({
|
|
590
590
|
where: { id: input.id },
|
|
591
591
|
});
|
|
592
592
|
|
|
@@ -605,7 +605,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
607
|
|
|
608
|
-
const updatedComment = await prisma.
|
|
608
|
+
const updatedComment = await prisma.comment.update({
|
|
609
609
|
where: { id: input.id },
|
|
610
610
|
data: {
|
|
611
611
|
content: input.content,
|
|
@@ -642,7 +642,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
-
const comment = await prisma.
|
|
645
|
+
const comment = await prisma.comment.findUnique({
|
|
646
646
|
where: { id: input.id },
|
|
647
647
|
include: {
|
|
648
648
|
announcement: {
|
|
@@ -678,7 +678,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
-
await prisma.
|
|
681
|
+
await prisma.comment.delete({
|
|
682
682
|
where: { id: input.id },
|
|
683
683
|
});
|
|
684
684
|
|
|
@@ -707,7 +707,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
// Get all top-level comments (no parent)
|
|
710
|
-
const comments = await prisma.
|
|
710
|
+
const comments = await prisma.comment.findMany({
|
|
711
711
|
where: {
|
|
712
712
|
announcementId: input.announcementId,
|
|
713
713
|
parentCommentId: null,
|
|
@@ -840,7 +840,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
840
840
|
return { reaction };
|
|
841
841
|
} else if (input.commentId) {
|
|
842
842
|
// Verify comment exists and get its announcement to check class
|
|
843
|
-
|
|
843
|
+
const comment = await prisma.comment.findUnique({
|
|
844
844
|
where: { id: input.commentId },
|
|
845
845
|
include: {
|
|
846
846
|
announcement: {
|
|
@@ -1060,7 +1060,7 @@ export const announcementRouter = createTRPCRouter({
|
|
|
1060
1060
|
};
|
|
1061
1061
|
} else if (input.commentId) {
|
|
1062
1062
|
// Verify comment exists
|
|
1063
|
-
const comment = await prisma.
|
|
1063
|
+
const comment = await prisma.comment.findUnique({
|
|
1064
1064
|
where: { id: input.commentId },
|
|
1065
1065
|
include: {
|
|
1066
1066
|
announcement: {
|