@studious-lms/server 1.2.47 → 1.2.49
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/index.js +22 -18
- package/dist/index.js.map +1 -1
- package/dist/middleware/security.d.ts.map +1 -1
- package/dist/middleware/security.js +4 -4
- package/dist/middleware/security.js.map +1 -1
- package/dist/routers/_app.d.ts +186 -0
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/agenda.d.ts +52 -0
- package/dist/routers/agenda.d.ts.map +1 -1
- package/dist/routers/agenda.js +4 -2
- package/dist/routers/agenda.js.map +1 -1
- package/dist/routers/announcement.d.ts +20 -0
- package/dist/routers/announcement.d.ts.map +1 -1
- package/dist/routers/announcement.js +9 -2
- package/dist/routers/announcement.js.map +1 -1
- package/dist/routers/assignment.d.ts +3 -0
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +5 -2
- package/dist/routers/assignment.js.map +1 -1
- package/dist/routers/class.d.ts +18 -0
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +56 -2
- package/dist/routers/class.js.map +1 -1
- package/dist/routers/newtonChat.d.ts.map +1 -1
- package/dist/routers/newtonChat.js +5 -6
- package/dist/routers/newtonChat.js.map +1 -1
- package/dist/seedDatabase.d.ts.map +1 -1
- package/dist/seedDatabase.js +34 -8
- package/dist/seedDatabase.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +24 -22
- package/src/middleware/security.ts +2 -2
- package/src/routers/agenda.ts +2 -0
- package/src/routers/announcement.ts +7 -0
- package/src/routers/assignment.ts +3 -0
- package/src/routers/class.ts +55 -0
- package/src/routers/newtonChat.ts +7 -9
- package/src/seedDatabase.ts +38 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a128ff07-a361-51b4-b86d-b00ea86ed03a")}catch(e){}}();
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import { createServer } from 'http';
|
|
5
5
|
import { Server } from 'socket.io';
|
|
@@ -25,7 +25,6 @@ app.use((req, res, next) => {
|
|
|
25
25
|
res.setHeader('X-Request-ID', requestId);
|
|
26
26
|
next();
|
|
27
27
|
});
|
|
28
|
-
app.use(generalLimiter);
|
|
29
28
|
const allowedOrigins = env.NODE_ENV === 'production'
|
|
30
29
|
? [
|
|
31
30
|
'https://www.studious.sh',
|
|
@@ -46,8 +45,10 @@ app.use(cors({
|
|
|
46
45
|
credentials: true,
|
|
47
46
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
|
48
47
|
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'x-user'],
|
|
49
|
-
|
|
48
|
+
preflightContinue: false, // Important: stop further handling of OPTIONS
|
|
49
|
+
optionsSuccessStatus: 204, // Recommended for modern browsers
|
|
50
50
|
}));
|
|
51
|
+
app.use(generalLimiter);
|
|
51
52
|
// CORS debugging middleware
|
|
52
53
|
app.use((req, res, next) => {
|
|
53
54
|
if (req.method === 'OPTIONS' || req.path.includes('trpc')) {
|
|
@@ -74,20 +75,23 @@ app.use((req, res, next) => {
|
|
|
74
75
|
});
|
|
75
76
|
next();
|
|
76
77
|
});
|
|
77
|
-
app.use("/panel", async (_, res) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
78
|
+
// app.use("/panel", async (_, res) => {
|
|
79
|
+
// if (env.NODE_ENV !== "development") {
|
|
80
|
+
// return res.status(404).send("Not Found");
|
|
81
|
+
// }
|
|
82
|
+
// // Dynamically import renderTrpcPanel only in development
|
|
83
|
+
// const { renderTrpcPanel } = await import("trpc-ui");
|
|
84
|
+
// return res.send(
|
|
85
|
+
// renderTrpcPanel(appRouter, {
|
|
86
|
+
// url: "/trpc", // Base url of your trpc server
|
|
87
|
+
// meta: {
|
|
88
|
+
// title: "Studious Backend",
|
|
89
|
+
// description:
|
|
90
|
+
// "This is the backend for the Studious application.",
|
|
91
|
+
// },
|
|
92
|
+
// })
|
|
93
|
+
// );
|
|
94
|
+
// });
|
|
91
95
|
// Create HTTP server
|
|
92
96
|
const httpServer = createServer(app);
|
|
93
97
|
app.get('/health', async (req, res) => {
|
|
@@ -447,4 +451,4 @@ const gracefulShutdown = (signal) => {
|
|
|
447
451
|
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
|
|
448
452
|
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
|
|
449
453
|
//# sourceMappingURL=index.js.map
|
|
450
|
-
//# debugId=
|
|
454
|
+
//# debugId=a128ff07-a361-51b4-b86d-b00ea86ed03a
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["index.ts"],"sourceRoot":"/","sourcesContent":["import express from 'express';\nimport type { Request, Response } from 'express';\nimport { createServer } from 'http';\nimport { Server } from 'socket.io';\nimport cors from 'cors';\nimport dotenv from 'dotenv';\nimport { createExpressMiddleware } from '@trpc/server/adapters/express';\nimport { appRouter } from './routers/_app.js';\nimport { createTRPCContext, createCallerFactory } from './trpc.js';\nimport { logger } from './utils/logger.js';\nimport { setupSocketHandlers } from './socket/handlers.js';\nimport { bucket } from './lib/googleCloudStorage.js';\nimport { prisma } from './lib/prisma.js';\n\nimport { authLimiter, generalLimiter, helmetConfig, uploadLimiter } from './middleware/security.js';\n\nimport * as Sentry from \"@sentry/node\";\nimport { env } from './lib/config/env.js';\nimport compression from 'compression';\nimport { v4 as uuidv4 } from 'uuid';\n\n\nimport \"./instrument.js\";\nimport { openAIClient } from './utils/inference.js';\n\nconst app = express();\n\napp.use(helmetConfig);\napp.use(compression());\n\napp.use((req, res, next) => {\n const requestId = uuidv4();\n res.setHeader('X-Request-ID', requestId);\n next();\n});\n\napp.use(generalLimiter);\n\nconst allowedOrigins = env.NODE_ENV === 'production'\n? [\n 'https://www.studious.sh',\n 'https://studious.sh',\n env.NEXT_PUBLIC_APP_URL,\n 'http://localhost:3000',\n\n ].filter(Boolean)\n: [\n 'http://localhost:3000',\n 'http://localhost:3001',\n 'http://127.0.0.1:3000',\n 'http://127.0.0.1:3001',\n\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ];\n\n// CORS middleware\napp.use(cors({\n origin: allowedOrigins,\n credentials: true,\n methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],\n allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'x-user'],\n optionsSuccessStatus: 200\n}));\n\n// CORS debugging middleware\napp.use((req, res, next) => {\n if (req.method === 'OPTIONS' || req.path.includes('trpc')) {\n logger.info('CORS Request', {\n method: req.method,\n path: req.path,\n origin: req.headers.origin,\n userAgent: req.headers['user-agent']\n });\n }\n next();\n});\n\n// Response time logging middleware\napp.use((req, res, next) => {\n const start = Date.now();\n res.on('finish', () => {\n const duration = Date.now() - start;\n logger.info('Request completed', {\n method: req.method,\n path: req.path,\n statusCode: res.statusCode,\n duration: `${duration}ms`\n });\n });\n next();\n});\n\napp.use(\"/panel\", async (_, res) => {\n if (env.NODE_ENV !== \"development\") {\n return res.status(404).send(\"Not Found\");\n }\n\n // Dynamically import renderTrpcPanel only in development\n const { renderTrpcPanel } = await import(\"trpc-ui\");\n\n return res.send(\n renderTrpcPanel(appRouter, {\n url: \"/trpc\", // Base url of your trpc server\n meta: {\n title: \"Studious Backend\",\n description:\n \"This is the backend for the Studious application.\",\n },\n })\n );\n});\n\n\n// Create HTTP server\nconst httpServer = createServer(app);\n\napp.get('/health', async (req, res) => {\n\n try {\n // Check database connectivity\n await prisma.$queryRaw`SELECT 1`;\n \n res.status(200).json({ \n status: 'OK',\n timestamp: new Date().toISOString(),\n uptime: process.uptime(),\n database: 'connected'\n });\n } catch (error) {\n res.status(503).json({ \n status: 'ERROR',\n database: 'disconnected',\n error: error instanceof Error ? error.message : 'Unknown error'\n });\n }\n});\n\n// Setup Socket.IO\nconst io = new Server(httpServer, {\n cors: {\n origin: [\n 'http://localhost:3000', // Frontend development server\n 'http://localhost:3001', // Server port\n 'http://127.0.0.1:3000', // Alternative localhost\n 'http://127.0.0.1:3001', // Alternative localhost\n 'https://www.studious.sh', // Production frontend\n 'https://studious.sh', // Production frontend (without www)\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ],\n methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],\n credentials: true,\n allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'Access-Control-Allow-Origin', 'x-user']\n },\n transports: ['websocket', 'polling'],\n pingTimeout: 60000,\n pingInterval: 25000,\n connectTimeout: 45000,\n path: '/socket.io/',\n allowEIO3: true\n});\n\n// Add server-level logging\nio.engine.on('connection_error', (err: Error) => {\n logger.error('Socket connection error', { error: err.message });\n});\n\n// Setup socket handlers\nsetupSocketHandlers(io);\n\n// File serving endpoint for secure file access\napp.get('/api/files/:fileId', async (req, res) => {\n try {\n const fileId = decodeURIComponent(req.params.fileId);\n // console.log('File request:', { fileId, originalPath: req.params.fileId });\n \n // Get user from request headers\n const userHeader = req.headers['x-user'];\n if (!userHeader) {\n return res.status(401).json({ error: 'Authentication required' });\n }\n\n const token = typeof userHeader === 'string' ? userHeader : userHeader[0];\n\n // Find user by session token\n const user = await prisma.user.findFirst({\n where: {\n sessions: {\n some: {\n id: token\n }\n }\n },\n select: {\n id: true,\n username: true,\n }\n });\n\n if (!user) {\n return res.status(401).json({ error: 'Invalid or expired session' });\n }\n\n // Find file in database by path\n const fileRecord = await prisma.file.findFirst({\n where: { id: fileId },\n include: {\n user: true,\n assignment: {\n include: {\n class: {\n include: {\n students: true,\n teachers: true\n }\n }\n }\n },\n submission: {\n include: {\n student: true,\n assignment: {\n include: {\n class: {\n include: {\n teachers: true\n }\n }\n }\n }\n }\n },\n annotations: {\n include: {\n student: true,\n assignment: {\n include: {\n class: {\n include: {\n teachers: true\n }\n }\n }\n }\n }\n },\n folder: {\n include: {\n class: {\n include: {\n students: true,\n teachers: true\n }\n }\n }\n },\n classDraft: {\n include: {\n students: true,\n teachers: true\n }\n }\n }\n });\n\n if (!fileRecord) {\n return res.status(404).json({ error: 'File not found in database' });\n }\n\n // Check if user has permission to access this file\n let hasPermission = false;\n\n // Check if user created the file\n if (fileRecord.userId === user.id) {\n hasPermission = true;\n }\n\n // Check if file is related to a class where user is a member\n if (!hasPermission) {\n // Check assignment files\n if (fileRecord.assignment?.class) {\n const classData = fileRecord.assignment.class;\n const isStudent = classData.students.some(student => student.id === user.id);\n const isTeacher = classData.teachers.some(teacher => teacher.id === user.id);\n if (isStudent || isTeacher) {\n hasPermission = true;\n }\n }\n\n if (!hasPermission && fileRecord.annotations) {\n const annotation = fileRecord.annotations;\n if (annotation.studentId === user.id) {\n hasPermission = true;\n } else if (annotation.assignment?.class?.teachers.some(teacher => teacher.id === user.id)) {\n hasPermission = true;\n }\n }\n\n // Check submission files (student can access their own submissions, teachers can access all submissions in their class)\n if (!hasPermission && fileRecord.submission) {\n const submission = fileRecord.submission;\n if (submission.studentId === user.id) {\n hasPermission = true; // Student accessing their own submission\n } else if (submission.assignment?.class?.teachers.some(teacher => teacher.id === user.id)) {\n hasPermission = true; // Teacher accessing submission in their class\n }\n }\n\n // Check folder files\n if (!hasPermission && fileRecord.folder?.class) {\n const classData = fileRecord.folder.class;\n const isStudent = classData.students.some(student => student.id === user.id);\n const isTeacher = classData.teachers.some(teacher => teacher.id === user.id);\n if (isStudent || isTeacher) {\n hasPermission = true;\n }\n }\n\n // Check class draft files\n if (!hasPermission && fileRecord.classDraft) {\n const classData = fileRecord.classDraft;\n const isStudent = classData.students.some(student => student.id === user.id);\n const isTeacher = classData.teachers.some(teacher => teacher.id === user.id);\n if (isStudent || isTeacher) {\n hasPermission = true;\n }\n }\n }\n\n if (!hasPermission) {\n return res.status(403).json({ error: 'Access denied - insufficient permissions' });\n }\n \n const filePath = fileRecord.path;\n \n // Get file from Google Cloud Storage\n const file = bucket.file(filePath);\n const [exists] = await file.exists();\n \n if (!exists) {\n return res.status(404).json({ error: 'File not found in storage', filePath });\n }\n \n // Get file metadata\n const [metadata] = await file.getMetadata();\n \n // Set appropriate headers\n res.set({\n 'Content-Type': metadata.contentType || 'application/octet-stream',\n 'Content-Length': metadata.size,\n 'Cache-Control': 'public, max-age=31536000', // 1 year cache\n 'ETag': metadata.etag,\n });\n \n // Stream file to response\n const stream = file.createReadStream();\n stream.pipe(res);\n \n stream.on('error', (error) => {\n logger.error('Error streaming file:', {error});\n if (!res.headersSent) {\n res.status(500).json({ error: 'Error streaming file' });\n }\n });\n \n } catch (error) {\n logger.error('Error serving file:', {error});\n res.status(500).json({ error: 'Internal server error' });\n }\n});\n\napp.use('/trpc/auth.login', authLimiter);\napp.use('/trpc/auth.register', authLimiter);\n\n// File upload endpoint for secure file uploads (supports both POST and PUT)\napp.post('/api/upload/:filePath', uploadLimiter, async (req, res) => {\n handleFileUpload(req, res);\n});\n\napp.put('/api/upload/:filePath', uploadLimiter, async (req, res) => {\n handleFileUpload(req, res);\n});\n\nfunction handleFileUpload(req: any, res: any) {\n try {\n const filePath = decodeURIComponent(req.params.filePath);\n \n // Set CORS headers for upload endpoint\n const origin = req.headers.origin;\n const allowedOrigins = [\n 'http://localhost:3000',\n 'http://localhost:3001', \n 'http://127.0.0.1:3000',\n 'http://127.0.0.1:3001',\n 'https://www.studious.sh', // Production frontend\n 'https://studious.sh', // Production frontend (without www)\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ];\n \n if (origin && allowedOrigins.includes(origin)) {\n res.header('Access-Control-Allow-Origin', origin);\n } else {\n res.header('Access-Control-Allow-Origin', 'http://localhost:3000');\n }\n \n res.header('Access-Control-Allow-Credentials', 'true');\n \n // Get content type from headers\n const contentType = req.headers['content-type'] || 'application/octet-stream';\n \n // Create a new file in the bucket\n const file = bucket.file(filePath);\n \n // Create a write stream to Google Cloud Storage\n const writeStream = file.createWriteStream({\n metadata: {\n contentType,\n },\n });\n \n // Handle stream events\n writeStream.on('error', (error) => {\n logger.error('Error uploading file:', {error});\n if (!res.headersSent) {\n res.status(500).json({ error: 'Error uploading file' });\n }\n });\n \n writeStream.on('finish', () => {\n res.status(200).json({ \n success: true, \n filePath,\n message: 'File uploaded successfully' \n });\n });\n \n // Pipe the request body to the write stream\n req.pipe(writeStream);\n \n } catch (error) {\n logger.error('Error handling file upload:', {error});\n res.status(500).json({ error: 'Internal server error' });\n }\n}\n\n// Create caller\nconst createCaller = createCallerFactory(appRouter);\n\n// Setup tRPC middleware\napp.use(\n '/trpc',\n createExpressMiddleware({\n router: appRouter,\n createContext: async ({ req, res }: { req: Request; res: Response }) => {\n return createTRPCContext({ req, res });\n },\n })\n);\n\n// IMPORTANT: Sentry error handler must be added AFTER all other middleware and routes\n// but BEFORE any other error handlers\nSentry.setupExpressErrorHandler(app);\n\n// app.use(function onError(err, req, res, next) {\n// // The error id is attached to `res.sentry` to be returned\n// // and optionally displayed to the user for support.\n// res.statusCode = 500;\n// res.end(res.sentry + \"\\n\");\n// });\n\n\nconst PORT = env.PORT || 3001;\n\nhttpServer.listen(PORT, () => {\n logger.info(`Server running on port ${PORT}`, { \n port: PORT,\n services: ['tRPC', 'Socket.IO']\n });\n}); \n\n// log all env variables\nlogger.info('Configurations', {\n NODE_ENV: env.NODE_ENV,\n PORT: env.PORT,\n NEXT_PUBLIC_APP_URL: env.NEXT_PUBLIC_APP_URL,\n LOG_MODE: env.LOG_MODE,\n});\n\n// Log CORS configuration\nlogger.info('CORS Configuration', {\n allowedOrigins: [\n 'http://localhost:3000',\n 'http://localhost:3001', \n 'http://127.0.0.1:3000',\n 'http://127.0.0.1:3001',\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ]\n});\n\nconst gracefulShutdown = (signal: string) => {\n logger.info(`Received ${signal}, shutting down gracefully`);\n \n httpServer.close(() => {\n logger.info('HTTP server closed');\n \n io.close(() => {\n logger.info('Socket.IO server closed');\n \n prisma.$disconnect().then(() => {\n logger.info('Database connections closed');\n process.exit(0);\n }).catch((err) => {\n logger.error('Error disconnecting from database', { error: err });\n process.exit(1);\n });\n });\n });\n \n // Force shutdown after 10 seconds\n setTimeout(() => {\n logger.error('Forced shutdown after timeout');\n process.exit(1);\n }, 10000);\n};\n\nprocess.on('SIGTERM', () => gracefulShutdown('SIGTERM'));\nprocess.on('SIGINT', () => gracefulShutdown('SIGINT'));"],"names":[],"mappings":";;AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,M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GAAG,EAAE;QACpB,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAElC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YACZ,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;YAEvC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC7B,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;gBAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;gBAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,kCAAkC;IAClC,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC,CAAC;AAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;AACzD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC","debug_id":"48b4164f-2397-50ef-9167-465c5ba7b38e"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["index.ts"],"sourceRoot":"/","sourcesContent":["import express from 'express';\nimport type { Request, Response } from 'express';\nimport { createServer } from 'http';\nimport { Server } from 'socket.io';\nimport cors from 'cors';\nimport dotenv from 'dotenv';\nimport { createExpressMiddleware } from '@trpc/server/adapters/express';\nimport { appRouter } from './routers/_app.js';\nimport { createTRPCContext, createCallerFactory } from './trpc.js';\nimport { logger } from './utils/logger.js';\nimport { setupSocketHandlers } from './socket/handlers.js';\nimport { bucket } from './lib/googleCloudStorage.js';\nimport { prisma } from './lib/prisma.js';\n\nimport { authLimiter, generalLimiter, helmetConfig, uploadLimiter } from './middleware/security.js';\n\nimport * as Sentry from \"@sentry/node\";\nimport { env } from './lib/config/env.js';\nimport compression from 'compression';\nimport { v4 as uuidv4 } from 'uuid';\n\n\nimport \"./instrument.js\";\nimport { openAIClient } from './utils/inference.js';\n\nconst app = express();\n\napp.use(helmetConfig);\napp.use(compression());\n\napp.use((req, res, next) => {\n const requestId = uuidv4();\n res.setHeader('X-Request-ID', requestId);\n next();\n});\n\nconst allowedOrigins = env.NODE_ENV === 'production'\n? [\n 'https://www.studious.sh',\n 'https://studious.sh',\n env.NEXT_PUBLIC_APP_URL,\n 'http://localhost:3000',\n\n ].filter(Boolean)\n: [\n 'http://localhost:3000',\n 'http://localhost:3001',\n 'http://127.0.0.1:3000',\n 'http://127.0.0.1:3001',\n\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ];\n\n// CORS middleware\napp.use(cors({\n origin: allowedOrigins,\n credentials: true,\n methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],\n allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'x-user'],\n preflightContinue: false, // Important: stop further handling of OPTIONS\n optionsSuccessStatus: 204, // Recommended for modern browsers\n\n}));\n\napp.use(generalLimiter);\n\n// CORS debugging middleware\napp.use((req, res, next) => {\n if (req.method === 'OPTIONS' || req.path.includes('trpc')) {\n logger.info('CORS Request', {\n method: req.method,\n path: req.path,\n origin: req.headers.origin,\n userAgent: req.headers['user-agent']\n });\n }\n next();\n});\n\n// Response time logging middleware\napp.use((req, res, next) => {\n const start = Date.now();\n res.on('finish', () => {\n const duration = Date.now() - start;\n logger.info('Request completed', {\n method: req.method,\n path: req.path,\n statusCode: res.statusCode,\n duration: `${duration}ms`\n });\n });\n next();\n});\n\n// app.use(\"/panel\", async (_, res) => {\n// if (env.NODE_ENV !== \"development\") {\n// return res.status(404).send(\"Not Found\");\n// }\n\n// // Dynamically import renderTrpcPanel only in development\n// const { renderTrpcPanel } = await import(\"trpc-ui\");\n\n// return res.send(\n// renderTrpcPanel(appRouter, {\n// url: \"/trpc\", // Base url of your trpc server\n// meta: {\n// title: \"Studious Backend\",\n// description:\n// \"This is the backend for the Studious application.\",\n// },\n// })\n// );\n// });\n\n\n// Create HTTP server\nconst httpServer = createServer(app);\n\napp.get('/health', async (req, res) => {\n\n try {\n // Check database connectivity\n await prisma.$queryRaw`SELECT 1`;\n \n res.status(200).json({ \n status: 'OK',\n timestamp: new Date().toISOString(),\n uptime: process.uptime(),\n database: 'connected'\n });\n } catch (error) {\n res.status(503).json({ \n status: 'ERROR',\n database: 'disconnected',\n error: error instanceof Error ? error.message : 'Unknown error'\n });\n }\n});\n\n// Setup Socket.IO\nconst io = new Server(httpServer, {\n cors: {\n origin: [\n 'http://localhost:3000', // Frontend development server\n 'http://localhost:3001', // Server port\n 'http://127.0.0.1:3000', // Alternative localhost\n 'http://127.0.0.1:3001', // Alternative localhost\n 'https://www.studious.sh', // Production frontend\n 'https://studious.sh', // Production frontend (without www)\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ],\n methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],\n credentials: true,\n allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'Access-Control-Allow-Origin', 'x-user']\n },\n transports: ['websocket', 'polling'],\n pingTimeout: 60000,\n pingInterval: 25000,\n connectTimeout: 45000,\n path: '/socket.io/',\n allowEIO3: true\n});\n\n// Add server-level logging\nio.engine.on('connection_error', (err: Error) => {\n logger.error('Socket connection error', { error: err.message });\n});\n\n// Setup socket handlers\nsetupSocketHandlers(io);\n\n// File serving endpoint for secure file access\napp.get('/api/files/:fileId', async (req, res) => {\n try {\n const fileId = decodeURIComponent(req.params.fileId);\n // console.log('File request:', { fileId, originalPath: req.params.fileId });\n \n // Get user from request headers\n const userHeader = req.headers['x-user'];\n if (!userHeader) {\n return res.status(401).json({ error: 'Authentication required' });\n }\n\n const token = typeof userHeader === 'string' ? userHeader : userHeader[0];\n\n // Find user by session token\n const user = await prisma.user.findFirst({\n where: {\n sessions: {\n some: {\n id: token\n }\n }\n },\n select: {\n id: true,\n username: true,\n }\n });\n\n if (!user) {\n return res.status(401).json({ error: 'Invalid or expired session' });\n }\n\n // Find file in database by path\n const fileRecord = await prisma.file.findFirst({\n where: { id: fileId },\n include: {\n user: true,\n assignment: {\n include: {\n class: {\n include: {\n students: true,\n teachers: true\n }\n }\n }\n },\n submission: {\n include: {\n student: true,\n assignment: {\n include: {\n class: {\n include: {\n teachers: true\n }\n }\n }\n }\n }\n },\n annotations: {\n include: {\n student: true,\n assignment: {\n include: {\n class: {\n include: {\n teachers: true\n }\n }\n }\n }\n }\n },\n folder: {\n include: {\n class: {\n include: {\n students: true,\n teachers: true\n }\n }\n }\n },\n classDraft: {\n include: {\n students: true,\n teachers: true\n }\n }\n }\n });\n\n if (!fileRecord) {\n return res.status(404).json({ error: 'File not found in database' });\n }\n\n // Check if user has permission to access this file\n let hasPermission = false;\n\n // Check if user created the file\n if (fileRecord.userId === user.id) {\n hasPermission = true;\n }\n\n // Check if file is related to a class where user is a member\n if (!hasPermission) {\n // Check assignment files\n if (fileRecord.assignment?.class) {\n const classData = fileRecord.assignment.class;\n const isStudent = classData.students.some(student => student.id === user.id);\n const isTeacher = classData.teachers.some(teacher => teacher.id === user.id);\n if (isStudent || isTeacher) {\n hasPermission = true;\n }\n }\n\n if (!hasPermission && fileRecord.annotations) {\n const annotation = fileRecord.annotations;\n if (annotation.studentId === user.id) {\n hasPermission = true;\n } else if (annotation.assignment?.class?.teachers.some(teacher => teacher.id === user.id)) {\n hasPermission = true;\n }\n }\n\n // Check submission files (student can access their own submissions, teachers can access all submissions in their class)\n if (!hasPermission && fileRecord.submission) {\n const submission = fileRecord.submission;\n if (submission.studentId === user.id) {\n hasPermission = true; // Student accessing their own submission\n } else if (submission.assignment?.class?.teachers.some(teacher => teacher.id === user.id)) {\n hasPermission = true; // Teacher accessing submission in their class\n }\n }\n\n // Check folder files\n if (!hasPermission && fileRecord.folder?.class) {\n const classData = fileRecord.folder.class;\n const isStudent = classData.students.some(student => student.id === user.id);\n const isTeacher = classData.teachers.some(teacher => teacher.id === user.id);\n if (isStudent || isTeacher) {\n hasPermission = true;\n }\n }\n\n // Check class draft files\n if (!hasPermission && fileRecord.classDraft) {\n const classData = fileRecord.classDraft;\n const isStudent = classData.students.some(student => student.id === user.id);\n const isTeacher = classData.teachers.some(teacher => teacher.id === user.id);\n if (isStudent || isTeacher) {\n hasPermission = true;\n }\n }\n }\n\n if (!hasPermission) {\n return res.status(403).json({ error: 'Access denied - insufficient permissions' });\n }\n \n const filePath = fileRecord.path;\n \n // Get file from Google Cloud Storage\n const file = bucket.file(filePath);\n const [exists] = await file.exists();\n \n if (!exists) {\n return res.status(404).json({ error: 'File not found in storage', filePath });\n }\n \n // Get file metadata\n const [metadata] = await file.getMetadata();\n \n // Set appropriate headers\n res.set({\n 'Content-Type': metadata.contentType || 'application/octet-stream',\n 'Content-Length': metadata.size,\n 'Cache-Control': 'public, max-age=31536000', // 1 year cache\n 'ETag': metadata.etag,\n });\n \n // Stream file to response\n const stream = file.createReadStream();\n stream.pipe(res);\n \n stream.on('error', (error) => {\n logger.error('Error streaming file:', {error});\n if (!res.headersSent) {\n res.status(500).json({ error: 'Error streaming file' });\n }\n });\n \n } catch (error) {\n logger.error('Error serving file:', {error});\n res.status(500).json({ error: 'Internal server error' });\n }\n});\n\napp.use('/trpc/auth.login', authLimiter);\napp.use('/trpc/auth.register', authLimiter);\n\n// File upload endpoint for secure file uploads (supports both POST and PUT)\napp.post('/api/upload/:filePath', uploadLimiter, async (req, res) => {\n handleFileUpload(req, res);\n});\n\napp.put('/api/upload/:filePath', uploadLimiter, async (req, res) => {\n handleFileUpload(req, res);\n});\n\nfunction handleFileUpload(req: any, res: any) {\n try {\n const filePath = decodeURIComponent(req.params.filePath);\n \n // Set CORS headers for upload endpoint\n const origin = req.headers.origin;\n const allowedOrigins = [\n 'http://localhost:3000',\n 'http://localhost:3001', \n 'http://127.0.0.1:3000',\n 'http://127.0.0.1:3001',\n 'https://www.studious.sh', // Production frontend\n 'https://studious.sh', // Production frontend (without www)\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ];\n \n if (origin && allowedOrigins.includes(origin)) {\n res.header('Access-Control-Allow-Origin', origin);\n } else {\n res.header('Access-Control-Allow-Origin', 'http://localhost:3000');\n }\n \n res.header('Access-Control-Allow-Credentials', 'true');\n \n // Get content type from headers\n const contentType = req.headers['content-type'] || 'application/octet-stream';\n \n // Create a new file in the bucket\n const file = bucket.file(filePath);\n \n // Create a write stream to Google Cloud Storage\n const writeStream = file.createWriteStream({\n metadata: {\n contentType,\n },\n });\n \n // Handle stream events\n writeStream.on('error', (error) => {\n logger.error('Error uploading file:', {error});\n if (!res.headersSent) {\n res.status(500).json({ error: 'Error uploading file' });\n }\n });\n \n writeStream.on('finish', () => {\n res.status(200).json({ \n success: true, \n filePath,\n message: 'File uploaded successfully' \n });\n });\n \n // Pipe the request body to the write stream\n req.pipe(writeStream);\n \n } catch (error) {\n logger.error('Error handling file upload:', {error});\n res.status(500).json({ error: 'Internal server error' });\n }\n}\n\n// Create caller\nconst createCaller = createCallerFactory(appRouter);\n\n// Setup tRPC middleware\napp.use(\n '/trpc',\n createExpressMiddleware({\n router: appRouter,\n createContext: async ({ req, res }: { req: Request; res: Response }) => {\n return createTRPCContext({ req, res });\n },\n })\n);\n\n// IMPORTANT: Sentry error handler must be added AFTER all other middleware and routes\n// but BEFORE any other error handlers\nSentry.setupExpressErrorHandler(app);\n\n// app.use(function onError(err, req, res, next) {\n// // The error id is attached to `res.sentry` to be returned\n// // and optionally displayed to the user for support.\n// res.statusCode = 500;\n// res.end(res.sentry + \"\\n\");\n// });\n\n\nconst PORT = env.PORT || 3001;\n\nhttpServer.listen(PORT, () => {\n logger.info(`Server running on port ${PORT}`, { \n port: PORT,\n services: ['tRPC', 'Socket.IO']\n });\n}); \n\n// log all env variables\nlogger.info('Configurations', {\n NODE_ENV: env.NODE_ENV,\n PORT: env.PORT,\n NEXT_PUBLIC_APP_URL: env.NEXT_PUBLIC_APP_URL,\n LOG_MODE: env.LOG_MODE,\n});\n\n// Log CORS configuration\nlogger.info('CORS Configuration', {\n allowedOrigins: [\n 'http://localhost:3000',\n 'http://localhost:3001', \n 'http://127.0.0.1:3000',\n 'http://127.0.0.1:3001',\n env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'\n ]\n});\n\nconst gracefulShutdown = (signal: string) => {\n logger.info(`Received ${signal}, shutting down gracefully`);\n \n httpServer.close(() => {\n logger.info('HTTP server closed');\n \n io.close(() => {\n logger.info('Socket.IO server closed');\n \n prisma.$disconnect().then(() => {\n logger.info('Database connections closed');\n process.exit(0);\n }).catch((err) => {\n logger.error('Error disconnecting from database', { error: err });\n process.exit(1);\n });\n });\n });\n \n // Force shutdown after 10 seconds\n setTimeout(() => {\n logger.error('Forced shutdown after timeout');\n process.exit(1);\n }, 10000);\n};\n\nprocess.on('SIGTERM', () => gracefulShutdown('SIGTERM'));\nprocess.on('SIGINT', () => gracefulShutdown('SIGINT'));"],"names":[],"mappings":";;AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,MA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AAC;AAGH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"/","sources":["middleware/security.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,cAAc,sDAWzB,CAAC;AAGH,eAAO,MAAM,WAAW,sDAQtB,CAAC;AAGH,eAAO,MAAM,aAAa,sDAOxB,CAAC;AAGH,eAAO,MAAM,YAAY,sFAwB2mF,CAAC,2BAAnoF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d9abebcd-0879-54b7-8f35-66b5ee7a0544")}catch(e){}}();
|
|
3
3
|
import helmet from 'helmet';
|
|
4
4
|
import rateLimit from 'express-rate-limit';
|
|
5
5
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
@@ -17,7 +17,7 @@ const rateLimitHandler = (req, res) => {
|
|
|
17
17
|
};
|
|
18
18
|
// General API rate limiter - applies to all routes
|
|
19
19
|
export const generalLimiter = rateLimit({
|
|
20
|
-
windowMs: 10 * 60
|
|
20
|
+
windowMs: 10 * 60, // 10 minutes
|
|
21
21
|
max: 100, // Limit each IP to 100 requests per windowMs
|
|
22
22
|
message: 'Too many requests from this IP, please try again later.',
|
|
23
23
|
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
|
|
@@ -25,7 +25,7 @@ export const generalLimiter = rateLimit({
|
|
|
25
25
|
handler: rateLimitHandler,
|
|
26
26
|
skip: (req) => {
|
|
27
27
|
// Skip rate limiting for health checks
|
|
28
|
-
return req.path === '/health';
|
|
28
|
+
return req.path === '/health' || req.method === 'OPTIONS';
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
// Stricter rate limiter for authentication endpoints
|
|
@@ -74,4 +74,4 @@ export const helmetConfig = helmet({
|
|
|
74
74
|
},
|
|
75
75
|
});
|
|
76
76
|
//# sourceMappingURL=security.js.map
|
|
77
|
-
//# debugId=
|
|
77
|
+
//# debugId=d9abebcd-0879-54b7-8f35-66b5ee7a0544
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.js","sources":["middleware/security.ts"],"sourceRoot":"/","sourcesContent":["import helmet from 'helmet';\nimport rateLimit from 'express-rate-limit';\nimport type { Request, Response } from 'express';\n\nconst isDevelopment = process.env.NODE_ENV === 'development';\n\n// Custom handler for rate limit errors that returns JSON\n// This format can be intercepted on the frontend with:\n// error.data?.code === 'TOO_MANY_REQUESTS' || error.data?.httpStatus === 429\nconst rateLimitHandler = (req: Request, res: Response) => {\n // Return JSON structure that can be intercepted on frontend with:\n // error.data?.code === 'TOO_MANY_REQUESTS' || error.data?.httpStatus === 429\n // When tRPC wraps this, the response body becomes error.data, so we put code/httpStatus at top level\n res.status(429).json({\n code: 'TOO_MANY_REQUESTS',\n message: 'Too many requests, please try again later.',\n });\n};\n\n// General API rate limiter - applies to all routes\nexport const generalLimiter = rateLimit({\n windowMs: 10 * 60
|
|
1
|
+
{"version":3,"file":"security.js","sources":["middleware/security.ts"],"sourceRoot":"/","sourcesContent":["import helmet from 'helmet';\nimport rateLimit from 'express-rate-limit';\nimport type { Request, Response } from 'express';\n\nconst isDevelopment = process.env.NODE_ENV === 'development';\n\n// Custom handler for rate limit errors that returns JSON\n// This format can be intercepted on the frontend with:\n// error.data?.code === 'TOO_MANY_REQUESTS' || error.data?.httpStatus === 429\nconst rateLimitHandler = (req: Request, res: Response) => {\n // Return JSON structure that can be intercepted on frontend with:\n // error.data?.code === 'TOO_MANY_REQUESTS' || error.data?.httpStatus === 429\n // When tRPC wraps this, the response body becomes error.data, so we put code/httpStatus at top level\n res.status(429).json({\n code: 'TOO_MANY_REQUESTS',\n message: 'Too many requests, please try again later.',\n });\n};\n\n// General API rate limiter - applies to all routes\nexport const generalLimiter = rateLimit({\n windowMs: 10 * 60, // 10 minutes\n max: 100, // Limit each IP to 100 requests per windowMs\n message: 'Too many requests from this IP, please try again later.',\n standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers\n legacyHeaders: false, // Disable the `X-RateLimit-*` headers\n handler: rateLimitHandler,\n skip: (req) => {\n // Skip rate limiting for health checks\n return req.path === '/health' || req.method === 'OPTIONS';\n },\n});\n\n// Stricter rate limiter for authentication endpoints\nexport const authLimiter = rateLimit({\n windowMs: 5 * 60 * 1000, // 5 minutes\n max: 5, // Limit each IP to 5 login attempts per windowMs\n message: 'Too many authentication attempts, please try again later.',\n standardHeaders: true,\n legacyHeaders: false,\n skipSuccessfulRequests: true, // Don't count successful requests\n handler: rateLimitHandler,\n});\n\n// File upload rate limiter\nexport const uploadLimiter = rateLimit({\n windowMs: 30 * 60 * 1000, // 30 minutes\n max: 50, // Limit each IP to 50 uploads per hour\n message: 'Too many file uploads, please try again later.',\n standardHeaders: true,\n legacyHeaders: false,\n handler: rateLimitHandler,\n});\n\n// Helmet configuration\nexport const helmetConfig = helmet({\n contentSecurityPolicy: {\n directives: {\n defaultSrc: [\"'self'\"],\n styleSrc: [\"'self'\", \"'unsafe-inline'\"], // Allow inline styles for tRPC panel\n // Allow inline scripts only in development (for tRPC panel)\n // In production, keep strict CSP without unsafe-inline\n scriptSrc: isDevelopment \n ? [\"'self'\", \"'unsafe-inline'\"] \n : [\"'self'\"],\n imgSrc: [\"'self'\", \"data:\", \"https:\"], // Allow images from any HTTPS source\n connectSrc: [\"'self'\", \"https://*.sentry.io\"], // Allow Sentry connections\n fontSrc: [\"'self'\", \"data:\"],\n objectSrc: [\"'none'\"],\n mediaSrc: [\"'self'\"],\n frameSrc: [\"'none'\"],\n },\n },\n crossOriginEmbedderPolicy: false, // Disable if you need to embed resources\n hsts: {\n maxAge: 31536000, // 1 year\n includeSubDomains: true,\n preload: true,\n },\n});"],"names":[],"mappings":";;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAG3C,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAE7D,yDAAyD;AACzD,uDAAuD;AACvD,6EAA6E;AAC7E,MAAM,gBAAgB,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IACvD,kEAAkE;IAClE,6EAA6E;IAC7E,qGAAqG;IACrG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,4CAA4C;KACtD,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,mDAAmD;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;IACtC,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE,aAAa;IAChC,GAAG,EAAE,GAAG,EAAE,6CAA6C;IACvD,OAAO,EAAE,yDAAyD;IAClE,eAAe,EAAE,IAAI,EAAE,sDAAsD;IAC7E,aAAa,EAAE,KAAK,EAAE,sCAAsC;IAC5D,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;QACZ,uCAAuC;QACvC,OAAO,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC;IAC5D,CAAC;CACF,CAAC,CAAC;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,YAAY;IACrC,GAAG,EAAE,CAAC,EAAE,iDAAiD;IACzD,OAAO,EAAE,2DAA2D;IACpE,eAAe,EAAE,IAA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,CAAC","debug_id":"d9abebcd-0879-54b7-8f35-66b5ee7a0544"}
|
package/dist/routers/_app.d.ts
CHANGED
|
@@ -53,6 +53,15 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
53
53
|
title: string;
|
|
54
54
|
dueDate: Date;
|
|
55
55
|
}[];
|
|
56
|
+
members: {
|
|
57
|
+
id: string;
|
|
58
|
+
username: string;
|
|
59
|
+
profile: {
|
|
60
|
+
displayName: string | null;
|
|
61
|
+
profilePicture: string | null;
|
|
62
|
+
profilePictureThumbnail: string | null;
|
|
63
|
+
} | null;
|
|
64
|
+
}[];
|
|
56
65
|
color: string | null;
|
|
57
66
|
}[];
|
|
58
67
|
studentInClass: {
|
|
@@ -72,6 +81,15 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
72
81
|
title: string;
|
|
73
82
|
dueDate: Date;
|
|
74
83
|
}[];
|
|
84
|
+
members: {
|
|
85
|
+
id: string;
|
|
86
|
+
username: string;
|
|
87
|
+
profile: {
|
|
88
|
+
displayName: string | null;
|
|
89
|
+
profilePicture: string | null;
|
|
90
|
+
profilePictureThumbnail: string | null;
|
|
91
|
+
} | null;
|
|
92
|
+
}[];
|
|
75
93
|
color: string | null;
|
|
76
94
|
}[];
|
|
77
95
|
};
|
|
@@ -841,6 +859,11 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
841
859
|
teacher: {
|
|
842
860
|
id: string;
|
|
843
861
|
username: string;
|
|
862
|
+
profile: {
|
|
863
|
+
displayName: string | null;
|
|
864
|
+
profilePicture: string | null;
|
|
865
|
+
profilePictureThumbnail: string | null;
|
|
866
|
+
} | null;
|
|
844
867
|
};
|
|
845
868
|
createdAt: Date;
|
|
846
869
|
modifiedAt: Date | null;
|
|
@@ -870,6 +893,11 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
870
893
|
teacher: {
|
|
871
894
|
id: string;
|
|
872
895
|
username: string;
|
|
896
|
+
profile: {
|
|
897
|
+
displayName: string | null;
|
|
898
|
+
profilePicture: string | null;
|
|
899
|
+
profilePictureThumbnail: string | null;
|
|
900
|
+
} | null;
|
|
873
901
|
};
|
|
874
902
|
createdAt: Date;
|
|
875
903
|
modifiedAt: Date | null;
|
|
@@ -905,6 +933,11 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
905
933
|
teacher: {
|
|
906
934
|
id: string;
|
|
907
935
|
username: string;
|
|
936
|
+
profile: {
|
|
937
|
+
displayName: string | null;
|
|
938
|
+
profilePicture: string | null;
|
|
939
|
+
profilePictureThumbnail: string | null;
|
|
940
|
+
} | null;
|
|
908
941
|
};
|
|
909
942
|
createdAt: Date;
|
|
910
943
|
modifiedAt: Date | null;
|
|
@@ -945,6 +978,11 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
945
978
|
teacher: {
|
|
946
979
|
id: string;
|
|
947
980
|
username: string;
|
|
981
|
+
profile: {
|
|
982
|
+
displayName: string | null;
|
|
983
|
+
profilePicture: string | null;
|
|
984
|
+
profilePictureThumbnail: string | null;
|
|
985
|
+
} | null;
|
|
948
986
|
};
|
|
949
987
|
createdAt: Date;
|
|
950
988
|
modifiedAt: Date | null;
|
|
@@ -1547,6 +1585,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1547
1585
|
eventAttached: {
|
|
1548
1586
|
id: string;
|
|
1549
1587
|
name: string | null;
|
|
1588
|
+
color: string | null;
|
|
1550
1589
|
location: string | null;
|
|
1551
1590
|
startTime: Date;
|
|
1552
1591
|
endTime: Date;
|
|
@@ -2379,6 +2418,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2379
2418
|
eventAttached: {
|
|
2380
2419
|
id: string;
|
|
2381
2420
|
name: string | null;
|
|
2421
|
+
color: string | null;
|
|
2382
2422
|
startTime: Date;
|
|
2383
2423
|
endTime: Date;
|
|
2384
2424
|
} | null;
|
|
@@ -2477,6 +2517,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2477
2517
|
events: {
|
|
2478
2518
|
id: string;
|
|
2479
2519
|
name: string | null;
|
|
2520
|
+
color: string | null;
|
|
2480
2521
|
location: string | null;
|
|
2481
2522
|
startTime: Date;
|
|
2482
2523
|
endTime: Date;
|
|
@@ -3710,6 +3751,32 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
3710
3751
|
section: string;
|
|
3711
3752
|
syllabus: string | null;
|
|
3712
3753
|
} | null;
|
|
3754
|
+
assignmentsAttached: {
|
|
3755
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
3756
|
+
id: string;
|
|
3757
|
+
title: string;
|
|
3758
|
+
dueDate: Date;
|
|
3759
|
+
maxGrade: number | null;
|
|
3760
|
+
classId: string;
|
|
3761
|
+
eventId: string | null;
|
|
3762
|
+
markSchemeId: string | null;
|
|
3763
|
+
gradingBoundaryId: string | null;
|
|
3764
|
+
instructions: string;
|
|
3765
|
+
weight: number;
|
|
3766
|
+
graded: boolean;
|
|
3767
|
+
sectionId: string | null;
|
|
3768
|
+
template: boolean;
|
|
3769
|
+
createdAt: Date | null;
|
|
3770
|
+
modifiedAt: Date | null;
|
|
3771
|
+
teacherId: string;
|
|
3772
|
+
acceptFiles: boolean;
|
|
3773
|
+
acceptExtendedResponse: boolean;
|
|
3774
|
+
acceptWorksheet: boolean;
|
|
3775
|
+
gradeWithAI: boolean;
|
|
3776
|
+
aiPolicyLevel: number;
|
|
3777
|
+
inProgress: boolean;
|
|
3778
|
+
order: number | null;
|
|
3779
|
+
}[];
|
|
3713
3780
|
} & {
|
|
3714
3781
|
id: string;
|
|
3715
3782
|
name: string | null;
|
|
@@ -3731,6 +3798,32 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
3731
3798
|
section: string;
|
|
3732
3799
|
syllabus: string | null;
|
|
3733
3800
|
} | null;
|
|
3801
|
+
assignmentsAttached: {
|
|
3802
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
3803
|
+
id: string;
|
|
3804
|
+
title: string;
|
|
3805
|
+
dueDate: Date;
|
|
3806
|
+
maxGrade: number | null;
|
|
3807
|
+
classId: string;
|
|
3808
|
+
eventId: string | null;
|
|
3809
|
+
markSchemeId: string | null;
|
|
3810
|
+
gradingBoundaryId: string | null;
|
|
3811
|
+
instructions: string;
|
|
3812
|
+
weight: number;
|
|
3813
|
+
graded: boolean;
|
|
3814
|
+
sectionId: string | null;
|
|
3815
|
+
template: boolean;
|
|
3816
|
+
createdAt: Date | null;
|
|
3817
|
+
modifiedAt: Date | null;
|
|
3818
|
+
teacherId: string;
|
|
3819
|
+
acceptFiles: boolean;
|
|
3820
|
+
acceptExtendedResponse: boolean;
|
|
3821
|
+
acceptWorksheet: boolean;
|
|
3822
|
+
gradeWithAI: boolean;
|
|
3823
|
+
aiPolicyLevel: number;
|
|
3824
|
+
inProgress: boolean;
|
|
3825
|
+
order: number | null;
|
|
3826
|
+
}[];
|
|
3734
3827
|
} & {
|
|
3735
3828
|
id: string;
|
|
3736
3829
|
name: string | null;
|
|
@@ -5469,6 +5562,15 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
5469
5562
|
title: string;
|
|
5470
5563
|
dueDate: Date;
|
|
5471
5564
|
}[];
|
|
5565
|
+
members: {
|
|
5566
|
+
id: string;
|
|
5567
|
+
username: string;
|
|
5568
|
+
profile: {
|
|
5569
|
+
displayName: string | null;
|
|
5570
|
+
profilePicture: string | null;
|
|
5571
|
+
profilePictureThumbnail: string | null;
|
|
5572
|
+
} | null;
|
|
5573
|
+
}[];
|
|
5472
5574
|
color: string | null;
|
|
5473
5575
|
}[];
|
|
5474
5576
|
studentInClass: {
|
|
@@ -5488,6 +5590,15 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
5488
5590
|
title: string;
|
|
5489
5591
|
dueDate: Date;
|
|
5490
5592
|
}[];
|
|
5593
|
+
members: {
|
|
5594
|
+
id: string;
|
|
5595
|
+
username: string;
|
|
5596
|
+
profile: {
|
|
5597
|
+
displayName: string | null;
|
|
5598
|
+
profilePicture: string | null;
|
|
5599
|
+
profilePictureThumbnail: string | null;
|
|
5600
|
+
} | null;
|
|
5601
|
+
}[];
|
|
5491
5602
|
color: string | null;
|
|
5492
5603
|
}[];
|
|
5493
5604
|
};
|
|
@@ -6257,6 +6368,11 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6257
6368
|
teacher: {
|
|
6258
6369
|
id: string;
|
|
6259
6370
|
username: string;
|
|
6371
|
+
profile: {
|
|
6372
|
+
displayName: string | null;
|
|
6373
|
+
profilePicture: string | null;
|
|
6374
|
+
profilePictureThumbnail: string | null;
|
|
6375
|
+
} | null;
|
|
6260
6376
|
};
|
|
6261
6377
|
createdAt: Date;
|
|
6262
6378
|
modifiedAt: Date | null;
|
|
@@ -6286,6 +6402,11 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6286
6402
|
teacher: {
|
|
6287
6403
|
id: string;
|
|
6288
6404
|
username: string;
|
|
6405
|
+
profile: {
|
|
6406
|
+
displayName: string | null;
|
|
6407
|
+
profilePicture: string | null;
|
|
6408
|
+
profilePictureThumbnail: string | null;
|
|
6409
|
+
} | null;
|
|
6289
6410
|
};
|
|
6290
6411
|
createdAt: Date;
|
|
6291
6412
|
modifiedAt: Date | null;
|
|
@@ -6321,6 +6442,11 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6321
6442
|
teacher: {
|
|
6322
6443
|
id: string;
|
|
6323
6444
|
username: string;
|
|
6445
|
+
profile: {
|
|
6446
|
+
displayName: string | null;
|
|
6447
|
+
profilePicture: string | null;
|
|
6448
|
+
profilePictureThumbnail: string | null;
|
|
6449
|
+
} | null;
|
|
6324
6450
|
};
|
|
6325
6451
|
createdAt: Date;
|
|
6326
6452
|
modifiedAt: Date | null;
|
|
@@ -6361,6 +6487,11 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6361
6487
|
teacher: {
|
|
6362
6488
|
id: string;
|
|
6363
6489
|
username: string;
|
|
6490
|
+
profile: {
|
|
6491
|
+
displayName: string | null;
|
|
6492
|
+
profilePicture: string | null;
|
|
6493
|
+
profilePictureThumbnail: string | null;
|
|
6494
|
+
} | null;
|
|
6364
6495
|
};
|
|
6365
6496
|
createdAt: Date;
|
|
6366
6497
|
modifiedAt: Date | null;
|
|
@@ -6963,6 +7094,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
6963
7094
|
eventAttached: {
|
|
6964
7095
|
id: string;
|
|
6965
7096
|
name: string | null;
|
|
7097
|
+
color: string | null;
|
|
6966
7098
|
location: string | null;
|
|
6967
7099
|
startTime: Date;
|
|
6968
7100
|
endTime: Date;
|
|
@@ -7795,6 +7927,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
7795
7927
|
eventAttached: {
|
|
7796
7928
|
id: string;
|
|
7797
7929
|
name: string | null;
|
|
7930
|
+
color: string | null;
|
|
7798
7931
|
startTime: Date;
|
|
7799
7932
|
endTime: Date;
|
|
7800
7933
|
} | null;
|
|
@@ -7893,6 +8026,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
7893
8026
|
events: {
|
|
7894
8027
|
id: string;
|
|
7895
8028
|
name: string | null;
|
|
8029
|
+
color: string | null;
|
|
7896
8030
|
location: string | null;
|
|
7897
8031
|
startTime: Date;
|
|
7898
8032
|
endTime: Date;
|
|
@@ -9126,6 +9260,32 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
9126
9260
|
section: string;
|
|
9127
9261
|
syllabus: string | null;
|
|
9128
9262
|
} | null;
|
|
9263
|
+
assignmentsAttached: {
|
|
9264
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
9265
|
+
id: string;
|
|
9266
|
+
title: string;
|
|
9267
|
+
dueDate: Date;
|
|
9268
|
+
maxGrade: number | null;
|
|
9269
|
+
classId: string;
|
|
9270
|
+
eventId: string | null;
|
|
9271
|
+
markSchemeId: string | null;
|
|
9272
|
+
gradingBoundaryId: string | null;
|
|
9273
|
+
instructions: string;
|
|
9274
|
+
weight: number;
|
|
9275
|
+
graded: boolean;
|
|
9276
|
+
sectionId: string | null;
|
|
9277
|
+
template: boolean;
|
|
9278
|
+
createdAt: Date | null;
|
|
9279
|
+
modifiedAt: Date | null;
|
|
9280
|
+
teacherId: string;
|
|
9281
|
+
acceptFiles: boolean;
|
|
9282
|
+
acceptExtendedResponse: boolean;
|
|
9283
|
+
acceptWorksheet: boolean;
|
|
9284
|
+
gradeWithAI: boolean;
|
|
9285
|
+
aiPolicyLevel: number;
|
|
9286
|
+
inProgress: boolean;
|
|
9287
|
+
order: number | null;
|
|
9288
|
+
}[];
|
|
9129
9289
|
} & {
|
|
9130
9290
|
id: string;
|
|
9131
9291
|
name: string | null;
|
|
@@ -9147,6 +9307,32 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
9147
9307
|
section: string;
|
|
9148
9308
|
syllabus: string | null;
|
|
9149
9309
|
} | null;
|
|
9310
|
+
assignmentsAttached: {
|
|
9311
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
9312
|
+
id: string;
|
|
9313
|
+
title: string;
|
|
9314
|
+
dueDate: Date;
|
|
9315
|
+
maxGrade: number | null;
|
|
9316
|
+
classId: string;
|
|
9317
|
+
eventId: string | null;
|
|
9318
|
+
markSchemeId: string | null;
|
|
9319
|
+
gradingBoundaryId: string | null;
|
|
9320
|
+
instructions: string;
|
|
9321
|
+
weight: number;
|
|
9322
|
+
graded: boolean;
|
|
9323
|
+
sectionId: string | null;
|
|
9324
|
+
template: boolean;
|
|
9325
|
+
createdAt: Date | null;
|
|
9326
|
+
modifiedAt: Date | null;
|
|
9327
|
+
teacherId: string;
|
|
9328
|
+
acceptFiles: boolean;
|
|
9329
|
+
acceptExtendedResponse: boolean;
|
|
9330
|
+
acceptWorksheet: boolean;
|
|
9331
|
+
gradeWithAI: boolean;
|
|
9332
|
+
aiPolicyLevel: number;
|
|
9333
|
+
inProgress: boolean;
|
|
9334
|
+
order: number | null;
|
|
9335
|
+
}[];
|
|
9150
9336
|
} & {
|
|
9151
9337
|
id: string;
|
|
9152
9338
|
name: string | null;
|