@studious-lms/server 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/models/marketplace.d.ts +35 -0
- package/dist/models/marketplace.d.ts.map +1 -1
- package/dist/models/marketplace.js +9 -2
- package/dist/models/marketplace.js.map +1 -1
- package/dist/models/module.d.ts +228 -0
- package/dist/models/module.d.ts.map +1 -0
- package/dist/models/module.js +69 -0
- package/dist/models/module.js.map +1 -0
- package/dist/pipelines/gradeWorksheet.d.ts.map +1 -1
- package/dist/pipelines/gradeWorksheet.js +4 -2
- package/dist/pipelines/gradeWorksheet.js.map +1 -1
- package/dist/routers/_app.d.ts +760 -0
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/_app.js +4 -2
- package/dist/routers/_app.js.map +1 -1
- package/dist/routers/marketplace.d.ts +41 -0
- package/dist/routers/marketplace.d.ts.map +1 -1
- package/dist/routers/marketplace.js +13 -3
- package/dist/routers/marketplace.js.map +1 -1
- package/dist/routers/module.d.ts +345 -0
- package/dist/routers/module.d.ts.map +1 -0
- package/dist/routers/module.js +82 -0
- package/dist/routers/module.js.map +1 -0
- package/dist/services/assignment.d.ts.map +1 -1
- package/dist/services/assignment.js +8 -3
- package/dist/services/assignment.js.map +1 -1
- package/dist/services/marketplace.d.ts +36 -0
- package/dist/services/marketplace.d.ts.map +1 -1
- package/dist/services/marketplace.js +30 -3
- package/dist/services/marketplace.js.map +1 -1
- package/dist/services/module.d.ts +288 -0
- package/dist/services/module.d.ts.map +1 -0
- package/dist/services/module.js +518 -0
- package/dist/services/module.js.map +1 -0
- package/dist/services/school.d.ts.map +1 -1
- package/dist/services/school.js +17 -5
- package/dist/services/school.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20260708013000_add_modules/migration.sql +100 -0
- package/prisma/schema.prisma +93 -0
- package/src/models/marketplace.ts +16 -0
- package/src/models/module.ts +77 -0
- package/src/pipelines/gradeWorksheet.ts +6 -0
- package/src/routers/_app.ts +2 -0
- package/src/routers/marketplace.ts +16 -0
- package/src/routers/module.ts +118 -0
- package/src/services/assignment.ts +12 -1
- package/src/services/marketplace.ts +39 -0
- package/src/services/module.ts +683 -0
- package/src/services/school.ts +15 -3
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const moduleRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
3
|
+
ctx: import("../trpc.js").Context;
|
|
4
|
+
meta: object;
|
|
5
|
+
errorShape: {
|
|
6
|
+
data: {
|
|
7
|
+
zodError: z.typeToFlattenedError<any, string> | null;
|
|
8
|
+
prismaError: import("../utils/prismaErrorHandler.js").PrismaErrorInfo | null;
|
|
9
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
10
|
+
httpStatus: number;
|
|
11
|
+
path?: string;
|
|
12
|
+
stack?: string;
|
|
13
|
+
};
|
|
14
|
+
message: string;
|
|
15
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
16
|
+
};
|
|
17
|
+
transformer: false;
|
|
18
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
19
|
+
/** Teacher view: every module (published or not) with its items. */
|
|
20
|
+
list: import("@trpc/server").TRPCQueryProcedure<{
|
|
21
|
+
input: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
classId: string;
|
|
24
|
+
};
|
|
25
|
+
output: ({
|
|
26
|
+
items: {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string | null;
|
|
29
|
+
position: number;
|
|
30
|
+
moduleId: string;
|
|
31
|
+
indent: number;
|
|
32
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
33
|
+
itemId: string | null;
|
|
34
|
+
externalUrl: string | null;
|
|
35
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
36
|
+
requiredScore: number | null;
|
|
37
|
+
}[];
|
|
38
|
+
prerequisites: {
|
|
39
|
+
prerequisiteId: string;
|
|
40
|
+
}[];
|
|
41
|
+
} & {
|
|
42
|
+
id: string;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
updatedAt: Date;
|
|
45
|
+
classId: string;
|
|
46
|
+
title: string;
|
|
47
|
+
position: number;
|
|
48
|
+
published: boolean;
|
|
49
|
+
unlockAt: Date | null;
|
|
50
|
+
requireSequential: boolean;
|
|
51
|
+
})[];
|
|
52
|
+
meta: object;
|
|
53
|
+
}>;
|
|
54
|
+
/** Student view: published modules with lock state and progress. */
|
|
55
|
+
getStudentState: import("@trpc/server").TRPCQueryProcedure<{
|
|
56
|
+
input: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
classId: string;
|
|
59
|
+
};
|
|
60
|
+
output: {
|
|
61
|
+
modules: {
|
|
62
|
+
items: {
|
|
63
|
+
completed: boolean;
|
|
64
|
+
accessible: boolean;
|
|
65
|
+
worksheetAssignmentId: string | null;
|
|
66
|
+
id: string;
|
|
67
|
+
title: string | null;
|
|
68
|
+
position: number;
|
|
69
|
+
moduleId: string;
|
|
70
|
+
indent: number;
|
|
71
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
72
|
+
itemId: string | null;
|
|
73
|
+
externalUrl: string | null;
|
|
74
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
75
|
+
requiredScore: number | null;
|
|
76
|
+
}[];
|
|
77
|
+
locked: boolean;
|
|
78
|
+
lockedByPrerequisite: boolean;
|
|
79
|
+
lockedByDate: boolean;
|
|
80
|
+
completed: boolean;
|
|
81
|
+
requiredCount: number;
|
|
82
|
+
completedRequiredCount: number;
|
|
83
|
+
percentComplete: number;
|
|
84
|
+
prerequisites: {
|
|
85
|
+
prerequisiteId: string;
|
|
86
|
+
}[];
|
|
87
|
+
id: string;
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
updatedAt: Date;
|
|
90
|
+
classId: string;
|
|
91
|
+
title: string;
|
|
92
|
+
position: number;
|
|
93
|
+
published: boolean;
|
|
94
|
+
unlockAt: Date | null;
|
|
95
|
+
requireSequential: boolean;
|
|
96
|
+
}[];
|
|
97
|
+
continueItemId: null;
|
|
98
|
+
continueModuleId: null;
|
|
99
|
+
};
|
|
100
|
+
meta: object;
|
|
101
|
+
}>;
|
|
102
|
+
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
103
|
+
input: {
|
|
104
|
+
[x: string]: unknown;
|
|
105
|
+
classId: string;
|
|
106
|
+
title: string;
|
|
107
|
+
unlockAt?: Date | null | undefined;
|
|
108
|
+
requireSequential?: boolean | undefined;
|
|
109
|
+
};
|
|
110
|
+
output: {
|
|
111
|
+
items: {
|
|
112
|
+
id: string;
|
|
113
|
+
title: string | null;
|
|
114
|
+
position: number;
|
|
115
|
+
moduleId: string;
|
|
116
|
+
indent: number;
|
|
117
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
118
|
+
itemId: string | null;
|
|
119
|
+
externalUrl: string | null;
|
|
120
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
121
|
+
requiredScore: number | null;
|
|
122
|
+
}[];
|
|
123
|
+
prerequisites: {
|
|
124
|
+
prerequisiteId: string;
|
|
125
|
+
}[];
|
|
126
|
+
} & {
|
|
127
|
+
id: string;
|
|
128
|
+
createdAt: Date;
|
|
129
|
+
updatedAt: Date;
|
|
130
|
+
classId: string;
|
|
131
|
+
title: string;
|
|
132
|
+
position: number;
|
|
133
|
+
published: boolean;
|
|
134
|
+
unlockAt: Date | null;
|
|
135
|
+
requireSequential: boolean;
|
|
136
|
+
};
|
|
137
|
+
meta: object;
|
|
138
|
+
}>;
|
|
139
|
+
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
140
|
+
input: {
|
|
141
|
+
[x: string]: unknown;
|
|
142
|
+
classId: string;
|
|
143
|
+
id: string;
|
|
144
|
+
title?: string | undefined;
|
|
145
|
+
published?: boolean | undefined;
|
|
146
|
+
unlockAt?: Date | null | undefined;
|
|
147
|
+
requireSequential?: boolean | undefined;
|
|
148
|
+
prerequisiteIds?: string[] | undefined;
|
|
149
|
+
};
|
|
150
|
+
output: {
|
|
151
|
+
items: {
|
|
152
|
+
id: string;
|
|
153
|
+
title: string | null;
|
|
154
|
+
position: number;
|
|
155
|
+
moduleId: string;
|
|
156
|
+
indent: number;
|
|
157
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
158
|
+
itemId: string | null;
|
|
159
|
+
externalUrl: string | null;
|
|
160
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
161
|
+
requiredScore: number | null;
|
|
162
|
+
}[];
|
|
163
|
+
prerequisites: {
|
|
164
|
+
prerequisiteId: string;
|
|
165
|
+
}[];
|
|
166
|
+
} & {
|
|
167
|
+
id: string;
|
|
168
|
+
createdAt: Date;
|
|
169
|
+
updatedAt: Date;
|
|
170
|
+
classId: string;
|
|
171
|
+
title: string;
|
|
172
|
+
position: number;
|
|
173
|
+
published: boolean;
|
|
174
|
+
unlockAt: Date | null;
|
|
175
|
+
requireSequential: boolean;
|
|
176
|
+
};
|
|
177
|
+
meta: object;
|
|
178
|
+
}>;
|
|
179
|
+
delete: import("@trpc/server").TRPCMutationProcedure<{
|
|
180
|
+
input: {
|
|
181
|
+
[x: string]: unknown;
|
|
182
|
+
classId: string;
|
|
183
|
+
id: string;
|
|
184
|
+
};
|
|
185
|
+
output: {
|
|
186
|
+
id: string;
|
|
187
|
+
};
|
|
188
|
+
meta: object;
|
|
189
|
+
}>;
|
|
190
|
+
reorder: import("@trpc/server").TRPCMutationProcedure<{
|
|
191
|
+
input: {
|
|
192
|
+
[x: string]: unknown;
|
|
193
|
+
classId: string;
|
|
194
|
+
orderedIds: string[];
|
|
195
|
+
};
|
|
196
|
+
output: ({
|
|
197
|
+
items: {
|
|
198
|
+
id: string;
|
|
199
|
+
title: string | null;
|
|
200
|
+
position: number;
|
|
201
|
+
moduleId: string;
|
|
202
|
+
indent: number;
|
|
203
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
204
|
+
itemId: string | null;
|
|
205
|
+
externalUrl: string | null;
|
|
206
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
207
|
+
requiredScore: number | null;
|
|
208
|
+
}[];
|
|
209
|
+
prerequisites: {
|
|
210
|
+
prerequisiteId: string;
|
|
211
|
+
}[];
|
|
212
|
+
} & {
|
|
213
|
+
id: string;
|
|
214
|
+
createdAt: Date;
|
|
215
|
+
updatedAt: Date;
|
|
216
|
+
classId: string;
|
|
217
|
+
title: string;
|
|
218
|
+
position: number;
|
|
219
|
+
published: boolean;
|
|
220
|
+
unlockAt: Date | null;
|
|
221
|
+
requireSequential: boolean;
|
|
222
|
+
})[];
|
|
223
|
+
meta: object;
|
|
224
|
+
}>;
|
|
225
|
+
createItem: import("@trpc/server").TRPCMutationProcedure<{
|
|
226
|
+
input: {
|
|
227
|
+
[x: string]: unknown;
|
|
228
|
+
classId: string;
|
|
229
|
+
moduleId: string;
|
|
230
|
+
itemType: "FILE" | "ASSIGNMENT" | "WORKSHEET" | "ANNOUNCEMENT" | "DISCUSSION" | "EXTERNAL_URL" | "SUB_HEADER";
|
|
231
|
+
title?: string | undefined;
|
|
232
|
+
indent?: number | undefined;
|
|
233
|
+
itemId?: string | undefined;
|
|
234
|
+
externalUrl?: string | undefined;
|
|
235
|
+
requirementType?: "VIEW" | "SUBMIT" | "SCORE_AT_LEAST" | undefined;
|
|
236
|
+
requiredScore?: number | undefined;
|
|
237
|
+
};
|
|
238
|
+
output: {
|
|
239
|
+
id: string;
|
|
240
|
+
title: string | null;
|
|
241
|
+
position: number;
|
|
242
|
+
moduleId: string;
|
|
243
|
+
indent: number;
|
|
244
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
245
|
+
itemId: string | null;
|
|
246
|
+
externalUrl: string | null;
|
|
247
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
248
|
+
requiredScore: number | null;
|
|
249
|
+
};
|
|
250
|
+
meta: object;
|
|
251
|
+
}>;
|
|
252
|
+
updateItem: import("@trpc/server").TRPCMutationProcedure<{
|
|
253
|
+
input: {
|
|
254
|
+
[x: string]: unknown;
|
|
255
|
+
classId: string;
|
|
256
|
+
id: string;
|
|
257
|
+
title?: string | null | undefined;
|
|
258
|
+
indent?: number | undefined;
|
|
259
|
+
externalUrl?: string | undefined;
|
|
260
|
+
requirementType?: "VIEW" | "SUBMIT" | "SCORE_AT_LEAST" | null | undefined;
|
|
261
|
+
requiredScore?: number | null | undefined;
|
|
262
|
+
};
|
|
263
|
+
output: {
|
|
264
|
+
id: string;
|
|
265
|
+
title: string | null;
|
|
266
|
+
position: number;
|
|
267
|
+
moduleId: string;
|
|
268
|
+
indent: number;
|
|
269
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
270
|
+
itemId: string | null;
|
|
271
|
+
externalUrl: string | null;
|
|
272
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
273
|
+
requiredScore: number | null;
|
|
274
|
+
};
|
|
275
|
+
meta: object;
|
|
276
|
+
}>;
|
|
277
|
+
deleteItem: import("@trpc/server").TRPCMutationProcedure<{
|
|
278
|
+
input: {
|
|
279
|
+
[x: string]: unknown;
|
|
280
|
+
classId: string;
|
|
281
|
+
id: string;
|
|
282
|
+
};
|
|
283
|
+
output: {
|
|
284
|
+
id: string;
|
|
285
|
+
};
|
|
286
|
+
meta: object;
|
|
287
|
+
}>;
|
|
288
|
+
reorderItems: import("@trpc/server").TRPCMutationProcedure<{
|
|
289
|
+
input: {
|
|
290
|
+
[x: string]: unknown;
|
|
291
|
+
classId: string;
|
|
292
|
+
items: {
|
|
293
|
+
id: string;
|
|
294
|
+
moduleId: string;
|
|
295
|
+
}[];
|
|
296
|
+
};
|
|
297
|
+
output: ({
|
|
298
|
+
items: {
|
|
299
|
+
id: string;
|
|
300
|
+
title: string | null;
|
|
301
|
+
position: number;
|
|
302
|
+
moduleId: string;
|
|
303
|
+
indent: number;
|
|
304
|
+
itemType: import(".prisma/client").$Enums.CourseModuleItemType;
|
|
305
|
+
itemId: string | null;
|
|
306
|
+
externalUrl: string | null;
|
|
307
|
+
requirementType: import(".prisma/client").$Enums.ModuleItemRequirementType | null;
|
|
308
|
+
requiredScore: number | null;
|
|
309
|
+
}[];
|
|
310
|
+
prerequisites: {
|
|
311
|
+
prerequisiteId: string;
|
|
312
|
+
}[];
|
|
313
|
+
} & {
|
|
314
|
+
id: string;
|
|
315
|
+
createdAt: Date;
|
|
316
|
+
updatedAt: Date;
|
|
317
|
+
classId: string;
|
|
318
|
+
title: string;
|
|
319
|
+
position: number;
|
|
320
|
+
published: boolean;
|
|
321
|
+
unlockAt: Date | null;
|
|
322
|
+
requireSequential: boolean;
|
|
323
|
+
})[];
|
|
324
|
+
meta: object;
|
|
325
|
+
}>;
|
|
326
|
+
/** Record that a student viewed an item (completes VIEW requirements). */
|
|
327
|
+
markItemViewed: import("@trpc/server").TRPCMutationProcedure<{
|
|
328
|
+
input: {
|
|
329
|
+
[x: string]: unknown;
|
|
330
|
+
classId: string;
|
|
331
|
+
itemId: string;
|
|
332
|
+
};
|
|
333
|
+
output: {
|
|
334
|
+
status: import(".prisma/client").$Enums.ModuleItemProgressStatus;
|
|
335
|
+
id: string;
|
|
336
|
+
createdAt: Date;
|
|
337
|
+
updatedAt: Date;
|
|
338
|
+
moduleItemId: string;
|
|
339
|
+
studentId: string;
|
|
340
|
+
completedAt: Date | null;
|
|
341
|
+
};
|
|
342
|
+
meta: object;
|
|
343
|
+
}>;
|
|
344
|
+
}>>;
|
|
345
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"/","sources":["routers/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;IACvB,oEAAoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKpE,oEAAoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmFpE,0EAA0E;;;;;;;;;;;;;;;;;;GAI1E,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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]="bce497d9-7c87-5479-9ba0-f2235b734365")}catch(e){}}();
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { CourseModuleItemType as ModuleItemType, ModuleItemRequirementType } from "@prisma/client";
|
|
5
|
+
import { createTRPCRouter, protectedClassMemberProcedure, protectedTeacherProcedure, } from "../trpc.js";
|
|
6
|
+
import { listModulesRecord, createModuleRecord, updateModuleRecord, deleteModuleRecord, reorderModulesRecord, createModuleItemRecord, updateModuleItemRecord, deleteModuleItemRecord, reorderModuleItemsRecord, getStudentModulesState, markItemViewedRecord, } from "../services/module.js";
|
|
7
|
+
const itemTypeSchema = z.nativeEnum(ModuleItemType);
|
|
8
|
+
const requirementTypeSchema = z.nativeEnum(ModuleItemRequirementType);
|
|
9
|
+
export const moduleRouter = createTRPCRouter({
|
|
10
|
+
/** Teacher view: every module (published or not) with its items. */
|
|
11
|
+
list: protectedTeacherProcedure
|
|
12
|
+
.input(z.object({ classId: z.string() }))
|
|
13
|
+
.query(({ ctx, input }) => listModulesRecord(ctx.user.id, input.classId)),
|
|
14
|
+
/** Student view: published modules with lock state and progress. */
|
|
15
|
+
getStudentState: protectedClassMemberProcedure
|
|
16
|
+
.input(z.object({ classId: z.string() }))
|
|
17
|
+
.query(({ ctx, input }) => getStudentModulesState(input.classId, ctx.user.id)),
|
|
18
|
+
create: protectedTeacherProcedure
|
|
19
|
+
.input(z.object({
|
|
20
|
+
classId: z.string(),
|
|
21
|
+
title: z.string().min(1),
|
|
22
|
+
unlockAt: z.coerce.date().nullish(),
|
|
23
|
+
requireSequential: z.boolean().optional(),
|
|
24
|
+
}))
|
|
25
|
+
.mutation(({ ctx, input }) => createModuleRecord(ctx.user.id, input)),
|
|
26
|
+
update: protectedTeacherProcedure
|
|
27
|
+
.input(z.object({
|
|
28
|
+
classId: z.string(),
|
|
29
|
+
id: z.string(),
|
|
30
|
+
title: z.string().min(1).optional(),
|
|
31
|
+
unlockAt: z.coerce.date().nullable().optional(),
|
|
32
|
+
requireSequential: z.boolean().optional(),
|
|
33
|
+
published: z.boolean().optional(),
|
|
34
|
+
prerequisiteIds: z.array(z.string()).optional(),
|
|
35
|
+
}))
|
|
36
|
+
.mutation(({ ctx, input }) => updateModuleRecord(ctx.user.id, input)),
|
|
37
|
+
delete: protectedTeacherProcedure
|
|
38
|
+
.input(z.object({ classId: z.string(), id: z.string() }))
|
|
39
|
+
.mutation(({ ctx, input }) => deleteModuleRecord(ctx.user.id, input)),
|
|
40
|
+
reorder: protectedTeacherProcedure
|
|
41
|
+
.input(z.object({ classId: z.string(), orderedIds: z.array(z.string()) }))
|
|
42
|
+
.mutation(({ ctx, input }) => reorderModulesRecord(ctx.user.id, input)),
|
|
43
|
+
createItem: protectedTeacherProcedure
|
|
44
|
+
.input(z.object({
|
|
45
|
+
classId: z.string(),
|
|
46
|
+
moduleId: z.string(),
|
|
47
|
+
itemType: itemTypeSchema,
|
|
48
|
+
itemId: z.string().optional(),
|
|
49
|
+
externalUrl: z.string().url().optional(),
|
|
50
|
+
title: z.string().optional(),
|
|
51
|
+
indent: z.number().int().min(0).max(4).optional(),
|
|
52
|
+
requirementType: requirementTypeSchema.optional(),
|
|
53
|
+
requiredScore: z.number().min(0).optional(),
|
|
54
|
+
}))
|
|
55
|
+
.mutation(({ ctx, input }) => createModuleItemRecord(ctx.user.id, input)),
|
|
56
|
+
updateItem: protectedTeacherProcedure
|
|
57
|
+
.input(z.object({
|
|
58
|
+
classId: z.string(),
|
|
59
|
+
id: z.string(),
|
|
60
|
+
title: z.string().nullable().optional(),
|
|
61
|
+
externalUrl: z.string().url().optional(),
|
|
62
|
+
indent: z.number().int().min(0).max(4).optional(),
|
|
63
|
+
requirementType: requirementTypeSchema.nullable().optional(),
|
|
64
|
+
requiredScore: z.number().min(0).nullable().optional(),
|
|
65
|
+
}))
|
|
66
|
+
.mutation(({ ctx, input }) => updateModuleItemRecord(ctx.user.id, input)),
|
|
67
|
+
deleteItem: protectedTeacherProcedure
|
|
68
|
+
.input(z.object({ classId: z.string(), id: z.string() }))
|
|
69
|
+
.mutation(({ ctx, input }) => deleteModuleItemRecord(ctx.user.id, input)),
|
|
70
|
+
reorderItems: protectedTeacherProcedure
|
|
71
|
+
.input(z.object({
|
|
72
|
+
classId: z.string(),
|
|
73
|
+
items: z.array(z.object({ id: z.string(), moduleId: z.string() })),
|
|
74
|
+
}))
|
|
75
|
+
.mutation(({ ctx, input }) => reorderModuleItemsRecord(ctx.user.id, input)),
|
|
76
|
+
/** Record that a student viewed an item (completes VIEW requirements). */
|
|
77
|
+
markItemViewed: protectedClassMemberProcedure
|
|
78
|
+
.input(z.object({ classId: z.string(), itemId: z.string() }))
|
|
79
|
+
.mutation(({ ctx, input }) => markItemViewedRecord(ctx.user.id, input)),
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=module.js.map
|
|
82
|
+
//# debugId=bce497d9-7c87-5479-9ba0-f2235b734365
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sources":["routers/module.ts"],"sourceRoot":"/","sourcesContent":["import { z } from \"zod\";\nimport { CourseModuleItemType as ModuleItemType, ModuleItemRequirementType } from \"@prisma/client\";\nimport {\n createTRPCRouter,\n protectedClassMemberProcedure,\n protectedTeacherProcedure,\n} from \"../trpc.js\";\nimport {\n listModulesRecord,\n createModuleRecord,\n updateModuleRecord,\n deleteModuleRecord,\n reorderModulesRecord,\n createModuleItemRecord,\n updateModuleItemRecord,\n deleteModuleItemRecord,\n reorderModuleItemsRecord,\n getStudentModulesState,\n markItemViewedRecord,\n} from \"../services/module.js\";\n\nconst itemTypeSchema = z.nativeEnum(ModuleItemType);\nconst requirementTypeSchema = z.nativeEnum(ModuleItemRequirementType);\n\nexport const moduleRouter = createTRPCRouter({\n /** Teacher view: every module (published or not) with its items. */\n list: protectedTeacherProcedure\n .input(z.object({ classId: z.string() }))\n .query(({ ctx, input }) => listModulesRecord(ctx.user!.id, input.classId)),\n\n /** Student view: published modules with lock state and progress. */\n getStudentState: protectedClassMemberProcedure\n .input(z.object({ classId: z.string() }))\n .query(({ ctx, input }) =>\n getStudentModulesState(input.classId, ctx.user!.id)\n ),\n\n create: protectedTeacherProcedure\n .input(\n z.object({\n classId: z.string(),\n title: z.string().min(1),\n unlockAt: z.coerce.date().nullish(),\n requireSequential: z.boolean().optional(),\n })\n )\n .mutation(({ ctx, input }) => createModuleRecord(ctx.user!.id, input)),\n\n update: protectedTeacherProcedure\n .input(\n z.object({\n classId: z.string(),\n id: z.string(),\n title: z.string().min(1).optional(),\n unlockAt: z.coerce.date().nullable().optional(),\n requireSequential: z.boolean().optional(),\n published: z.boolean().optional(),\n prerequisiteIds: z.array(z.string()).optional(),\n })\n )\n .mutation(({ ctx, input }) => updateModuleRecord(ctx.user!.id, input)),\n\n delete: protectedTeacherProcedure\n .input(z.object({ classId: z.string(), id: z.string() }))\n .mutation(({ ctx, input }) => deleteModuleRecord(ctx.user!.id, input)),\n\n reorder: protectedTeacherProcedure\n .input(z.object({ classId: z.string(), orderedIds: z.array(z.string()) }))\n .mutation(({ ctx, input }) => reorderModulesRecord(ctx.user!.id, input)),\n\n createItem: protectedTeacherProcedure\n .input(\n z.object({\n classId: z.string(),\n moduleId: z.string(),\n itemType: itemTypeSchema,\n itemId: z.string().optional(),\n externalUrl: z.string().url().optional(),\n title: z.string().optional(),\n indent: z.number().int().min(0).max(4).optional(),\n requirementType: requirementTypeSchema.optional(),\n requiredScore: z.number().min(0).optional(),\n })\n )\n .mutation(({ ctx, input }) => createModuleItemRecord(ctx.user!.id, input)),\n\n updateItem: protectedTeacherProcedure\n .input(\n z.object({\n classId: z.string(),\n id: z.string(),\n title: z.string().nullable().optional(),\n externalUrl: z.string().url().optional(),\n indent: z.number().int().min(0).max(4).optional(),\n requirementType: requirementTypeSchema.nullable().optional(),\n requiredScore: z.number().min(0).nullable().optional(),\n })\n )\n .mutation(({ ctx, input }) => updateModuleItemRecord(ctx.user!.id, input)),\n\n deleteItem: protectedTeacherProcedure\n .input(z.object({ classId: z.string(), id: z.string() }))\n .mutation(({ ctx, input }) => deleteModuleItemRecord(ctx.user!.id, input)),\n\n reorderItems: protectedTeacherProcedure\n .input(\n z.object({\n classId: z.string(),\n items: z.array(z.object({ id: z.string(), moduleId: z.string() })),\n })\n )\n .mutation(({ ctx, input }) => reorderModuleItemsRecord(ctx.user!.id, input)),\n\n /** Record that a student viewed an item (completes VIEW requirements). */\n markItemViewed: protectedClassMemberProcedure\n .input(z.object({ classId: z.string(), itemId: z.string() }))\n .mutation(({ ctx, input }) => markItemViewedRecord(ctx.user!.id, input)),\n});\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,IAAI,cAAc,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB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,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;KACnE,CAAC,CACH;SACA,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAE9E,0EAA0E;IAC1E,cAAc,EAAE,6BAA6B;SAC1C,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SAC5D,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;CAC3E,CAAC,CAAC","debug_id":"bce497d9-7c87-5479-9ba0-f2235b734365"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignment.d.ts","sourceRoot":"/","sources":["services/assignment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assignment.d.ts","sourceRoot":"/","sources":["services/assignment.ts"],"names":[],"mappings":"AAiCA,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,MAAM,oBAGhD;AAED,wBAAsB,WAAW;;;;;;;;;;;KAMhC;AAED,wBAAsB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU/D;AAED,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAAK,EAAE;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA4EF;AAED,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE;IACL,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmCF"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Assignment service – create, read, update, delete assignments and submissions.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
!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]="
|
|
5
|
+
!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]="206c04a8-baef-526c-ae19-93de3e7e4cab")}catch(e){}}();
|
|
6
6
|
import { TRPCError } from "@trpc/server";
|
|
7
7
|
import { prisma } from "../lib/prisma.js";
|
|
8
8
|
import { findAssignmentById, findAssignmentWithDetails, findAssignmentWithClassForTeacher, findAssignmentForDelete, findAssignmentsDueToday, findSubmissionByAssignmentAndStudent, findSubmissionByIdForClassMember, findSubmissionForUpdate, findSubmissionForTeacherUpdate, findSubmissionsByAssignmentForTeacher, createSubmission, findSectionsByClassId, findAvailableEventsForAssignment, attachAssignmentToEvent, detachAssignmentFromEvent, duplicateAssignment, } from "../models/assignment.js";
|
|
@@ -13,6 +13,7 @@ import { enqueueRunJob } from "../workers/queues.js";
|
|
|
13
13
|
import { logger } from "../utils/logger.js";
|
|
14
14
|
import { invalidateStudentProgressInferenceCache } from "./studentProgressInferenceCache.js";
|
|
15
15
|
import { enqueueEmbedding } from "./embedding.js";
|
|
16
|
+
import { syncAssignmentModuleProgress } from "./module.js";
|
|
16
17
|
import { resolveAssignmentBehavior } from "../lib/assignmentTypeDefaults.js";
|
|
17
18
|
export async function assignmentExists(id) {
|
|
18
19
|
const assignment = await findAssignmentById(id);
|
|
@@ -584,7 +585,7 @@ export async function updateSubmissionRecord(userId, input) {
|
|
|
584
585
|
}
|
|
585
586
|
}
|
|
586
587
|
}
|
|
587
|
-
|
|
588
|
+
const updatedSubmission = await prisma.submission.update({
|
|
588
589
|
where: { id: submission.id },
|
|
589
590
|
data: {
|
|
590
591
|
submitted: !submission.submitted,
|
|
@@ -602,6 +603,8 @@ export async function updateSubmissionRecord(userId, input) {
|
|
|
602
603
|
},
|
|
603
604
|
},
|
|
604
605
|
});
|
|
606
|
+
await syncAssignmentModuleProgress(userId, submission.assignmentId);
|
|
607
|
+
return updatedSubmission;
|
|
605
608
|
}
|
|
606
609
|
const isLateUpdate = submission.assignment.dueDate < new Date();
|
|
607
610
|
if (isLateUpdate &&
|
|
@@ -735,6 +738,7 @@ export async function updateSubmissionAsTeacherRecord(teacherId, input) {
|
|
|
735
738
|
data: { returned: !submission.returned },
|
|
736
739
|
include: submissionTeacherInclude,
|
|
737
740
|
});
|
|
741
|
+
await syncAssignmentModuleProgress(submission.studentId, submission.assignmentId);
|
|
738
742
|
if (updated.returned) {
|
|
739
743
|
sendNotification({
|
|
740
744
|
receiverId: submission.studentId,
|
|
@@ -793,6 +797,7 @@ export async function updateSubmissionAsTeacherRecord(teacherId, input) {
|
|
|
793
797
|
});
|
|
794
798
|
if (gradeReceived !== undefined) {
|
|
795
799
|
invalidateStudentProgressInferenceCache(submission.assignment.classId, submission.studentId);
|
|
800
|
+
await syncAssignmentModuleProgress(submission.studentId, submission.assignmentId);
|
|
796
801
|
}
|
|
797
802
|
// Index submission for RAG search after teacher grades/feedback
|
|
798
803
|
enqueueEmbedding(input.classId, 'SUBMISSION', submissionId);
|
|
@@ -1090,4 +1095,4 @@ export async function moveAssignmentRecord(teacherId, input) {
|
|
|
1090
1095
|
}, { maxWait: 5000, timeout: 10000 });
|
|
1091
1096
|
}
|
|
1092
1097
|
//# sourceMappingURL=assignment.js.map
|
|
1093
|
-
//# debugId=
|
|
1098
|
+
//# debugId=206c04a8-baef-526c-ae19-93de3e7e4cab
|