@studious-lms/server 1.1.1 → 1.1.3
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 +226 -0
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/assignment.d.ts +109 -0
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +82 -1
- 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 +3 -0
- package/dist/routers/folder.d.ts.map +1 -1
- package/dist/routers/folder.js +3 -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 +116 -13
- package/src/routers/class.ts +2 -1
- package/src/routers/folder.ts +3 -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;
|
|
@@ -1566,6 +1597,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1566
1597
|
classId: string;
|
|
1567
1598
|
assignmentId: string;
|
|
1568
1599
|
submissionId: string;
|
|
1600
|
+
feedback?: string | undefined;
|
|
1569
1601
|
gradeReceived?: number | null | undefined;
|
|
1570
1602
|
existingFileIds?: string[] | undefined;
|
|
1571
1603
|
removedAttachments?: string[] | undefined;
|
|
@@ -2030,6 +2062,84 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2030
2062
|
};
|
|
2031
2063
|
meta: object;
|
|
2032
2064
|
}>;
|
|
2065
|
+
detachGradingBoundary: import("@trpc/server").TRPCMutationProcedure<{
|
|
2066
|
+
input: {
|
|
2067
|
+
[x: string]: unknown;
|
|
2068
|
+
classId: string;
|
|
2069
|
+
assignmentId: string;
|
|
2070
|
+
};
|
|
2071
|
+
output: {
|
|
2072
|
+
section: {
|
|
2073
|
+
id: string;
|
|
2074
|
+
name: string;
|
|
2075
|
+
color: string | null;
|
|
2076
|
+
classId: string;
|
|
2077
|
+
order: number | null;
|
|
2078
|
+
} | null;
|
|
2079
|
+
teacher: {
|
|
2080
|
+
id: string;
|
|
2081
|
+
username: string;
|
|
2082
|
+
email: string;
|
|
2083
|
+
password: string;
|
|
2084
|
+
verified: boolean;
|
|
2085
|
+
role: import(".prisma/client").$Enums.UserRole;
|
|
2086
|
+
profileId: string | null;
|
|
2087
|
+
schoolId: string | null;
|
|
2088
|
+
};
|
|
2089
|
+
attachments: {
|
|
2090
|
+
path: string;
|
|
2091
|
+
type: string;
|
|
2092
|
+
id: string;
|
|
2093
|
+
name: string;
|
|
2094
|
+
size: number | null;
|
|
2095
|
+
uploadedAt: Date | null;
|
|
2096
|
+
assignmentId: string | null;
|
|
2097
|
+
submissionId: string | null;
|
|
2098
|
+
userId: string | null;
|
|
2099
|
+
thumbnailId: string | null;
|
|
2100
|
+
annotationId: string | null;
|
|
2101
|
+
classDraftId: string | null;
|
|
2102
|
+
folderId: string | null;
|
|
2103
|
+
}[];
|
|
2104
|
+
eventAttached: {
|
|
2105
|
+
id: string;
|
|
2106
|
+
name: string | null;
|
|
2107
|
+
color: string | null;
|
|
2108
|
+
location: string | null;
|
|
2109
|
+
startTime: Date;
|
|
2110
|
+
endTime: Date;
|
|
2111
|
+
remarks: string | null;
|
|
2112
|
+
classId: string | null;
|
|
2113
|
+
userId: string | null;
|
|
2114
|
+
} | null;
|
|
2115
|
+
gradingBoundary: {
|
|
2116
|
+
id: string;
|
|
2117
|
+
classId: string;
|
|
2118
|
+
structured: string;
|
|
2119
|
+
} | null;
|
|
2120
|
+
} & {
|
|
2121
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
2122
|
+
id: string;
|
|
2123
|
+
title: string;
|
|
2124
|
+
dueDate: Date;
|
|
2125
|
+
maxGrade: number | null;
|
|
2126
|
+
classId: string;
|
|
2127
|
+
eventId: string | null;
|
|
2128
|
+
markSchemeId: string | null;
|
|
2129
|
+
gradingBoundaryId: string | null;
|
|
2130
|
+
instructions: string;
|
|
2131
|
+
weight: number;
|
|
2132
|
+
graded: boolean;
|
|
2133
|
+
sectionId: string | null;
|
|
2134
|
+
template: boolean;
|
|
2135
|
+
createdAt: Date | null;
|
|
2136
|
+
modifiedAt: Date | null;
|
|
2137
|
+
teacherId: string;
|
|
2138
|
+
inProgress: boolean;
|
|
2139
|
+
order: number | null;
|
|
2140
|
+
};
|
|
2141
|
+
meta: object;
|
|
2142
|
+
}>;
|
|
2033
2143
|
}>>;
|
|
2034
2144
|
user: import("@trpc/server").TRPCBuiltRouter<{
|
|
2035
2145
|
ctx: import("../trpc.js").Context;
|
|
@@ -2853,6 +2963,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2853
2963
|
childFolders: number;
|
|
2854
2964
|
};
|
|
2855
2965
|
name: string;
|
|
2966
|
+
color: string | null;
|
|
2856
2967
|
}[];
|
|
2857
2968
|
parentFolder: {
|
|
2858
2969
|
id: string;
|
|
@@ -2926,6 +3037,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2926
3037
|
childFolders: number;
|
|
2927
3038
|
};
|
|
2928
3039
|
name: string;
|
|
3040
|
+
color: string | null;
|
|
2929
3041
|
}[];
|
|
2930
3042
|
} & {
|
|
2931
3043
|
id: string;
|
|
@@ -2959,6 +3071,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2959
3071
|
id: string;
|
|
2960
3072
|
}[];
|
|
2961
3073
|
name: string;
|
|
3074
|
+
color: string | null;
|
|
2962
3075
|
childFolders: {
|
|
2963
3076
|
id: string;
|
|
2964
3077
|
}[];
|
|
@@ -3294,6 +3407,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
3294
3407
|
graded: boolean;
|
|
3295
3408
|
createdAt: Date | null;
|
|
3296
3409
|
inProgress: boolean;
|
|
3410
|
+
order: number | null;
|
|
3297
3411
|
markScheme: {
|
|
3298
3412
|
id: string;
|
|
3299
3413
|
structured: string;
|
|
@@ -4054,6 +4168,36 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
4054
4168
|
};
|
|
4055
4169
|
meta: object;
|
|
4056
4170
|
}>;
|
|
4171
|
+
move: import("@trpc/server").TRPCMutationProcedure<{
|
|
4172
|
+
input: {
|
|
4173
|
+
[x: string]: unknown;
|
|
4174
|
+
classId: string;
|
|
4175
|
+
id: string;
|
|
4176
|
+
targetSectionId: string;
|
|
4177
|
+
};
|
|
4178
|
+
output: {
|
|
4179
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
4180
|
+
id: string;
|
|
4181
|
+
title: string;
|
|
4182
|
+
dueDate: Date;
|
|
4183
|
+
maxGrade: number | null;
|
|
4184
|
+
classId: string;
|
|
4185
|
+
eventId: string | null;
|
|
4186
|
+
markSchemeId: string | null;
|
|
4187
|
+
gradingBoundaryId: string | null;
|
|
4188
|
+
instructions: string;
|
|
4189
|
+
weight: number;
|
|
4190
|
+
graded: boolean;
|
|
4191
|
+
sectionId: string | null;
|
|
4192
|
+
template: boolean;
|
|
4193
|
+
createdAt: Date | null;
|
|
4194
|
+
modifiedAt: Date | null;
|
|
4195
|
+
teacherId: string;
|
|
4196
|
+
inProgress: boolean;
|
|
4197
|
+
order: number | null;
|
|
4198
|
+
};
|
|
4199
|
+
meta: object;
|
|
4200
|
+
}>;
|
|
4057
4201
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
4058
4202
|
input: {
|
|
4059
4203
|
title: string;
|
|
@@ -4749,6 +4893,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
4749
4893
|
classId: string;
|
|
4750
4894
|
assignmentId: string;
|
|
4751
4895
|
submissionId: string;
|
|
4896
|
+
feedback?: string | undefined;
|
|
4752
4897
|
gradeReceived?: number | null | undefined;
|
|
4753
4898
|
existingFileIds?: string[] | undefined;
|
|
4754
4899
|
removedAttachments?: string[] | undefined;
|
|
@@ -5213,6 +5358,84 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
5213
5358
|
};
|
|
5214
5359
|
meta: object;
|
|
5215
5360
|
}>;
|
|
5361
|
+
detachGradingBoundary: import("@trpc/server").TRPCMutationProcedure<{
|
|
5362
|
+
input: {
|
|
5363
|
+
[x: string]: unknown;
|
|
5364
|
+
classId: string;
|
|
5365
|
+
assignmentId: string;
|
|
5366
|
+
};
|
|
5367
|
+
output: {
|
|
5368
|
+
section: {
|
|
5369
|
+
id: string;
|
|
5370
|
+
name: string;
|
|
5371
|
+
color: string | null;
|
|
5372
|
+
classId: string;
|
|
5373
|
+
order: number | null;
|
|
5374
|
+
} | null;
|
|
5375
|
+
teacher: {
|
|
5376
|
+
id: string;
|
|
5377
|
+
username: string;
|
|
5378
|
+
email: string;
|
|
5379
|
+
password: string;
|
|
5380
|
+
verified: boolean;
|
|
5381
|
+
role: import(".prisma/client").$Enums.UserRole;
|
|
5382
|
+
profileId: string | null;
|
|
5383
|
+
schoolId: string | null;
|
|
5384
|
+
};
|
|
5385
|
+
attachments: {
|
|
5386
|
+
path: string;
|
|
5387
|
+
type: string;
|
|
5388
|
+
id: string;
|
|
5389
|
+
name: string;
|
|
5390
|
+
size: number | null;
|
|
5391
|
+
uploadedAt: Date | null;
|
|
5392
|
+
assignmentId: string | null;
|
|
5393
|
+
submissionId: string | null;
|
|
5394
|
+
userId: string | null;
|
|
5395
|
+
thumbnailId: string | null;
|
|
5396
|
+
annotationId: string | null;
|
|
5397
|
+
classDraftId: string | null;
|
|
5398
|
+
folderId: string | null;
|
|
5399
|
+
}[];
|
|
5400
|
+
eventAttached: {
|
|
5401
|
+
id: string;
|
|
5402
|
+
name: string | null;
|
|
5403
|
+
color: string | null;
|
|
5404
|
+
location: string | null;
|
|
5405
|
+
startTime: Date;
|
|
5406
|
+
endTime: Date;
|
|
5407
|
+
remarks: string | null;
|
|
5408
|
+
classId: string | null;
|
|
5409
|
+
userId: string | null;
|
|
5410
|
+
} | null;
|
|
5411
|
+
gradingBoundary: {
|
|
5412
|
+
id: string;
|
|
5413
|
+
classId: string;
|
|
5414
|
+
structured: string;
|
|
5415
|
+
} | null;
|
|
5416
|
+
} & {
|
|
5417
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
5418
|
+
id: string;
|
|
5419
|
+
title: string;
|
|
5420
|
+
dueDate: Date;
|
|
5421
|
+
maxGrade: number | null;
|
|
5422
|
+
classId: string;
|
|
5423
|
+
eventId: string | null;
|
|
5424
|
+
markSchemeId: string | null;
|
|
5425
|
+
gradingBoundaryId: string | null;
|
|
5426
|
+
instructions: string;
|
|
5427
|
+
weight: number;
|
|
5428
|
+
graded: boolean;
|
|
5429
|
+
sectionId: string | null;
|
|
5430
|
+
template: boolean;
|
|
5431
|
+
createdAt: Date | null;
|
|
5432
|
+
modifiedAt: Date | null;
|
|
5433
|
+
teacherId: string;
|
|
5434
|
+
inProgress: boolean;
|
|
5435
|
+
order: number | null;
|
|
5436
|
+
};
|
|
5437
|
+
meta: object;
|
|
5438
|
+
}>;
|
|
5216
5439
|
}>>;
|
|
5217
5440
|
user: import("@trpc/server").TRPCBuiltRouter<{
|
|
5218
5441
|
ctx: import("../trpc.js").Context;
|
|
@@ -6036,6 +6259,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6036
6259
|
childFolders: number;
|
|
6037
6260
|
};
|
|
6038
6261
|
name: string;
|
|
6262
|
+
color: string | null;
|
|
6039
6263
|
}[];
|
|
6040
6264
|
parentFolder: {
|
|
6041
6265
|
id: string;
|
|
@@ -6109,6 +6333,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6109
6333
|
childFolders: number;
|
|
6110
6334
|
};
|
|
6111
6335
|
name: string;
|
|
6336
|
+
color: string | null;
|
|
6112
6337
|
}[];
|
|
6113
6338
|
} & {
|
|
6114
6339
|
id: string;
|
|
@@ -6142,6 +6367,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6142
6367
|
id: string;
|
|
6143
6368
|
}[];
|
|
6144
6369
|
name: string;
|
|
6370
|
+
color: string | null;
|
|
6145
6371
|
childFolders: {
|
|
6146
6372
|
id: string;
|
|
6147
6373
|
}[];
|
|
@@ -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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
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;
|
|
@@ -741,6 +771,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
741
771
|
classId: string;
|
|
742
772
|
assignmentId: string;
|
|
743
773
|
submissionId: string;
|
|
774
|
+
feedback?: string | undefined;
|
|
744
775
|
gradeReceived?: number | null | undefined;
|
|
745
776
|
existingFileIds?: string[] | undefined;
|
|
746
777
|
removedAttachments?: string[] | undefined;
|
|
@@ -1205,5 +1236,83 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1205
1236
|
};
|
|
1206
1237
|
meta: object;
|
|
1207
1238
|
}>;
|
|
1239
|
+
detachGradingBoundary: import("@trpc/server").TRPCMutationProcedure<{
|
|
1240
|
+
input: {
|
|
1241
|
+
[x: string]: unknown;
|
|
1242
|
+
classId: string;
|
|
1243
|
+
assignmentId: string;
|
|
1244
|
+
};
|
|
1245
|
+
output: {
|
|
1246
|
+
section: {
|
|
1247
|
+
id: string;
|
|
1248
|
+
name: string;
|
|
1249
|
+
color: string | null;
|
|
1250
|
+
classId: string;
|
|
1251
|
+
order: number | null;
|
|
1252
|
+
} | null;
|
|
1253
|
+
teacher: {
|
|
1254
|
+
id: string;
|
|
1255
|
+
username: string;
|
|
1256
|
+
email: string;
|
|
1257
|
+
password: string;
|
|
1258
|
+
verified: boolean;
|
|
1259
|
+
role: import(".prisma/client").$Enums.UserRole;
|
|
1260
|
+
profileId: string | null;
|
|
1261
|
+
schoolId: string | null;
|
|
1262
|
+
};
|
|
1263
|
+
attachments: {
|
|
1264
|
+
path: string;
|
|
1265
|
+
type: string;
|
|
1266
|
+
id: string;
|
|
1267
|
+
name: string;
|
|
1268
|
+
size: number | null;
|
|
1269
|
+
uploadedAt: Date | null;
|
|
1270
|
+
assignmentId: string | null;
|
|
1271
|
+
submissionId: string | null;
|
|
1272
|
+
userId: string | null;
|
|
1273
|
+
thumbnailId: string | null;
|
|
1274
|
+
annotationId: string | null;
|
|
1275
|
+
classDraftId: string | null;
|
|
1276
|
+
folderId: string | null;
|
|
1277
|
+
}[];
|
|
1278
|
+
eventAttached: {
|
|
1279
|
+
id: string;
|
|
1280
|
+
name: string | null;
|
|
1281
|
+
color: string | null;
|
|
1282
|
+
location: string | null;
|
|
1283
|
+
startTime: Date;
|
|
1284
|
+
endTime: Date;
|
|
1285
|
+
remarks: string | null;
|
|
1286
|
+
classId: string | null;
|
|
1287
|
+
userId: string | null;
|
|
1288
|
+
} | null;
|
|
1289
|
+
gradingBoundary: {
|
|
1290
|
+
id: string;
|
|
1291
|
+
classId: string;
|
|
1292
|
+
structured: string;
|
|
1293
|
+
} | null;
|
|
1294
|
+
} & {
|
|
1295
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
1296
|
+
id: string;
|
|
1297
|
+
title: string;
|
|
1298
|
+
dueDate: Date;
|
|
1299
|
+
maxGrade: number | null;
|
|
1300
|
+
classId: string;
|
|
1301
|
+
eventId: string | null;
|
|
1302
|
+
markSchemeId: string | null;
|
|
1303
|
+
gradingBoundaryId: string | null;
|
|
1304
|
+
instructions: string;
|
|
1305
|
+
weight: number;
|
|
1306
|
+
graded: boolean;
|
|
1307
|
+
sectionId: string | null;
|
|
1308
|
+
template: boolean;
|
|
1309
|
+
createdAt: Date | null;
|
|
1310
|
+
modifiedAt: Date | null;
|
|
1311
|
+
teacherId: string;
|
|
1312
|
+
inProgress: boolean;
|
|
1313
|
+
order: number | null;
|
|
1314
|
+
};
|
|
1315
|
+
meta: object;
|
|
1316
|
+
}>;
|
|
1208
1317
|
}>>;
|
|
1209
1318
|
//# sourceMappingURL=assignment.d.ts.map
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"assignment.d.ts","sourceRoot":"","sources":["../../src/routers/assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsFxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
|
@@ -68,6 +68,7 @@ const updateSubmissionSchema = z.object({
|
|
|
68
68
|
newAttachments: z.array(fileSchema).optional(),
|
|
69
69
|
existingFileIds: z.array(z.string()).optional(),
|
|
70
70
|
removedAttachments: z.array(z.string()).optional(),
|
|
71
|
+
feedback: z.string().optional(),
|
|
71
72
|
rubricGrades: z.array(z.object({
|
|
72
73
|
criteriaId: z.string(),
|
|
73
74
|
selectedLevelId: z.string(),
|
|
@@ -90,6 +91,31 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
90
91
|
});
|
|
91
92
|
return assignment;
|
|
92
93
|
}),
|
|
94
|
+
move: protectedTeacherProcedure
|
|
95
|
+
.input(z.object({
|
|
96
|
+
id: z.string(),
|
|
97
|
+
classId: z.string(),
|
|
98
|
+
targetSectionId: z.string(),
|
|
99
|
+
}))
|
|
100
|
+
.mutation(async ({ ctx, input }) => {
|
|
101
|
+
const { id, targetSectionId, } = input;
|
|
102
|
+
const assignments = await prisma.assignment.findMany({
|
|
103
|
+
where: { sectionId: targetSectionId },
|
|
104
|
+
});
|
|
105
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
106
|
+
id: assignment.id,
|
|
107
|
+
order: index + 1,
|
|
108
|
+
})).map((assignment) => ({
|
|
109
|
+
where: { id: assignment.id },
|
|
110
|
+
data: { order: assignment.order },
|
|
111
|
+
}));
|
|
112
|
+
await Promise.all(stack.map(({ where, data }) => prisma.assignment.update({ where, data })));
|
|
113
|
+
const assignment = await prisma.assignment.update({
|
|
114
|
+
where: { id },
|
|
115
|
+
data: { sectionId: targetSectionId, order: 0 },
|
|
116
|
+
});
|
|
117
|
+
return assignment;
|
|
118
|
+
}),
|
|
93
119
|
create: protectedProcedure
|
|
94
120
|
.input(createAssignmentSchema)
|
|
95
121
|
.mutation(async ({ ctx, input }) => {
|
|
@@ -131,6 +157,22 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
131
157
|
}, 0);
|
|
132
158
|
}
|
|
133
159
|
console.log(markSchemeId, gradingBoundaryId);
|
|
160
|
+
// find all assignments in the section it is in (or none) and reorder them
|
|
161
|
+
const assignments = await prisma.assignment.findMany({
|
|
162
|
+
where: {
|
|
163
|
+
classId: classId,
|
|
164
|
+
...(sectionId && {
|
|
165
|
+
sectionId: sectionId,
|
|
166
|
+
}),
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
170
|
+
id: assignment.id,
|
|
171
|
+
order: index + 1,
|
|
172
|
+
})).map((assignment) => ({
|
|
173
|
+
where: { id: assignment.id },
|
|
174
|
+
data: { order: assignment.order },
|
|
175
|
+
}));
|
|
134
176
|
// Create assignment with submissions for all students
|
|
135
177
|
const assignment = await prisma.assignment.create({
|
|
136
178
|
data: {
|
|
@@ -141,6 +183,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
141
183
|
graded,
|
|
142
184
|
weight,
|
|
143
185
|
type,
|
|
186
|
+
order: 0,
|
|
144
187
|
inProgress: inProgress || false,
|
|
145
188
|
class: {
|
|
146
189
|
connect: { id: classId }
|
|
@@ -207,6 +250,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
207
250
|
}
|
|
208
251
|
}
|
|
209
252
|
});
|
|
253
|
+
await Promise.all(stack.map(({ where, data }) => prisma.assignment.update({ where, data })));
|
|
210
254
|
// Upload files if provided
|
|
211
255
|
let uploadedFiles = [];
|
|
212
256
|
if (files && files.length > 0) {
|
|
@@ -994,7 +1038,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
994
1038
|
message: "User must be authenticated",
|
|
995
1039
|
});
|
|
996
1040
|
}
|
|
997
|
-
const { submissionId, return: returnSubmission, gradeReceived, newAttachments, existingFileIds, removedAttachments, rubricGrades } = input;
|
|
1041
|
+
const { submissionId, return: returnSubmission, gradeReceived, newAttachments, existingFileIds, removedAttachments, rubricGrades, feedback } = input;
|
|
998
1042
|
const submission = await prisma.submission.findFirst({
|
|
999
1043
|
where: {
|
|
1000
1044
|
id: submissionId,
|
|
@@ -1138,6 +1182,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1138
1182
|
data: {
|
|
1139
1183
|
...(gradeReceived !== undefined && { gradeReceived }),
|
|
1140
1184
|
...(rubricGrades && { rubricState: JSON.stringify(rubricGrades) }),
|
|
1185
|
+
...(feedback && { teacherComments: feedback }),
|
|
1141
1186
|
...(removedAttachments && removedAttachments.length > 0 && {
|
|
1142
1187
|
annotations: {
|
|
1143
1188
|
deleteMany: {
|
|
@@ -1145,6 +1190,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1145
1190
|
},
|
|
1146
1191
|
},
|
|
1147
1192
|
}),
|
|
1193
|
+
...(returnSubmission && { returned: returnSubmission }),
|
|
1148
1194
|
},
|
|
1149
1195
|
include: {
|
|
1150
1196
|
attachments: {
|
|
@@ -1562,4 +1608,39 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1562
1608
|
});
|
|
1563
1609
|
return updatedAssignment;
|
|
1564
1610
|
}),
|
|
1611
|
+
detachGradingBoundary: protectedTeacherProcedure
|
|
1612
|
+
.input(z.object({
|
|
1613
|
+
classId: z.string(),
|
|
1614
|
+
assignmentId: z.string(),
|
|
1615
|
+
}))
|
|
1616
|
+
.mutation(async ({ ctx, input }) => {
|
|
1617
|
+
const { assignmentId } = input;
|
|
1618
|
+
const assignment = await prisma.assignment.findFirst({
|
|
1619
|
+
where: {
|
|
1620
|
+
id: assignmentId,
|
|
1621
|
+
},
|
|
1622
|
+
});
|
|
1623
|
+
if (!assignment) {
|
|
1624
|
+
throw new TRPCError({
|
|
1625
|
+
code: "NOT_FOUND",
|
|
1626
|
+
message: "Assignment not found",
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
const updatedAssignment = await prisma.assignment.update({
|
|
1630
|
+
where: { id: assignmentId },
|
|
1631
|
+
data: {
|
|
1632
|
+
gradingBoundary: {
|
|
1633
|
+
disconnect: true,
|
|
1634
|
+
},
|
|
1635
|
+
},
|
|
1636
|
+
include: {
|
|
1637
|
+
attachments: true,
|
|
1638
|
+
section: true,
|
|
1639
|
+
teacher: true,
|
|
1640
|
+
eventAttached: true,
|
|
1641
|
+
gradingBoundary: true,
|
|
1642
|
+
},
|
|
1643
|
+
});
|
|
1644
|
+
return updatedAssignment;
|
|
1645
|
+
}),
|
|
1565
1646
|
});
|
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
|
@@ -78,6 +78,7 @@ export declare const folderRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
78
78
|
childFolders: number;
|
|
79
79
|
};
|
|
80
80
|
name: string;
|
|
81
|
+
color: string | null;
|
|
81
82
|
}[];
|
|
82
83
|
parentFolder: {
|
|
83
84
|
id: string;
|
|
@@ -151,6 +152,7 @@ export declare const folderRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
151
152
|
childFolders: number;
|
|
152
153
|
};
|
|
153
154
|
name: string;
|
|
155
|
+
color: string | null;
|
|
154
156
|
}[];
|
|
155
157
|
} & {
|
|
156
158
|
id: string;
|
|
@@ -184,6 +186,7 @@ export declare const folderRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
184
186
|
id: string;
|
|
185
187
|
}[];
|
|
186
188
|
name: string;
|
|
189
|
+
color: string | null;
|
|
187
190
|
childFolders: {
|
|
188
191
|
id: string;
|
|
189
192
|
}[];
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAouBvB,CAAC"}
|
package/dist/routers/folder.js
CHANGED
|
@@ -167,6 +167,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
167
167
|
select: {
|
|
168
168
|
id: true,
|
|
169
169
|
name: true,
|
|
170
|
+
color: true,
|
|
170
171
|
_count: {
|
|
171
172
|
select: {
|
|
172
173
|
files: true,
|
|
@@ -300,6 +301,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
300
301
|
select: {
|
|
301
302
|
id: true,
|
|
302
303
|
name: true,
|
|
304
|
+
color: true,
|
|
303
305
|
_count: {
|
|
304
306
|
select: {
|
|
305
307
|
files: true,
|
|
@@ -369,6 +371,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
369
371
|
select: {
|
|
370
372
|
id: true,
|
|
371
373
|
name: true,
|
|
374
|
+
color: true,
|
|
372
375
|
files: {
|
|
373
376
|
select: {
|
|
374
377
|
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;
|
|
@@ -75,6 +75,7 @@ const updateSubmissionSchema = z.object({
|
|
|
75
75
|
newAttachments: z.array(fileSchema).optional(),
|
|
76
76
|
existingFileIds: z.array(z.string()).optional(),
|
|
77
77
|
removedAttachments: z.array(z.string()).optional(),
|
|
78
|
+
feedback: z.string().optional(),
|
|
78
79
|
rubricGrades: z.array(z.object({
|
|
79
80
|
criteriaId: z.string(),
|
|
80
81
|
selectedLevelId: z.string(),
|
|
@@ -101,6 +102,42 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
101
102
|
return assignment;
|
|
102
103
|
}),
|
|
103
104
|
|
|
105
|
+
move: protectedTeacherProcedure
|
|
106
|
+
.input(z.object({
|
|
107
|
+
id: z.string(),
|
|
108
|
+
classId: z.string(),
|
|
109
|
+
targetSectionId: z.string(),
|
|
110
|
+
}))
|
|
111
|
+
.mutation(async ({ ctx, input }) => {
|
|
112
|
+
const { id, targetSectionId, } = input;
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
const assignments = await prisma.assignment.findMany({
|
|
116
|
+
where: { sectionId: targetSectionId },
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
120
|
+
id: assignment.id,
|
|
121
|
+
order: index + 1,
|
|
122
|
+
})).map((assignment) => ({
|
|
123
|
+
where: { id: assignment.id },
|
|
124
|
+
data: { order: assignment.order },
|
|
125
|
+
}));
|
|
126
|
+
|
|
127
|
+
await Promise.all(
|
|
128
|
+
stack.map(({ where, data }) =>
|
|
129
|
+
prisma.assignment.update({ where, data })
|
|
130
|
+
)
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const assignment = await prisma.assignment.update({
|
|
134
|
+
where: { id },
|
|
135
|
+
data: { sectionId: targetSectionId, order: 0 },
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return assignment;
|
|
139
|
+
}),
|
|
140
|
+
|
|
104
141
|
create: protectedProcedure
|
|
105
142
|
.input(createAssignmentSchema)
|
|
106
143
|
.mutation(async ({ ctx, input }) => {
|
|
@@ -149,16 +186,35 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
149
186
|
}
|
|
150
187
|
console.log(markSchemeId, gradingBoundaryId);
|
|
151
188
|
|
|
189
|
+
// find all assignments in the section it is in (or none) and reorder them
|
|
190
|
+
const assignments = await prisma.assignment.findMany({
|
|
191
|
+
where: {
|
|
192
|
+
classId: classId,
|
|
193
|
+
...(sectionId && {
|
|
194
|
+
sectionId: sectionId,
|
|
195
|
+
}),
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const stack = assignments.sort((a, b) => (a.order || 0) - (b.order || 0)).map((assignment, index) => ({
|
|
200
|
+
id: assignment.id,
|
|
201
|
+
order: index + 1,
|
|
202
|
+
})).map((assignment) => ({
|
|
203
|
+
where: { id: assignment.id },
|
|
204
|
+
data: { order: assignment.order },
|
|
205
|
+
}));
|
|
206
|
+
|
|
152
207
|
// Create assignment with submissions for all students
|
|
153
208
|
const assignment = await prisma.assignment.create({
|
|
154
209
|
data: {
|
|
155
210
|
title,
|
|
156
211
|
instructions,
|
|
157
212
|
dueDate: new Date(dueDate),
|
|
158
|
-
maxGrade: markSchemeId ?
|
|
213
|
+
maxGrade: markSchemeId ? computedMaxGrade : maxGrade,
|
|
159
214
|
graded,
|
|
160
215
|
weight,
|
|
161
216
|
type,
|
|
217
|
+
order: 0,
|
|
162
218
|
inProgress: inProgress || false,
|
|
163
219
|
class: {
|
|
164
220
|
connect: { id: classId }
|
|
@@ -173,7 +229,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
173
229
|
connect: { id: markSchemeId }
|
|
174
230
|
}
|
|
175
231
|
}),
|
|
176
|
-
...(gradingBoundaryId && {
|
|
232
|
+
...(gradingBoundaryId && {
|
|
177
233
|
gradingBoundary: {
|
|
178
234
|
connect: { id: gradingBoundaryId }
|
|
179
235
|
}
|
|
@@ -226,6 +282,12 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
226
282
|
}
|
|
227
283
|
});
|
|
228
284
|
|
|
285
|
+
await Promise.all(
|
|
286
|
+
stack.map(({ where, data }) =>
|
|
287
|
+
prisma.assignment.update({ where, data })
|
|
288
|
+
)
|
|
289
|
+
);
|
|
290
|
+
|
|
229
291
|
// Upload files if provided
|
|
230
292
|
let uploadedFiles: UploadedFile[] = [];
|
|
231
293
|
if (files && files.length > 0) {
|
|
@@ -495,7 +557,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
495
557
|
try {
|
|
496
558
|
// Delete the main file
|
|
497
559
|
await deleteFile(file.path);
|
|
498
|
-
|
|
560
|
+
|
|
499
561
|
// Delete thumbnail if it exists
|
|
500
562
|
if (file.thumbnail) {
|
|
501
563
|
await deleteFile(file.thumbnail.path);
|
|
@@ -510,7 +572,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
510
572
|
where: { id },
|
|
511
573
|
});
|
|
512
574
|
|
|
513
|
-
return {
|
|
575
|
+
return {
|
|
514
576
|
id,
|
|
515
577
|
};
|
|
516
578
|
}),
|
|
@@ -612,7 +674,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
612
674
|
id: true,
|
|
613
675
|
name: true,
|
|
614
676
|
},
|
|
615
|
-
});
|
|
677
|
+
});
|
|
616
678
|
|
|
617
679
|
return { ...assignment, sections };
|
|
618
680
|
}),
|
|
@@ -930,7 +992,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
930
992
|
|
|
931
993
|
// Delete removed attachments if any
|
|
932
994
|
if (removedAttachments && removedAttachments.length > 0) {
|
|
933
|
-
const filesToDelete = submission.attachments.filter((file) =>
|
|
995
|
+
const filesToDelete = submission.attachments.filter((file) =>
|
|
934
996
|
removedAttachments.includes(file.id)
|
|
935
997
|
);
|
|
936
998
|
|
|
@@ -939,7 +1001,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
939
1001
|
try {
|
|
940
1002
|
// Delete the main file
|
|
941
1003
|
await deleteFile(file.path);
|
|
942
|
-
|
|
1004
|
+
|
|
943
1005
|
// Delete thumbnail if it exists
|
|
944
1006
|
if (file.thumbnail?.path) {
|
|
945
1007
|
await deleteFile(file.thumbnail.path);
|
|
@@ -1069,7 +1131,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1069
1131
|
});
|
|
1070
1132
|
}
|
|
1071
1133
|
|
|
1072
|
-
const { submissionId, return: returnSubmission, gradeReceived, newAttachments, existingFileIds, removedAttachments, rubricGrades } = input;
|
|
1134
|
+
const { submissionId, return: returnSubmission, gradeReceived, newAttachments, existingFileIds, removedAttachments, rubricGrades, feedback } = input;
|
|
1073
1135
|
|
|
1074
1136
|
const submission = await prisma.submission.findFirst({
|
|
1075
1137
|
where: {
|
|
@@ -1198,7 +1260,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1198
1260
|
|
|
1199
1261
|
// Delete removed attachments if any
|
|
1200
1262
|
if (removedAttachments && removedAttachments.length > 0) {
|
|
1201
|
-
const filesToDelete = submission.annotations.filter((file) =>
|
|
1263
|
+
const filesToDelete = submission.annotations.filter((file) =>
|
|
1202
1264
|
removedAttachments.includes(file.id)
|
|
1203
1265
|
);
|
|
1204
1266
|
|
|
@@ -1207,7 +1269,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1207
1269
|
try {
|
|
1208
1270
|
// Delete the main file
|
|
1209
1271
|
await deleteFile(file.path);
|
|
1210
|
-
|
|
1272
|
+
|
|
1211
1273
|
// Delete thumbnail if it exists
|
|
1212
1274
|
if (file.thumbnail?.path) {
|
|
1213
1275
|
await deleteFile(file.thumbnail.path);
|
|
@@ -1224,6 +1286,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1224
1286
|
data: {
|
|
1225
1287
|
...(gradeReceived !== undefined && { gradeReceived }),
|
|
1226
1288
|
...(rubricGrades && { rubricState: JSON.stringify(rubricGrades) }),
|
|
1289
|
+
...(feedback && { teacherComments: feedback }),
|
|
1227
1290
|
...(removedAttachments && removedAttachments.length > 0 && {
|
|
1228
1291
|
annotations: {
|
|
1229
1292
|
deleteMany: {
|
|
@@ -1231,6 +1294,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1231
1294
|
},
|
|
1232
1295
|
},
|
|
1233
1296
|
}),
|
|
1297
|
+
...(returnSubmission as unknown as boolean && { returned: returnSubmission }),
|
|
1234
1298
|
},
|
|
1235
1299
|
include: {
|
|
1236
1300
|
attachments: {
|
|
@@ -1592,7 +1656,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1592
1656
|
|
|
1593
1657
|
return updatedAssignment;
|
|
1594
1658
|
}),
|
|
1595
|
-
|
|
1659
|
+
detachMarkScheme: protectedTeacherProcedure
|
|
1596
1660
|
.input(z.object({
|
|
1597
1661
|
assignmentId: z.string(),
|
|
1598
1662
|
}))
|
|
@@ -1611,7 +1675,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1611
1675
|
message: "Assignment not found",
|
|
1612
1676
|
});
|
|
1613
1677
|
}
|
|
1614
|
-
|
|
1678
|
+
|
|
1615
1679
|
const updatedAssignment = await prisma.assignment.update({
|
|
1616
1680
|
where: { id: assignmentId },
|
|
1617
1681
|
data: {
|
|
@@ -1630,7 +1694,7 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1630
1694
|
|
|
1631
1695
|
return updatedAssignment;
|
|
1632
1696
|
}),
|
|
1633
|
-
|
|
1697
|
+
attachGradingBoundary: protectedTeacherProcedure
|
|
1634
1698
|
.input(z.object({
|
|
1635
1699
|
assignmentId: z.string(),
|
|
1636
1700
|
gradingBoundaryId: z.string().nullable(),
|
|
@@ -1685,6 +1749,45 @@ export const assignmentRouter = createTRPCRouter({
|
|
|
1685
1749
|
},
|
|
1686
1750
|
});
|
|
1687
1751
|
|
|
1752
|
+
return updatedAssignment;
|
|
1753
|
+
}),
|
|
1754
|
+
detachGradingBoundary: protectedTeacherProcedure
|
|
1755
|
+
.input(z.object({
|
|
1756
|
+
classId: z.string(),
|
|
1757
|
+
assignmentId: z.string(),
|
|
1758
|
+
}))
|
|
1759
|
+
.mutation(async ({ ctx, input }) => {
|
|
1760
|
+
const { assignmentId } = input;
|
|
1761
|
+
|
|
1762
|
+
const assignment = await prisma.assignment.findFirst({
|
|
1763
|
+
where: {
|
|
1764
|
+
id: assignmentId,
|
|
1765
|
+
},
|
|
1766
|
+
});
|
|
1767
|
+
|
|
1768
|
+
if (!assignment) {
|
|
1769
|
+
throw new TRPCError({
|
|
1770
|
+
code: "NOT_FOUND",
|
|
1771
|
+
message: "Assignment not found",
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
const updatedAssignment = await prisma.assignment.update({
|
|
1776
|
+
where: { id: assignmentId },
|
|
1777
|
+
data: {
|
|
1778
|
+
gradingBoundary: {
|
|
1779
|
+
disconnect: true,
|
|
1780
|
+
},
|
|
1781
|
+
},
|
|
1782
|
+
include: {
|
|
1783
|
+
attachments: true,
|
|
1784
|
+
section: true,
|
|
1785
|
+
teacher: true,
|
|
1786
|
+
eventAttached: true,
|
|
1787
|
+
gradingBoundary: true,
|
|
1788
|
+
},
|
|
1789
|
+
});
|
|
1790
|
+
|
|
1688
1791
|
return updatedAssignment;
|
|
1689
1792
|
}),
|
|
1690
1793
|
});
|
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
|
@@ -182,6 +182,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
182
182
|
select: {
|
|
183
183
|
id: true,
|
|
184
184
|
name: true,
|
|
185
|
+
color: true,
|
|
185
186
|
_count: {
|
|
186
187
|
select: {
|
|
187
188
|
files: true,
|
|
@@ -324,6 +325,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
324
325
|
select: {
|
|
325
326
|
id: true,
|
|
326
327
|
name: true,
|
|
328
|
+
color: true,
|
|
327
329
|
_count: {
|
|
328
330
|
select: {
|
|
329
331
|
files: true,
|
|
@@ -398,6 +400,7 @@ export const folderRouter = createTRPCRouter({
|
|
|
398
400
|
select: {
|
|
399
401
|
id: true,
|
|
400
402
|
name: true,
|
|
403
|
+
color: true,
|
|
401
404
|
files: {
|
|
402
405
|
select: {
|
|
403
406
|
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
|
|