@studious-lms/server 1.1.1 → 1.1.2
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 +66 -0
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/assignment.d.ts +30 -0
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +43 -0
- package/dist/routers/class.d.ts +1 -0
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +1 -0
- package/dist/routers/folder.d.ts +2 -0
- package/dist/routers/folder.d.ts.map +1 -1
- package/dist/routers/folder.js +2 -0
- package/dist/routers/section.d.ts.map +1 -1
- package/dist/routers/section.js +27 -0
- package/package.json +1 -1
- package/prisma/migrations/20250919063704_init2/migration.sql +24 -0
- package/src/routers/assignment.ts +73 -12
- package/src/routers/class.ts +2 -1
- package/src/routers/folder.ts +2 -0
- package/src/routers/section.ts +35 -0
package/dist/routers/_app.d.ts
CHANGED
|
@@ -111,6 +111,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
111
111
|
graded: boolean;
|
|
112
112
|
createdAt: Date | null;
|
|
113
113
|
inProgress: boolean;
|
|
114
|
+
order: number | null;
|
|
114
115
|
markScheme: {
|
|
115
116
|
id: string;
|
|
116
117
|
structured: string;
|
|
@@ -871,6 +872,36 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
871
872
|
};
|
|
872
873
|
meta: object;
|
|
873
874
|
}>;
|
|
875
|
+
move: import("@trpc/server").TRPCMutationProcedure<{
|
|
876
|
+
input: {
|
|
877
|
+
[x: string]: unknown;
|
|
878
|
+
classId: string;
|
|
879
|
+
id: string;
|
|
880
|
+
targetSectionId: string;
|
|
881
|
+
};
|
|
882
|
+
output: {
|
|
883
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
884
|
+
id: string;
|
|
885
|
+
title: string;
|
|
886
|
+
dueDate: Date;
|
|
887
|
+
maxGrade: number | null;
|
|
888
|
+
classId: string;
|
|
889
|
+
eventId: string | null;
|
|
890
|
+
markSchemeId: string | null;
|
|
891
|
+
gradingBoundaryId: string | null;
|
|
892
|
+
instructions: string;
|
|
893
|
+
weight: number;
|
|
894
|
+
graded: boolean;
|
|
895
|
+
sectionId: string | null;
|
|
896
|
+
template: boolean;
|
|
897
|
+
createdAt: Date | null;
|
|
898
|
+
modifiedAt: Date | null;
|
|
899
|
+
teacherId: string;
|
|
900
|
+
inProgress: boolean;
|
|
901
|
+
order: number | null;
|
|
902
|
+
};
|
|
903
|
+
meta: object;
|
|
904
|
+
}>;
|
|
874
905
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
875
906
|
input: {
|
|
876
907
|
title: string;
|
|
@@ -2926,6 +2957,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2926
2957
|
childFolders: number;
|
|
2927
2958
|
};
|
|
2928
2959
|
name: string;
|
|
2960
|
+
color: string | null;
|
|
2929
2961
|
}[];
|
|
2930
2962
|
} & {
|
|
2931
2963
|
id: string;
|
|
@@ -2959,6 +2991,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2959
2991
|
id: string;
|
|
2960
2992
|
}[];
|
|
2961
2993
|
name: string;
|
|
2994
|
+
color: string | null;
|
|
2962
2995
|
childFolders: {
|
|
2963
2996
|
id: string;
|
|
2964
2997
|
}[];
|
|
@@ -3294,6 +3327,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
3294
3327
|
graded: boolean;
|
|
3295
3328
|
createdAt: Date | null;
|
|
3296
3329
|
inProgress: boolean;
|
|
3330
|
+
order: number | null;
|
|
3297
3331
|
markScheme: {
|
|
3298
3332
|
id: string;
|
|
3299
3333
|
structured: string;
|
|
@@ -4054,6 +4088,36 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
4054
4088
|
};
|
|
4055
4089
|
meta: object;
|
|
4056
4090
|
}>;
|
|
4091
|
+
move: import("@trpc/server").TRPCMutationProcedure<{
|
|
4092
|
+
input: {
|
|
4093
|
+
[x: string]: unknown;
|
|
4094
|
+
classId: string;
|
|
4095
|
+
id: string;
|
|
4096
|
+
targetSectionId: string;
|
|
4097
|
+
};
|
|
4098
|
+
output: {
|
|
4099
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
4100
|
+
id: string;
|
|
4101
|
+
title: string;
|
|
4102
|
+
dueDate: Date;
|
|
4103
|
+
maxGrade: number | null;
|
|
4104
|
+
classId: string;
|
|
4105
|
+
eventId: string | null;
|
|
4106
|
+
markSchemeId: string | null;
|
|
4107
|
+
gradingBoundaryId: string | null;
|
|
4108
|
+
instructions: string;
|
|
4109
|
+
weight: number;
|
|
4110
|
+
graded: boolean;
|
|
4111
|
+
sectionId: string | null;
|
|
4112
|
+
template: boolean;
|
|
4113
|
+
createdAt: Date | null;
|
|
4114
|
+
modifiedAt: Date | null;
|
|
4115
|
+
teacherId: string;
|
|
4116
|
+
inProgress: boolean;
|
|
4117
|
+
order: number | null;
|
|
4118
|
+
};
|
|
4119
|
+
meta: object;
|
|
4120
|
+
}>;
|
|
4057
4121
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
4058
4122
|
input: {
|
|
4059
4123
|
title: string;
|
|
@@ -6109,6 +6173,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6109
6173
|
childFolders: number;
|
|
6110
6174
|
};
|
|
6111
6175
|
name: string;
|
|
6176
|
+
color: string | null;
|
|
6112
6177
|
}[];
|
|
6113
6178
|
} & {
|
|
6114
6179
|
id: string;
|
|
@@ -6142,6 +6207,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6142
6207
|
id: string;
|
|
6143
6208
|
}[];
|
|
6144
6209
|
name: string;
|
|
6210
|
+
color: string | null;
|
|
6145
6211
|
childFolders: {
|
|
6146
6212
|
id: string;
|
|
6147
6213
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_app.d.ts","sourceRoot":"","sources":["../../src/routers/_app.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAU1E,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"_app.d.ts","sourceRoot":"","sources":["../../src/routers/_app.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAU1E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC"}
|
|
@@ -46,6 +46,36 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
46
46
|
};
|
|
47
47
|
meta: object;
|
|
48
48
|
}>;
|
|
49
|
+
move: import("@trpc/server").TRPCMutationProcedure<{
|
|
50
|
+
input: {
|
|
51
|
+
[x: string]: unknown;
|
|
52
|
+
classId: string;
|
|
53
|
+
id: string;
|
|
54
|
+
targetSectionId: string;
|
|
55
|
+
};
|
|
56
|
+
output: {
|
|
57
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
dueDate: Date;
|
|
61
|
+
maxGrade: number | null;
|
|
62
|
+
classId: string;
|
|
63
|
+
eventId: string | null;
|
|
64
|
+
markSchemeId: string | null;
|
|
65
|
+
gradingBoundaryId: string | null;
|
|
66
|
+
instructions: string;
|
|
67
|
+
weight: number;
|
|
68
|
+
graded: boolean;
|
|
69
|
+
sectionId: string | null;
|
|
70
|
+
template: boolean;
|
|
71
|
+
createdAt: Date | null;
|
|
72
|
+
modifiedAt: Date | null;
|
|
73
|
+
teacherId: string;
|
|
74
|
+
inProgress: boolean;
|
|
75
|
+
order: number | null;
|
|
76
|
+
};
|
|
77
|
+
meta: object;
|
|
78
|
+
}>;
|
|
49
79
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
50
80
|
input: {
|
|
51
81
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignment.d.ts","sourceRoot":"","sources":["../../src/routers/assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqFxB,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"assignment.d.ts","sourceRoot":"","sources":["../../src/routers/assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqFxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
90
90
|
});
|
|
91
91
|
return assignment;
|
|
92
92
|
}),
|
|
93
|
+
move: protectedTeacherProcedure
|
|
94
|
+
.input(z.object({
|
|
95
|
+
id: z.string(),
|
|
96
|
+
classId: z.string(),
|
|
97
|
+
targetSectionId: z.string(),
|
|
98
|
+
}))
|
|
99
|
+
.mutation(async ({ ctx, input }) => {
|
|
100
|
+
const { id, targetSectionId, } = input;
|
|
101
|
+
const assignments = await prisma.assignment.findMany({
|
|
102
|
+
where: { sectionId: targetSectionId },
|
|
103
|
+
});
|
|
104
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
105
|
+
id: assignment.id,
|
|
106
|
+
order: index + 1,
|
|
107
|
+
})).map((assignment) => ({
|
|
108
|
+
where: { id: assignment.id },
|
|
109
|
+
data: { order: assignment.order },
|
|
110
|
+
}));
|
|
111
|
+
await Promise.all(stack.map(({ where, data }) => prisma.assignment.update({ where, data })));
|
|
112
|
+
const assignment = await prisma.assignment.update({
|
|
113
|
+
where: { id },
|
|
114
|
+
data: { sectionId: targetSectionId, order: 0 },
|
|
115
|
+
});
|
|
116
|
+
return assignment;
|
|
117
|
+
}),
|
|
93
118
|
create: protectedProcedure
|
|
94
119
|
.input(createAssignmentSchema)
|
|
95
120
|
.mutation(async ({ ctx, input }) => {
|
|
@@ -131,6 +156,22 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
131
156
|
}, 0);
|
|
132
157
|
}
|
|
133
158
|
console.log(markSchemeId, gradingBoundaryId);
|
|
159
|
+
// find all assignments in the section it is in (or none) and reorder them
|
|
160
|
+
const assignments = await prisma.assignment.findMany({
|
|
161
|
+
where: {
|
|
162
|
+
classId: classId,
|
|
163
|
+
...(sectionId && {
|
|
164
|
+
sectionId: sectionId,
|
|
165
|
+
}),
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
169
|
+
id: assignment.id,
|
|
170
|
+
order: index + 1,
|
|
171
|
+
})).map((assignment) => ({
|
|
172
|
+
where: { id: assignment.id },
|
|
173
|
+
data: { order: assignment.order },
|
|
174
|
+
}));
|
|
134
175
|
// Create assignment with submissions for all students
|
|
135
176
|
const assignment = await prisma.assignment.create({
|
|
136
177
|
data: {
|
|
@@ -141,6 +182,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
141
182
|
graded,
|
|
142
183
|
weight,
|
|
143
184
|
type,
|
|
185
|
+
order: 0,
|
|
144
186
|
inProgress: inProgress || false,
|
|
145
187
|
class: {
|
|
146
188
|
connect: { id: classId }
|
|
@@ -207,6 +249,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
207
249
|
}
|
|
208
250
|
}
|
|
209
251
|
});
|
|
252
|
+
await Promise.all(stack.map(({ where, data }) => prisma.assignment.update({ where, data })));
|
|
210
253
|
// Upload files if provided
|
|
211
254
|
let uploadedFiles = [];
|
|
212
255
|
if (files && files.length > 0) {
|
package/dist/routers/class.d.ts
CHANGED
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4hCtB,CAAC"}
|
package/dist/routers/class.js
CHANGED
package/dist/routers/folder.d.ts
CHANGED
|
@@ -151,6 +151,7 @@ export declare const folderRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
151
151
|
childFolders: number;
|
|
152
152
|
};
|
|
153
153
|
name: string;
|
|
154
|
+
color: string | null;
|
|
154
155
|
}[];
|
|
155
156
|
} & {
|
|
156
157
|
id: string;
|
|
@@ -184,6 +185,7 @@ export declare const folderRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
184
185
|
id: string;
|
|
185
186
|
}[];
|
|
186
187
|
name: string;
|
|
188
|
+
color: string | null;
|
|
187
189
|
childFolders: {
|
|
188
190
|
id: string;
|
|
189
191
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder.d.ts","sourceRoot":"","sources":["../../src/routers/folder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"folder.d.ts","sourceRoot":"","sources":["../../src/routers/folder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmuBvB,CAAC"}
|
package/dist/routers/folder.js
CHANGED
|
@@ -300,6 +300,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
300
300
|
select: {
|
|
301
301
|
id: true,
|
|
302
302
|
name: true,
|
|
303
|
+
color: true,
|
|
303
304
|
_count: {
|
|
304
305
|
select: {
|
|
305
306
|
files: true,
|
|
@@ -369,6 +370,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
369
370
|
select: {
|
|
370
371
|
id: true,
|
|
371
372
|
name: true,
|
|
373
|
+
color: true,
|
|
372
374
|
files: {
|
|
373
375
|
select: {
|
|
374
376
|
id: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/routers/section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/routers/section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwMxB,CAAC"}
|
package/dist/routers/section.js
CHANGED
|
@@ -47,6 +47,7 @@ export const sectionRouter = createTRPCRouter({
|
|
|
47
47
|
const section = await prisma.section.create({
|
|
48
48
|
data: {
|
|
49
49
|
name: input.name,
|
|
50
|
+
order: 0,
|
|
50
51
|
class: {
|
|
51
52
|
connect: { id: input.classId },
|
|
52
53
|
},
|
|
@@ -55,6 +56,32 @@ export const sectionRouter = createTRPCRouter({
|
|
|
55
56
|
}),
|
|
56
57
|
},
|
|
57
58
|
});
|
|
59
|
+
// find all root items in the class and reorder them
|
|
60
|
+
const sections = await prisma.section.findMany({
|
|
61
|
+
where: {
|
|
62
|
+
classId: input.classId,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
const assignments = await prisma.assignment.findMany({
|
|
66
|
+
where: {
|
|
67
|
+
classId: input.classId,
|
|
68
|
+
sectionId: null,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
const stack = [...sections, ...assignments].sort((a, b) => (a.order || 0) - (b.order || 0)).map((item, index) => ({
|
|
72
|
+
id: item.id,
|
|
73
|
+
order: index + 1,
|
|
74
|
+
})).map((item) => ({
|
|
75
|
+
where: { id: item.id },
|
|
76
|
+
data: { order: item.order },
|
|
77
|
+
}));
|
|
78
|
+
// Update sections and assignments with their new order
|
|
79
|
+
await Promise.all([
|
|
80
|
+
...stack.filter(item => sections.some(s => s.id === item.where.id))
|
|
81
|
+
.map(({ where, data }) => prisma.section.update({ where, data })),
|
|
82
|
+
...stack.filter(item => assignments.some(a => a.id === item.where.id))
|
|
83
|
+
.map(({ where, data }) => prisma.assignment.update({ where, data }))
|
|
84
|
+
]);
|
|
58
85
|
return section;
|
|
59
86
|
}),
|
|
60
87
|
update: protectedProcedure
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- DropForeignKey
|
|
2
|
+
ALTER TABLE "Notification" DROP CONSTRAINT "Notification_receiverId_fkey";
|
|
3
|
+
|
|
4
|
+
-- DropForeignKey
|
|
5
|
+
ALTER TABLE "UserProfile" DROP CONSTRAINT "UserProfile_userId_fkey";
|
|
6
|
+
|
|
7
|
+
-- AlterTable
|
|
8
|
+
ALTER TABLE "Assignment" ADD COLUMN "order" INTEGER;
|
|
9
|
+
|
|
10
|
+
-- AlterTable
|
|
11
|
+
ALTER TABLE "Folder" ADD COLUMN "color" TEXT DEFAULT '#3B82F6';
|
|
12
|
+
|
|
13
|
+
-- AlterTable
|
|
14
|
+
ALTER TABLE "Section" ADD COLUMN "color" TEXT DEFAULT '#3B82F6',
|
|
15
|
+
ADD COLUMN "order" INTEGER;
|
|
16
|
+
|
|
17
|
+
-- AlterTable
|
|
18
|
+
ALTER TABLE "Submission" ADD COLUMN "teacherComments" TEXT;
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE "UserProfile" ADD CONSTRAINT "UserProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
22
|
+
|
|
23
|
+
-- AddForeignKey
|
|
24
|
+
ALTER TABLE "Notification" ADD CONSTRAINT "Notification_receiverId_fkey" FOREIGN KEY ("receiverId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -101,6 +101,42 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
101
101
|
return assignment;
|
|
102
102
|
}),
|
|
103
103
|
|
|
104
|
+
move: protectedTeacherProcedure
|
|
105
|
+
.input(z.object({
|
|
106
|
+
id: z.string(),
|
|
107
|
+
classId: z.string(),
|
|
108
|
+
targetSectionId: z.string(),
|
|
109
|
+
}))
|
|
110
|
+
.mutation(async ({ ctx, input }) => {
|
|
111
|
+
const { id, targetSectionId, } = input;
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const assignments = await prisma.assignment.findMany({
|
|
115
|
+
where: { sectionId: targetSectionId },
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
119
|
+
id: assignment.id,
|
|
120
|
+
order: index + 1,
|
|
121
|
+
})).map((assignment) => ({
|
|
122
|
+
where: { id: assignment.id },
|
|
123
|
+
data: { order: assignment.order },
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
await Promise.all(
|
|
127
|
+
stack.map(({ where, data }) =>
|
|
128
|
+
prisma.assignment.update({ where, data })
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const assignment = await prisma.assignment.update({
|
|
133
|
+
where: { id },
|
|
134
|
+
data: { sectionId: targetSectionId, order: 0 },
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
return assignment;
|
|
138
|
+
}),
|
|
139
|
+
|
|
104
140
|
create: protectedProcedure
|
|
105
141
|
.input(createAssignmentSchema)
|
|
106
142
|
.mutation(async ({ ctx, input }) => {
|
|
@@ -149,16 +185,35 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
149
185
|
}
|
|
150
186
|
console.log(markSchemeId, gradingBoundaryId);
|
|
151
187
|
|
|
188
|
+
// find all assignments in the section it is in (or none) and reorder them
|
|
189
|
+
const assignments = await prisma.assignment.findMany({
|
|
190
|
+
where: {
|
|
191
|
+
classId: classId,
|
|
192
|
+
...(sectionId && {
|
|
193
|
+
sectionId: sectionId,
|
|
194
|
+
}),
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
199
|
+
id: assignment.id,
|
|
200
|
+
order: index + 1,
|
|
201
|
+
})).map((assignment) => ({
|
|
202
|
+
where: { id: assignment.id },
|
|
203
|
+
data: { order: assignment.order },
|
|
204
|
+
}));
|
|
205
|
+
|
|
152
206
|
// Create assignment with submissions for all students
|
|
153
207
|
const assignment = await prisma.assignment.create({
|
|
154
208
|
data: {
|
|
155
209
|
title,
|
|
156
210
|
instructions,
|
|
157
211
|
dueDate: new Date(dueDate),
|
|
158
|
-
maxGrade: markSchemeId ?
|
|
212
|
+
maxGrade: markSchemeId ? computedMaxGrade : maxGrade,
|
|
159
213
|
graded,
|
|
160
214
|
weight,
|
|
161
215
|
type,
|
|
216
|
+
order: 0,
|
|
162
217
|
inProgress: inProgress || false,
|
|
163
218
|
class: {
|
|
164
219
|
connect: { id: classId }
|
|
@@ -173,7 +228,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
173
228
|
connect: { id: markSchemeId }
|
|
174
229
|
}
|
|
175
230
|
}),
|
|
176
|
-
...(gradingBoundaryId && {
|
|
231
|
+
...(gradingBoundaryId && {
|
|
177
232
|
gradingBoundary: {
|
|
178
233
|
connect: { id: gradingBoundaryId }
|
|
179
234
|
}
|
|
@@ -226,6 +281,12 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
226
281
|
}
|
|
227
282
|
});
|
|
228
283
|
|
|
284
|
+
await Promise.all(
|
|
285
|
+
stack.map(({ where, data }) =>
|
|
286
|
+
prisma.assignment.update({ where, data })
|
|
287
|
+
)
|
|
288
|
+
);
|
|
289
|
+
|
|
229
290
|
// Upload files if provided
|
|
230
291
|
let uploadedFiles: UploadedFile[] = [];
|
|
231
292
|
if (files && files.length > 0) {
|
|
@@ -495,7 +556,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
495
556
|
try {
|
|
496
557
|
// Delete the main file
|
|
497
558
|
await deleteFile(file.path);
|
|
498
|
-
|
|
559
|
+
|
|
499
560
|
// Delete thumbnail if it exists
|
|
500
561
|
if (file.thumbnail) {
|
|
501
562
|
await deleteFile(file.thumbnail.path);
|
|
@@ -510,7 +571,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
510
571
|
where: { id },
|
|
511
572
|
});
|
|
512
573
|
|
|
513
|
-
return {
|
|
574
|
+
return {
|
|
514
575
|
id,
|
|
515
576
|
};
|
|
516
577
|
}),
|
|
@@ -612,7 +673,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
612
673
|
id: true,
|
|
613
674
|
name: true,
|
|
614
675
|
},
|
|
615
|
-
});
|
|
676
|
+
});
|
|
616
677
|
|
|
617
678
|
return { ...assignment, sections };
|
|
618
679
|
}),
|
|
@@ -930,7 +991,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
930
991
|
|
|
931
992
|
// Delete removed attachments if any
|
|
932
993
|
if (removedAttachments && removedAttachments.length > 0) {
|
|
933
|
-
const filesToDelete = submission.attachments.filter((file) =>
|
|
994
|
+
const filesToDelete = submission.attachments.filter((file) =>
|
|
934
995
|
removedAttachments.includes(file.id)
|
|
935
996
|
);
|
|
936
997
|
|
|
@@ -939,7 +1000,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
939
1000
|
try {
|
|
940
1001
|
// Delete the main file
|
|
941
1002
|
await deleteFile(file.path);
|
|
942
|
-
|
|
1003
|
+
|
|
943
1004
|
// Delete thumbnail if it exists
|
|
944
1005
|
if (file.thumbnail?.path) {
|
|
945
1006
|
await deleteFile(file.thumbnail.path);
|
|
@@ -1198,7 +1259,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1198
1259
|
|
|
1199
1260
|
// Delete removed attachments if any
|
|
1200
1261
|
if (removedAttachments && removedAttachments.length > 0) {
|
|
1201
|
-
const filesToDelete = submission.annotations.filter((file) =>
|
|
1262
|
+
const filesToDelete = submission.annotations.filter((file) =>
|
|
1202
1263
|
removedAttachments.includes(file.id)
|
|
1203
1264
|
);
|
|
1204
1265
|
|
|
@@ -1207,7 +1268,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1207
1268
|
try {
|
|
1208
1269
|
// Delete the main file
|
|
1209
1270
|
await deleteFile(file.path);
|
|
1210
|
-
|
|
1271
|
+
|
|
1211
1272
|
// Delete thumbnail if it exists
|
|
1212
1273
|
if (file.thumbnail?.path) {
|
|
1213
1274
|
await deleteFile(file.thumbnail.path);
|
|
@@ -1592,7 +1653,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1592
1653
|
|
|
1593
1654
|
return updatedAssignment;
|
|
1594
1655
|
}),
|
|
1595
|
-
|
|
1656
|
+
detachMarkScheme: protectedTeacherProcedure
|
|
1596
1657
|
.input(z.object({
|
|
1597
1658
|
assignmentId: z.string(),
|
|
1598
1659
|
}))
|
|
@@ -1611,7 +1672,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1611
1672
|
message: "Assignment not found",
|
|
1612
1673
|
});
|
|
1613
1674
|
}
|
|
1614
|
-
|
|
1675
|
+
|
|
1615
1676
|
const updatedAssignment = await prisma.assignment.update({
|
|
1616
1677
|
where: { id: assignmentId },
|
|
1617
1678
|
data: {
|
|
@@ -1630,7 +1691,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1630
1691
|
|
|
1631
1692
|
return updatedAssignment;
|
|
1632
1693
|
}),
|
|
1633
|
-
|
|
1694
|
+
attachGradingBoundary: protectedTeacherProcedure
|
|
1634
1695
|
.input(z.object({
|
|
1635
1696
|
assignmentId: z.string(),
|
|
1636
1697
|
gradingBoundaryId: z.string().nullable(),
|
package/src/routers/class.ts
CHANGED
|
@@ -128,6 +128,7 @@ export const classRouter = createTRPCRouter({
|
|
|
128
128
|
dueDate: true,
|
|
129
129
|
createdAt: true,
|
|
130
130
|
weight: true,
|
|
131
|
+
order: true,
|
|
131
132
|
graded: true,
|
|
132
133
|
maxGrade: true,
|
|
133
134
|
instructions: true,
|
|
@@ -172,7 +173,7 @@ export const classRouter = createTRPCRouter({
|
|
|
172
173
|
if (!classData) {
|
|
173
174
|
throw new Error('Class not found');
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
+
|
|
176
177
|
const formattedClassData = {
|
|
177
178
|
...classData,
|
|
178
179
|
assignments: classData.assignments.map(assignment => ({
|
package/src/routers/folder.ts
CHANGED
|
@@ -324,6 +324,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
324
324
|
select: {
|
|
325
325
|
id: true,
|
|
326
326
|
name: true,
|
|
327
|
+
color: true,
|
|
327
328
|
_count: {
|
|
328
329
|
select: {
|
|
329
330
|
files: true,
|
|
@@ -398,6 +399,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
398
399
|
select: {
|
|
399
400
|
id: true,
|
|
400
401
|
name: true,
|
|
402
|
+
color: true,
|
|
401
403
|
files: {
|
|
402
404
|
select: {
|
|
403
405
|
id: true,
|
package/src/routers/section.ts
CHANGED
|
@@ -54,6 +54,7 @@ export const sectionRouter = createTRPCRouter({
|
|
|
54
54
|
const section = await prisma.section.create({
|
|
55
55
|
data: {
|
|
56
56
|
name: input.name,
|
|
57
|
+
order: 0,
|
|
57
58
|
class: {
|
|
58
59
|
connect: { id: input.classId },
|
|
59
60
|
},
|
|
@@ -63,6 +64,40 @@ export const sectionRouter = createTRPCRouter({
|
|
|
63
64
|
},
|
|
64
65
|
});
|
|
65
66
|
|
|
67
|
+
// find all root items in the class and reorder them
|
|
68
|
+
const sections = await prisma.section.findMany({
|
|
69
|
+
where: {
|
|
70
|
+
classId: input.classId,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const assignments = await prisma.assignment.findMany({
|
|
75
|
+
where: {
|
|
76
|
+
classId: input.classId,
|
|
77
|
+
sectionId: null,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const stack = [...sections, ...assignments].sort((a, b) => (a.order || 0) - (b.order || 0)).map((item, index) => ({
|
|
82
|
+
id: item.id,
|
|
83
|
+
order: index + 1,
|
|
84
|
+
})).map((item) => ({
|
|
85
|
+
where: { id: item.id },
|
|
86
|
+
data: { order: item.order },
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
// Update sections and assignments with their new order
|
|
90
|
+
await Promise.all([
|
|
91
|
+
...stack.filter(item => sections.some(s => s.id === item.where.id))
|
|
92
|
+
.map(({ where, data }) =>
|
|
93
|
+
prisma.section.update({ where, data })
|
|
94
|
+
),
|
|
95
|
+
...stack.filter(item => assignments.some(a => a.id === item.where.id))
|
|
96
|
+
.map(({ where, data }) =>
|
|
97
|
+
prisma.assignment.update({ where, data })
|
|
98
|
+
)
|
|
99
|
+
]);
|
|
100
|
+
|
|
66
101
|
return section;
|
|
67
102
|
}),
|
|
68
103
|
|