@studious-lms/server 1.0.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/LICENSE.txt +8 -0
- package/README.md +143 -0
- package/dist/exportType.d.ts +9 -0
- package/dist/exportType.d.ts.map +1 -0
- package/dist/exportType.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/lib/fileUpload.d.ts +38 -0
- package/dist/lib/fileUpload.d.ts.map +1 -0
- package/dist/lib/fileUpload.js +136 -0
- package/dist/lib/googleCloudStorage.d.ts +20 -0
- package/dist/lib/googleCloudStorage.d.ts.map +1 -0
- package/dist/lib/googleCloudStorage.js +88 -0
- package/dist/lib/prisma.d.ts +8 -0
- package/dist/lib/prisma.d.ts.map +1 -0
- package/dist/lib/prisma.js +11 -0
- package/dist/lib/thumbnailGenerator.d.ts +23 -0
- package/dist/lib/thumbnailGenerator.d.ts.map +1 -0
- package/dist/lib/thumbnailGenerator.js +180 -0
- package/dist/logger.d.ts +26 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +135 -0
- package/dist/middleware/auth.d.ts +7 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +170 -0
- package/dist/middleware/logging.d.ts +2 -0
- package/dist/middleware/logging.d.ts.map +1 -0
- package/dist/middleware/logging.js +51 -0
- package/dist/routers/_app.d.ts +4369 -0
- package/dist/routers/_app.d.ts.map +1 -0
- package/dist/routers/_app.js +29 -0
- package/dist/routers/agenda.d.ts +66 -0
- package/dist/routers/agenda.d.ts.map +1 -0
- package/dist/routers/agenda.js +78 -0
- package/dist/routers/announcement.d.ts +79 -0
- package/dist/routers/announcement.d.ts.map +1 -0
- package/dist/routers/announcement.js +122 -0
- package/dist/routers/assignment.d.ts +1051 -0
- package/dist/routers/assignment.d.ts.map +1 -0
- package/dist/routers/assignment.js +1497 -0
- package/dist/routers/attendance.d.ts +99 -0
- package/dist/routers/attendance.d.ts.map +1 -0
- package/dist/routers/attendance.js +269 -0
- package/dist/routers/auth.d.ts +87 -0
- package/dist/routers/auth.d.ts.map +1 -0
- package/dist/routers/auth.js +255 -0
- package/dist/routers/class.d.ts +427 -0
- package/dist/routers/class.d.ts.map +1 -0
- package/dist/routers/class.js +693 -0
- package/dist/routers/event.d.ts +249 -0
- package/dist/routers/event.d.ts.map +1 -0
- package/dist/routers/event.js +467 -0
- package/dist/routers/file.d.ts +27 -0
- package/dist/routers/file.d.ts.map +1 -0
- package/dist/routers/file.js +88 -0
- package/dist/routers/section.d.ts +51 -0
- package/dist/routers/section.d.ts.map +1 -0
- package/dist/routers/section.js +123 -0
- package/dist/routers/user.d.ts +49 -0
- package/dist/routers/user.d.ts.map +1 -0
- package/dist/routers/user.js +74 -0
- package/dist/socket/handlers.d.ts +3 -0
- package/dist/socket/handlers.d.ts.map +1 -0
- package/dist/socket/handlers.js +130 -0
- package/dist/trpc.d.ts +147 -0
- package/dist/trpc.d.ts.map +1 -0
- package/dist/trpc.js +67 -0
- package/dist/types/trpc.d.ts +16 -0
- package/dist/types/trpc.d.ts.map +1 -0
- package/dist/types/trpc.js +2 -0
- package/dist/utils/email.d.ts +3 -0
- package/dist/utils/email.d.ts.map +1 -0
- package/dist/utils/email.js +16 -0
- package/dist/utils/generateInviteCode.d.ts +6 -0
- package/dist/utils/generateInviteCode.d.ts.map +1 -0
- package/dist/utils/generateInviteCode.js +11 -0
- package/dist/utils/logger.d.ts +27 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +124 -0
- package/generated/prisma/client.d.ts +1 -0
- package/generated/prisma/client.js +4 -0
- package/generated/prisma/default.d.ts +1 -0
- package/generated/prisma/default.js +4 -0
- package/generated/prisma/edge.d.ts +1 -0
- package/generated/prisma/edge.js +389 -0
- package/generated/prisma/index-browser.js +375 -0
- package/generated/prisma/index.d.ts +34865 -0
- package/generated/prisma/index.js +410 -0
- package/generated/prisma/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/generated/prisma/package.json +140 -0
- package/generated/prisma/runtime/edge-esm.js +34 -0
- package/generated/prisma/runtime/edge.js +34 -0
- package/generated/prisma/runtime/index-browser.d.ts +370 -0
- package/generated/prisma/runtime/index-browser.js +16 -0
- package/generated/prisma/runtime/library.d.ts +3647 -0
- package/generated/prisma/runtime/library.js +146 -0
- package/generated/prisma/runtime/react-native.js +83 -0
- package/generated/prisma/runtime/wasm.js +35 -0
- package/generated/prisma/schema.prisma +304 -0
- package/generated/prisma/wasm.d.ts +1 -0
- package/generated/prisma/wasm.js +375 -0
- package/package.json +46 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authRouter = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const trpc_1 = require("../trpc");
|
|
6
|
+
const server_1 = require("@trpc/server");
|
|
7
|
+
const prisma_1 = require("@lib/prisma");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const bcryptjs_1 = require("bcryptjs");
|
|
10
|
+
const email_1 = require("@/utils/email");
|
|
11
|
+
const loginSchema = zod_1.z.object({
|
|
12
|
+
username: zod_1.z.string(),
|
|
13
|
+
password: zod_1.z.string(),
|
|
14
|
+
});
|
|
15
|
+
const registerSchema = zod_1.z.object({
|
|
16
|
+
username: zod_1.z.string().min(3, "Username must be at least 3 characters"),
|
|
17
|
+
email: zod_1.z.string().email("Invalid email address"),
|
|
18
|
+
password: zod_1.z.string().min(6, "Password must be at least 6 characters"),
|
|
19
|
+
confirmPassword: zod_1.z.string(),
|
|
20
|
+
}).refine((data) => data.password === data.confirmPassword, {
|
|
21
|
+
message: "Passwords don't match",
|
|
22
|
+
path: ["confirmPassword"],
|
|
23
|
+
});
|
|
24
|
+
exports.authRouter = (0, trpc_1.createTRPCRouter)({
|
|
25
|
+
register: trpc_1.publicProcedure
|
|
26
|
+
.input(registerSchema)
|
|
27
|
+
.mutation(async ({ input }) => {
|
|
28
|
+
const { username, email, password } = input;
|
|
29
|
+
// Check if username already exists
|
|
30
|
+
const existingUser = await prisma_1.prisma.user.findFirst({
|
|
31
|
+
where: {
|
|
32
|
+
OR: [
|
|
33
|
+
{ username },
|
|
34
|
+
{ email }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
select: {
|
|
38
|
+
id: true,
|
|
39
|
+
username: true,
|
|
40
|
+
email: true,
|
|
41
|
+
verified: true,
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
if (existingUser && existingUser.verified) {
|
|
45
|
+
if (existingUser.username === username) {
|
|
46
|
+
throw new server_1.TRPCError({
|
|
47
|
+
code: "CONFLICT",
|
|
48
|
+
message: "Username already exists",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (existingUser.email === email) {
|
|
52
|
+
throw new server_1.TRPCError({
|
|
53
|
+
code: "CONFLICT",
|
|
54
|
+
message: "Email already exists",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (existingUser && !existingUser.verified) {
|
|
59
|
+
await prisma_1.prisma.session.deleteMany({
|
|
60
|
+
where: { userId: existingUser.id },
|
|
61
|
+
});
|
|
62
|
+
await prisma_1.prisma.user.delete({
|
|
63
|
+
where: { id: existingUser.id },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Create new user
|
|
67
|
+
const user = await prisma_1.prisma.user.create({
|
|
68
|
+
data: {
|
|
69
|
+
username,
|
|
70
|
+
email,
|
|
71
|
+
password: await (0, bcryptjs_1.hash)(password, 10),
|
|
72
|
+
profile: {},
|
|
73
|
+
},
|
|
74
|
+
select: {
|
|
75
|
+
id: true,
|
|
76
|
+
username: true,
|
|
77
|
+
email: true,
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const verificationToken = await prisma_1.prisma.session.create({
|
|
81
|
+
data: {
|
|
82
|
+
id: (0, uuid_1.v4)(),
|
|
83
|
+
userId: user.id,
|
|
84
|
+
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30),
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
await email_1.transport.sendMail({
|
|
88
|
+
from: 'noreply@studious.sh',
|
|
89
|
+
to: user.email,
|
|
90
|
+
subject: 'Verify your email',
|
|
91
|
+
text: `Click the link to verify your email: ${process.env.NEXT_PUBLIC_APP_URL}/verify/${verificationToken.id}`,
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
user: {
|
|
95
|
+
id: user.id,
|
|
96
|
+
username: user.username,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}),
|
|
100
|
+
login: trpc_1.publicProcedure
|
|
101
|
+
.input(loginSchema)
|
|
102
|
+
.mutation(async ({ input }) => {
|
|
103
|
+
const { username, password } = input;
|
|
104
|
+
const user = await prisma_1.prisma.user.findFirst({
|
|
105
|
+
where: { username },
|
|
106
|
+
select: {
|
|
107
|
+
id: true,
|
|
108
|
+
username: true,
|
|
109
|
+
password: true,
|
|
110
|
+
email: true,
|
|
111
|
+
verified: true,
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (!user) {
|
|
115
|
+
throw new server_1.TRPCError({
|
|
116
|
+
code: "UNAUTHORIZED",
|
|
117
|
+
message: "Invalid username or password",
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (await (0, bcryptjs_1.compare)(password, user.password)) {
|
|
121
|
+
throw new server_1.TRPCError({
|
|
122
|
+
code: "UNAUTHORIZED",
|
|
123
|
+
message: "Invalid username or password",
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (!user.verified) {
|
|
127
|
+
return {
|
|
128
|
+
verified: false,
|
|
129
|
+
user: {
|
|
130
|
+
email: user.email,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// Create a new session
|
|
135
|
+
const session = await prisma_1.prisma.session.create({
|
|
136
|
+
data: {
|
|
137
|
+
id: (0, uuid_1.v4)(),
|
|
138
|
+
userId: user.id,
|
|
139
|
+
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30),
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
token: session.id,
|
|
144
|
+
user: {
|
|
145
|
+
id: user.id,
|
|
146
|
+
username: user.username,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}),
|
|
150
|
+
logout: trpc_1.publicProcedure
|
|
151
|
+
.mutation(async ({ ctx }) => {
|
|
152
|
+
if (!ctx.user) {
|
|
153
|
+
throw new server_1.TRPCError({
|
|
154
|
+
code: "UNAUTHORIZED",
|
|
155
|
+
message: "Not authenticated",
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
// Delete the current session
|
|
159
|
+
await prisma_1.prisma.session.deleteMany({
|
|
160
|
+
where: { userId: ctx.user.id },
|
|
161
|
+
});
|
|
162
|
+
return { success: true };
|
|
163
|
+
}),
|
|
164
|
+
check: trpc_1.protectedProcedure
|
|
165
|
+
.query(async ({ ctx }) => {
|
|
166
|
+
if (!ctx.user) {
|
|
167
|
+
throw new server_1.TRPCError({
|
|
168
|
+
code: "UNAUTHORIZED",
|
|
169
|
+
message: "Not authenticated",
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const user = await prisma_1.prisma.user.findUnique({
|
|
173
|
+
where: { id: ctx.user.id },
|
|
174
|
+
select: {
|
|
175
|
+
id: true,
|
|
176
|
+
username: true,
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
if (!user) {
|
|
180
|
+
throw new server_1.TRPCError({
|
|
181
|
+
code: "NOT_FOUND",
|
|
182
|
+
message: "User not found",
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return { user };
|
|
186
|
+
}),
|
|
187
|
+
resendVerificationEmail: trpc_1.publicProcedure
|
|
188
|
+
.input(zod_1.z.object({
|
|
189
|
+
email: zod_1.z.string().email(),
|
|
190
|
+
}))
|
|
191
|
+
.mutation(async ({ input }) => {
|
|
192
|
+
const { email } = input;
|
|
193
|
+
const user = await prisma_1.prisma.user.findFirst({
|
|
194
|
+
where: {
|
|
195
|
+
email,
|
|
196
|
+
},
|
|
197
|
+
select: {
|
|
198
|
+
id: true,
|
|
199
|
+
email: true,
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
if (!user) {
|
|
203
|
+
throw new server_1.TRPCError({
|
|
204
|
+
code: "NOT_FOUND",
|
|
205
|
+
message: "User not found",
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
await prisma_1.prisma.session.deleteMany({
|
|
209
|
+
where: { userId: user?.id },
|
|
210
|
+
});
|
|
211
|
+
const verificationToken = await prisma_1.prisma.session.create({
|
|
212
|
+
data: {
|
|
213
|
+
id: (0, uuid_1.v4)(),
|
|
214
|
+
userId: user.id,
|
|
215
|
+
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30),
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
await email_1.transport.sendMail({
|
|
219
|
+
from: 'noreply@studious.sh',
|
|
220
|
+
to: user.email,
|
|
221
|
+
subject: 'Verify your email',
|
|
222
|
+
text: `Click the link to verify your email: ${process.env.NEXT_PUBLIC_APP_URL}/verify/${verificationToken.id}`,
|
|
223
|
+
});
|
|
224
|
+
return { success: true };
|
|
225
|
+
}),
|
|
226
|
+
verify: trpc_1.publicProcedure
|
|
227
|
+
.input(zod_1.z.object({
|
|
228
|
+
token: zod_1.z.string(),
|
|
229
|
+
}))
|
|
230
|
+
.mutation(async ({ input }) => {
|
|
231
|
+
const { token } = input;
|
|
232
|
+
const session = await prisma_1.prisma.session.findUnique({
|
|
233
|
+
where: { id: token },
|
|
234
|
+
});
|
|
235
|
+
if (!session) {
|
|
236
|
+
throw new server_1.TRPCError({
|
|
237
|
+
code: "NOT_FOUND",
|
|
238
|
+
message: "Session not found",
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
if (session.expiresAt && session.expiresAt < new Date()) {
|
|
242
|
+
throw new server_1.TRPCError({
|
|
243
|
+
code: "UNAUTHORIZED",
|
|
244
|
+
message: "Session expired",
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
await prisma_1.prisma.user.update({
|
|
248
|
+
where: { id: session.userId },
|
|
249
|
+
data: {
|
|
250
|
+
verified: true,
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
return { success: true };
|
|
254
|
+
}),
|
|
255
|
+
});
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const classRouter: import("@trpc/server/dist/unstable-core-do-not-import").BuiltRouter<{
|
|
3
|
+
ctx: import("../trpc").Context;
|
|
4
|
+
meta: object;
|
|
5
|
+
errorShape: {
|
|
6
|
+
data: {
|
|
7
|
+
zodError: z.typeToFlattenedError<any, string> | null;
|
|
8
|
+
code: import("@trpc/server/dist/unstable-core-do-not-import").TRPC_ERROR_CODE_KEY;
|
|
9
|
+
httpStatus: number;
|
|
10
|
+
path?: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
};
|
|
13
|
+
message: string;
|
|
14
|
+
code: import("@trpc/server/dist/unstable-core-do-not-import").TRPC_ERROR_CODE_NUMBER;
|
|
15
|
+
};
|
|
16
|
+
transformer: false;
|
|
17
|
+
}, import("@trpc/server/dist/unstable-core-do-not-import").DecorateCreateRouterOptions<{
|
|
18
|
+
getAll: import("@trpc/server").TRPCQueryProcedure<{
|
|
19
|
+
input: void;
|
|
20
|
+
output: {
|
|
21
|
+
teacherInClass: {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
section: string;
|
|
25
|
+
subject: string;
|
|
26
|
+
dueToday: {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
}[];
|
|
30
|
+
color: string | null;
|
|
31
|
+
}[];
|
|
32
|
+
studentInClass: {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
section: string;
|
|
36
|
+
subject: string;
|
|
37
|
+
dueToday: {
|
|
38
|
+
id: string;
|
|
39
|
+
title: string;
|
|
40
|
+
}[];
|
|
41
|
+
color: string | null;
|
|
42
|
+
}[];
|
|
43
|
+
adminInClass: {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
section: string;
|
|
47
|
+
subject: string;
|
|
48
|
+
dueToday: {
|
|
49
|
+
id: string;
|
|
50
|
+
title: string;
|
|
51
|
+
}[];
|
|
52
|
+
color: string | null;
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
}>;
|
|
56
|
+
get: import("@trpc/server").TRPCQueryProcedure<{
|
|
57
|
+
input: {
|
|
58
|
+
classId: string;
|
|
59
|
+
};
|
|
60
|
+
output: {
|
|
61
|
+
class: {
|
|
62
|
+
assignments: {
|
|
63
|
+
late: boolean;
|
|
64
|
+
submitted: boolean;
|
|
65
|
+
returned: boolean;
|
|
66
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
67
|
+
id: string;
|
|
68
|
+
submissions: {
|
|
69
|
+
id: string;
|
|
70
|
+
studentId: string;
|
|
71
|
+
submittedAt: Date | null;
|
|
72
|
+
submitted: boolean | null;
|
|
73
|
+
returned: boolean | null;
|
|
74
|
+
}[];
|
|
75
|
+
section: {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
} | null;
|
|
79
|
+
title: string;
|
|
80
|
+
instructions: string;
|
|
81
|
+
dueDate: Date;
|
|
82
|
+
createdAt: Date | null;
|
|
83
|
+
graded: boolean;
|
|
84
|
+
maxGrade: number | null;
|
|
85
|
+
weight: number;
|
|
86
|
+
markScheme: {
|
|
87
|
+
id: string;
|
|
88
|
+
structured: string;
|
|
89
|
+
} | null;
|
|
90
|
+
gradingBoundary: {
|
|
91
|
+
id: string;
|
|
92
|
+
structured: string;
|
|
93
|
+
} | null;
|
|
94
|
+
}[];
|
|
95
|
+
sections: {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
classId: string;
|
|
99
|
+
}[];
|
|
100
|
+
announcements: {
|
|
101
|
+
id: string;
|
|
102
|
+
teacher: {
|
|
103
|
+
id: string;
|
|
104
|
+
username: string;
|
|
105
|
+
};
|
|
106
|
+
createdAt: Date;
|
|
107
|
+
remarks: string;
|
|
108
|
+
}[];
|
|
109
|
+
students: {
|
|
110
|
+
id: string;
|
|
111
|
+
username: string;
|
|
112
|
+
}[];
|
|
113
|
+
teachers: {
|
|
114
|
+
id: string;
|
|
115
|
+
username: string;
|
|
116
|
+
}[];
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
subject: string;
|
|
120
|
+
color: string | null;
|
|
121
|
+
section: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
126
|
+
input: {
|
|
127
|
+
[x: string]: unknown;
|
|
128
|
+
classId: string;
|
|
129
|
+
name?: string | undefined;
|
|
130
|
+
subject?: string | undefined;
|
|
131
|
+
section?: string | undefined;
|
|
132
|
+
};
|
|
133
|
+
output: {
|
|
134
|
+
updatedClass: {
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
subject: string;
|
|
138
|
+
section: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}>;
|
|
142
|
+
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
143
|
+
input: {
|
|
144
|
+
name: string;
|
|
145
|
+
subject: string;
|
|
146
|
+
section: string;
|
|
147
|
+
students?: string[] | undefined;
|
|
148
|
+
teachers?: string[] | undefined;
|
|
149
|
+
};
|
|
150
|
+
output: {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
subject: string;
|
|
154
|
+
color: string | null;
|
|
155
|
+
section: string;
|
|
156
|
+
};
|
|
157
|
+
}>;
|
|
158
|
+
delete: import("@trpc/server").TRPCMutationProcedure<{
|
|
159
|
+
input: {
|
|
160
|
+
[x: string]: unknown;
|
|
161
|
+
classId: string;
|
|
162
|
+
id: string;
|
|
163
|
+
};
|
|
164
|
+
output: {
|
|
165
|
+
deletedClass: {
|
|
166
|
+
id: string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}>;
|
|
170
|
+
addStudent: import("@trpc/server").TRPCMutationProcedure<{
|
|
171
|
+
input: {
|
|
172
|
+
[x: string]: unknown;
|
|
173
|
+
classId: string;
|
|
174
|
+
studentId: string;
|
|
175
|
+
};
|
|
176
|
+
output: {
|
|
177
|
+
updatedClass: {
|
|
178
|
+
id: string;
|
|
179
|
+
name: string;
|
|
180
|
+
subject: string;
|
|
181
|
+
section: string;
|
|
182
|
+
};
|
|
183
|
+
newStudent: {
|
|
184
|
+
id: string;
|
|
185
|
+
username: string;
|
|
186
|
+
email: string;
|
|
187
|
+
password: string;
|
|
188
|
+
verified: boolean;
|
|
189
|
+
profileId: string | null;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
}>;
|
|
193
|
+
changeRole: import("@trpc/server").TRPCMutationProcedure<{
|
|
194
|
+
input: {
|
|
195
|
+
[x: string]: unknown;
|
|
196
|
+
classId: string;
|
|
197
|
+
type: "teacher" | "student";
|
|
198
|
+
userId: string;
|
|
199
|
+
};
|
|
200
|
+
output: {
|
|
201
|
+
updatedClass: {
|
|
202
|
+
id: string;
|
|
203
|
+
name: string;
|
|
204
|
+
subject: string;
|
|
205
|
+
color: string | null;
|
|
206
|
+
section: string;
|
|
207
|
+
};
|
|
208
|
+
user: {
|
|
209
|
+
type: "teacher" | "student";
|
|
210
|
+
id: string;
|
|
211
|
+
username: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
}>;
|
|
215
|
+
removeMember: import("@trpc/server").TRPCMutationProcedure<{
|
|
216
|
+
input: {
|
|
217
|
+
[x: string]: unknown;
|
|
218
|
+
classId: string;
|
|
219
|
+
userId: string;
|
|
220
|
+
};
|
|
221
|
+
output: {
|
|
222
|
+
updatedClass: {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
subject: string;
|
|
226
|
+
color: string | null;
|
|
227
|
+
section: string;
|
|
228
|
+
};
|
|
229
|
+
removedUserId: string;
|
|
230
|
+
};
|
|
231
|
+
}>;
|
|
232
|
+
join: import("@trpc/server").TRPCMutationProcedure<{
|
|
233
|
+
input: {
|
|
234
|
+
classCode: string;
|
|
235
|
+
};
|
|
236
|
+
output: {
|
|
237
|
+
joinedClass: {
|
|
238
|
+
id: string;
|
|
239
|
+
name: string;
|
|
240
|
+
subject: string;
|
|
241
|
+
section: string;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
}>;
|
|
245
|
+
getInviteCode: import("@trpc/server").TRPCQueryProcedure<{
|
|
246
|
+
input: {
|
|
247
|
+
[x: string]: unknown;
|
|
248
|
+
classId: string;
|
|
249
|
+
};
|
|
250
|
+
output: {
|
|
251
|
+
code: string;
|
|
252
|
+
};
|
|
253
|
+
}>;
|
|
254
|
+
createInviteCode: import("@trpc/server").TRPCMutationProcedure<{
|
|
255
|
+
input: {
|
|
256
|
+
[x: string]: unknown;
|
|
257
|
+
classId: string;
|
|
258
|
+
};
|
|
259
|
+
output: {
|
|
260
|
+
code: string;
|
|
261
|
+
};
|
|
262
|
+
}>;
|
|
263
|
+
getGrades: import("@trpc/server").TRPCQueryProcedure<{
|
|
264
|
+
input: {
|
|
265
|
+
[x: string]: unknown;
|
|
266
|
+
classId: string;
|
|
267
|
+
userId: string;
|
|
268
|
+
};
|
|
269
|
+
output: {
|
|
270
|
+
grades: ({
|
|
271
|
+
assignment: {
|
|
272
|
+
id: string;
|
|
273
|
+
title: string;
|
|
274
|
+
maxGrade: number | null;
|
|
275
|
+
weight: number;
|
|
276
|
+
};
|
|
277
|
+
} & {
|
|
278
|
+
id: string;
|
|
279
|
+
studentId: string;
|
|
280
|
+
assignmentId: string;
|
|
281
|
+
gradeReceived: number | null;
|
|
282
|
+
createdAt: Date;
|
|
283
|
+
modifiedAt: Date;
|
|
284
|
+
rubricState: string | null;
|
|
285
|
+
submittedAt: Date | null;
|
|
286
|
+
submitted: boolean | null;
|
|
287
|
+
returned: boolean | null;
|
|
288
|
+
})[];
|
|
289
|
+
};
|
|
290
|
+
}>;
|
|
291
|
+
updateGrade: import("@trpc/server").TRPCMutationProcedure<{
|
|
292
|
+
input: {
|
|
293
|
+
[x: string]: unknown;
|
|
294
|
+
classId: string;
|
|
295
|
+
assignmentId: string;
|
|
296
|
+
submissionId: string;
|
|
297
|
+
gradeReceived: number | null;
|
|
298
|
+
};
|
|
299
|
+
output: {
|
|
300
|
+
assignment: {
|
|
301
|
+
id: string;
|
|
302
|
+
title: string;
|
|
303
|
+
maxGrade: number | null;
|
|
304
|
+
weight: number;
|
|
305
|
+
};
|
|
306
|
+
} & {
|
|
307
|
+
id: string;
|
|
308
|
+
studentId: string;
|
|
309
|
+
assignmentId: string;
|
|
310
|
+
gradeReceived: number | null;
|
|
311
|
+
createdAt: Date;
|
|
312
|
+
modifiedAt: Date;
|
|
313
|
+
rubricState: string | null;
|
|
314
|
+
submittedAt: Date | null;
|
|
315
|
+
submitted: boolean | null;
|
|
316
|
+
returned: boolean | null;
|
|
317
|
+
};
|
|
318
|
+
}>;
|
|
319
|
+
getEvents: import("@trpc/server").TRPCQueryProcedure<{
|
|
320
|
+
input: {
|
|
321
|
+
[x: string]: unknown;
|
|
322
|
+
classId: string;
|
|
323
|
+
};
|
|
324
|
+
output: {
|
|
325
|
+
name: string | null;
|
|
326
|
+
startTime: Date;
|
|
327
|
+
endTime: Date;
|
|
328
|
+
}[];
|
|
329
|
+
}>;
|
|
330
|
+
listMarkSchemes: import("@trpc/server").TRPCQueryProcedure<{
|
|
331
|
+
input: {
|
|
332
|
+
[x: string]: unknown;
|
|
333
|
+
classId: string;
|
|
334
|
+
};
|
|
335
|
+
output: {
|
|
336
|
+
id: string;
|
|
337
|
+
classId: string;
|
|
338
|
+
structured: string;
|
|
339
|
+
}[];
|
|
340
|
+
}>;
|
|
341
|
+
createMarkScheme: import("@trpc/server").TRPCMutationProcedure<{
|
|
342
|
+
input: {
|
|
343
|
+
[x: string]: unknown;
|
|
344
|
+
classId: string;
|
|
345
|
+
structure: string;
|
|
346
|
+
};
|
|
347
|
+
output: {
|
|
348
|
+
id: string;
|
|
349
|
+
classId: string;
|
|
350
|
+
structured: string;
|
|
351
|
+
};
|
|
352
|
+
}>;
|
|
353
|
+
updateMarkScheme: import("@trpc/server").TRPCMutationProcedure<{
|
|
354
|
+
input: {
|
|
355
|
+
[x: string]: unknown;
|
|
356
|
+
classId: string;
|
|
357
|
+
structure: string;
|
|
358
|
+
markSchemeId: string;
|
|
359
|
+
};
|
|
360
|
+
output: {
|
|
361
|
+
id: string;
|
|
362
|
+
classId: string;
|
|
363
|
+
structured: string;
|
|
364
|
+
};
|
|
365
|
+
}>;
|
|
366
|
+
deleteMarkScheme: import("@trpc/server").TRPCMutationProcedure<{
|
|
367
|
+
input: {
|
|
368
|
+
[x: string]: unknown;
|
|
369
|
+
classId: string;
|
|
370
|
+
markSchemeId: string;
|
|
371
|
+
};
|
|
372
|
+
output: {
|
|
373
|
+
id: string;
|
|
374
|
+
classId: string;
|
|
375
|
+
structured: string;
|
|
376
|
+
};
|
|
377
|
+
}>;
|
|
378
|
+
listGradingBoundaries: import("@trpc/server").TRPCQueryProcedure<{
|
|
379
|
+
input: {
|
|
380
|
+
[x: string]: unknown;
|
|
381
|
+
classId: string;
|
|
382
|
+
};
|
|
383
|
+
output: {
|
|
384
|
+
id: string;
|
|
385
|
+
classId: string;
|
|
386
|
+
structured: string;
|
|
387
|
+
}[];
|
|
388
|
+
}>;
|
|
389
|
+
createGradingBoundary: import("@trpc/server").TRPCMutationProcedure<{
|
|
390
|
+
input: {
|
|
391
|
+
[x: string]: unknown;
|
|
392
|
+
classId: string;
|
|
393
|
+
structure: string;
|
|
394
|
+
};
|
|
395
|
+
output: {
|
|
396
|
+
id: string;
|
|
397
|
+
classId: string;
|
|
398
|
+
structured: string;
|
|
399
|
+
};
|
|
400
|
+
}>;
|
|
401
|
+
updateGradingBoundary: import("@trpc/server").TRPCMutationProcedure<{
|
|
402
|
+
input: {
|
|
403
|
+
[x: string]: unknown;
|
|
404
|
+
classId: string;
|
|
405
|
+
structure: string;
|
|
406
|
+
gradingBoundaryId: string;
|
|
407
|
+
};
|
|
408
|
+
output: {
|
|
409
|
+
id: string;
|
|
410
|
+
classId: string;
|
|
411
|
+
structured: string;
|
|
412
|
+
};
|
|
413
|
+
}>;
|
|
414
|
+
deleteGradingBoundary: import("@trpc/server").TRPCMutationProcedure<{
|
|
415
|
+
input: {
|
|
416
|
+
[x: string]: unknown;
|
|
417
|
+
classId: string;
|
|
418
|
+
gradingBoundaryId: string;
|
|
419
|
+
};
|
|
420
|
+
output: {
|
|
421
|
+
id: string;
|
|
422
|
+
classId: string;
|
|
423
|
+
structured: string;
|
|
424
|
+
};
|
|
425
|
+
}>;
|
|
426
|
+
}>>;
|
|
427
|
+
//# sourceMappingURL=class.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0uBtB,CAAC"}
|