@studious-lms/server 1.2.53 → 1.4.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/.coderabbit.yaml +9 -0
- package/.env.example +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +102 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/config/env.d.ts +21 -0
- package/dist/lib/config/env.d.ts.map +1 -1
- package/dist/lib/config/env.js +8 -2
- package/dist/lib/config/env.js.map +1 -1
- package/dist/lib/fileUpload.d.ts.map +1 -1
- package/dist/lib/fileUpload.js +2 -2
- package/dist/lib/fileUpload.js.map +1 -1
- package/dist/lib/googleCloudStorage.d.ts +6 -0
- package/dist/lib/googleCloudStorage.d.ts.map +1 -1
- package/dist/lib/googleCloudStorage.js +19 -2
- package/dist/lib/googleCloudStorage.js.map +1 -1
- package/dist/lib/pusher.d.ts +4 -1
- package/dist/lib/pusher.d.ts.map +1 -1
- package/dist/lib/pusher.js +6 -3
- package/dist/lib/pusher.js.map +1 -1
- package/dist/lib/redis.d.ts +5 -0
- package/dist/lib/redis.d.ts.map +1 -0
- package/dist/lib/redis.js +53 -0
- package/dist/lib/redis.js.map +1 -0
- package/dist/lib/thumbnailGenerator.d.ts +0 -21
- package/dist/lib/thumbnailGenerator.d.ts.map +1 -1
- package/dist/lib/thumbnailGenerator.js +157 -160
- package/dist/lib/thumbnailGenerator.js.map +1 -1
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +33 -95
- package/dist/middleware/auth.js.map +1 -1
- package/dist/models/agenda.d.ts +97 -0
- package/dist/models/agenda.d.ts.map +1 -0
- package/dist/models/agenda.js +40 -0
- package/dist/models/agenda.js.map +1 -0
- package/dist/models/announcement.d.ts +223 -0
- package/dist/models/announcement.d.ts.map +1 -0
- package/dist/models/announcement.js +120 -0
- package/dist/models/announcement.js.map +1 -0
- package/dist/models/assignment.d.ts +1292 -0
- package/dist/models/assignment.d.ts.map +1 -0
- package/dist/models/assignment.js +309 -0
- package/dist/models/assignment.js.map +1 -0
- package/dist/models/attendance.d.ts +180 -0
- package/dist/models/attendance.d.ts.map +1 -0
- package/dist/models/attendance.js +188 -0
- package/dist/models/attendance.js.map +1 -0
- package/dist/models/auth.d.ts +153 -0
- package/dist/models/auth.d.ts.map +1 -0
- package/dist/models/auth.js +217 -0
- package/dist/models/auth.js.map +1 -0
- package/dist/models/class.d.ts +461 -0
- package/dist/models/class.d.ts.map +1 -0
- package/dist/models/class.js +645 -0
- package/dist/models/class.js.map +1 -0
- package/dist/models/comment.d.ts +171 -0
- package/dist/models/comment.d.ts.map +1 -0
- package/dist/models/comment.js +138 -0
- package/dist/models/comment.js.map +1 -0
- package/dist/models/conversation.d.ts +164 -0
- package/dist/models/conversation.d.ts.map +1 -0
- package/dist/models/conversation.js +175 -0
- package/dist/models/conversation.js.map +1 -0
- package/dist/models/event.d.ts +295 -0
- package/dist/models/event.d.ts.map +1 -0
- package/dist/models/event.js +145 -0
- package/dist/models/event.js.map +1 -0
- package/dist/models/file.d.ts +536 -0
- package/dist/models/file.d.ts.map +1 -0
- package/dist/models/file.js +126 -0
- package/dist/models/file.js.map +1 -0
- package/dist/models/folder.d.ts +295 -0
- package/dist/models/folder.d.ts.map +1 -0
- package/dist/models/folder.js +202 -0
- package/dist/models/folder.js.map +1 -0
- package/dist/models/labChat.d.ts +243 -0
- package/dist/models/labChat.d.ts.map +1 -0
- package/dist/models/labChat.js +204 -0
- package/dist/models/labChat.js.map +1 -0
- package/dist/models/marketing.d.ts +72 -0
- package/dist/models/marketing.d.ts.map +1 -0
- package/dist/models/marketing.js +26 -0
- package/dist/models/marketing.js.map +1 -0
- package/dist/models/message.d.ts +100 -0
- package/dist/models/message.d.ts.map +1 -0
- package/dist/models/message.js +131 -0
- package/dist/models/message.js.map +1 -0
- package/dist/models/newtonChat.d.ts +72 -0
- package/dist/models/newtonChat.d.ts.map +1 -0
- package/dist/models/newtonChat.js +61 -0
- package/dist/models/newtonChat.js.map +1 -0
- package/dist/models/notification.d.ts +65 -0
- package/dist/models/notification.d.ts.map +1 -0
- package/dist/models/notification.js +46 -0
- package/dist/models/notification.js.map +1 -0
- package/dist/models/section.d.ts +102 -0
- package/dist/models/section.d.ts.map +1 -0
- package/dist/models/section.js +83 -0
- package/dist/models/section.js.map +1 -0
- package/dist/models/user.d.ts +39 -0
- package/dist/models/user.d.ts.map +1 -0
- package/dist/models/user.js +38 -0
- package/dist/models/user.js.map +1 -0
- package/dist/models/worksheet.d.ts +460 -0
- package/dist/models/worksheet.d.ts.map +1 -0
- package/dist/models/worksheet.js +200 -0
- package/dist/models/worksheet.js.map +1 -0
- package/dist/pipelines/aiLabChat.d.ts +76 -0
- package/dist/pipelines/aiLabChat.d.ts.map +1 -0
- package/dist/pipelines/aiLabChat.js +599 -0
- package/dist/pipelines/aiLabChat.js.map +1 -0
- package/dist/pipelines/aiNewtonChat.d.ts +30 -0
- package/dist/pipelines/aiNewtonChat.d.ts.map +1 -0
- package/dist/pipelines/aiNewtonChat.js +289 -0
- package/dist/pipelines/aiNewtonChat.js.map +1 -0
- package/dist/pipelines/gradeWorksheet.d.ts +30 -0
- package/dist/pipelines/gradeWorksheet.d.ts.map +1 -0
- package/dist/pipelines/gradeWorksheet.js +252 -0
- package/dist/pipelines/gradeWorksheet.js.map +1 -0
- package/dist/routers/_app.d.ts +1523 -1315
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/agenda.d.ts +22 -22
- package/dist/routers/agenda.d.ts.map +1 -1
- package/dist/routers/agenda.js +4 -65
- package/dist/routers/agenda.js.map +1 -1
- package/dist/routers/announcement.d.ts +16 -16
- package/dist/routers/announcement.d.ts.map +1 -1
- package/dist/routers/announcement.js +37 -446
- package/dist/routers/announcement.js.map +1 -1
- package/dist/routers/assignment.d.ts +300 -378
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +78 -1868
- package/dist/routers/assignment.js.map +1 -1
- package/dist/routers/attendance.d.ts +19 -9
- package/dist/routers/attendance.d.ts.map +1 -1
- package/dist/routers/attendance.js +7 -264
- package/dist/routers/attendance.js.map +1 -1
- package/dist/routers/auth.d.ts +2 -2
- package/dist/routers/auth.d.ts.map +1 -1
- package/dist/routers/auth.js +29 -354
- package/dist/routers/auth.js.map +1 -1
- package/dist/routers/class.d.ts +160 -68
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +82 -1052
- package/dist/routers/class.js.map +1 -1
- package/dist/routers/comment.d.ts +6 -42
- package/dist/routers/comment.d.ts.map +1 -1
- package/dist/routers/comment.js +24 -244
- package/dist/routers/comment.js.map +1 -1
- package/dist/routers/conversation.d.ts +45 -7
- package/dist/routers/conversation.d.ts.map +1 -1
- package/dist/routers/conversation.js +19 -327
- package/dist/routers/conversation.js.map +1 -1
- package/dist/routers/event.d.ts +36 -36
- package/dist/routers/event.d.ts.map +1 -1
- package/dist/routers/event.js +13 -433
- package/dist/routers/event.js.map +1 -1
- package/dist/routers/file.d.ts +2 -2
- package/dist/routers/file.d.ts.map +1 -1
- package/dist/routers/file.js +9 -323
- package/dist/routers/file.js.map +1 -1
- package/dist/routers/folder.d.ts +21 -14
- package/dist/routers/folder.d.ts.map +1 -1
- package/dist/routers/folder.js +34 -745
- package/dist/routers/folder.js.map +1 -1
- package/dist/routers/labChat.d.ts +21 -11
- package/dist/routers/labChat.d.ts.map +1 -1
- package/dist/routers/labChat.js +22 -570
- package/dist/routers/labChat.js.map +1 -1
- package/dist/routers/marketing.d.ts +1 -1
- package/dist/routers/marketing.d.ts.map +1 -1
- package/dist/routers/marketing.js +7 -56
- package/dist/routers/marketing.js.map +1 -1
- package/dist/routers/message.d.ts +13 -2
- package/dist/routers/message.d.ts.map +1 -1
- package/dist/routers/message.js +32 -520
- package/dist/routers/message.js.map +1 -1
- package/dist/routers/newtonChat.d.ts +1 -1
- package/dist/routers/newtonChat.d.ts.map +1 -1
- package/dist/routers/newtonChat.js +7 -246
- package/dist/routers/newtonChat.js.map +1 -1
- package/dist/routers/notifications.d.ts +4 -4
- package/dist/routers/notifications.d.ts.map +1 -1
- package/dist/routers/notifications.js +18 -83
- package/dist/routers/notifications.js.map +1 -1
- package/dist/routers/section.d.ts +4 -4
- package/dist/routers/section.d.ts.map +1 -1
- package/dist/routers/section.js +14 -286
- package/dist/routers/section.js.map +1 -1
- package/dist/routers/user.d.ts +1 -1
- package/dist/routers/user.d.ts.map +1 -1
- package/dist/routers/user.js +32 -207
- package/dist/routers/user.js.map +1 -1
- package/dist/routers/worksheet.d.ts +68 -55
- package/dist/routers/worksheet.d.ts.map +1 -1
- package/dist/routers/worksheet.js +79 -394
- package/dist/routers/worksheet.js.map +1 -1
- package/dist/seedDatabase.d.ts +1 -1
- package/dist/server/pipelines/gradeWorksheet.d.ts +6 -6
- package/dist/server/pipelines/gradeWorksheet.d.ts.map +1 -1
- package/dist/server/pipelines/gradeWorksheet.js +12 -5
- package/dist/server/pipelines/gradeWorksheet.js.map +1 -1
- package/dist/services/agenda.d.ts +100 -0
- package/dist/services/agenda.d.ts.map +1 -0
- package/dist/services/agenda.js +21 -0
- package/dist/services/agenda.js.map +1 -0
- package/dist/services/announcement.d.ts +135 -0
- package/dist/services/announcement.d.ts.map +1 -0
- package/dist/services/announcement.js +223 -0
- package/dist/services/announcement.js.map +1 -0
- package/dist/services/assignment.d.ts +1462 -0
- package/dist/services/assignment.d.ts.map +1 -0
- package/dist/services/assignment.js +898 -0
- package/dist/services/assignment.js.map +1 -0
- package/dist/services/attendance.d.ts +93 -0
- package/dist/services/attendance.d.ts.map +1 -0
- package/dist/services/attendance.js +61 -0
- package/dist/services/attendance.js.map +1 -0
- package/dist/services/auth.d.ts +68 -0
- package/dist/services/auth.d.ts.map +1 -0
- package/dist/services/auth.js +218 -0
- package/dist/services/auth.js.map +1 -0
- package/dist/services/class.d.ts +643 -0
- package/dist/services/class.d.ts.map +1 -0
- package/dist/services/class.js +486 -0
- package/dist/services/class.js.map +1 -0
- package/dist/services/comment.d.ts +100 -0
- package/dist/services/comment.d.ts.map +1 -0
- package/dist/services/comment.js +83 -0
- package/dist/services/comment.js.map +1 -0
- package/dist/services/conversation.d.ts +159 -0
- package/dist/services/conversation.d.ts.map +1 -0
- package/dist/services/conversation.js +138 -0
- package/dist/services/conversation.js.map +1 -0
- package/dist/services/event.d.ts +216 -0
- package/dist/services/event.d.ts.map +1 -0
- package/dist/services/event.js +168 -0
- package/dist/services/event.js.map +1 -0
- package/dist/services/file.d.ts +74 -0
- package/dist/services/file.d.ts.map +1 -0
- package/dist/services/file.js +133 -0
- package/dist/services/file.js.map +1 -0
- package/dist/services/folder.d.ts +239 -0
- package/dist/services/folder.d.ts.map +1 -0
- package/dist/services/folder.js +248 -0
- package/dist/services/folder.js.map +1 -0
- package/dist/services/labChat.d.ts +169 -0
- package/dist/services/labChat.d.ts.map +1 -0
- package/dist/services/labChat.js +381 -0
- package/dist/services/labChat.js.map +1 -0
- package/dist/services/marketing.d.ts +50 -0
- package/dist/services/marketing.d.ts.map +1 -0
- package/dist/services/marketing.js +32 -0
- package/dist/services/marketing.js.map +1 -0
- package/dist/services/message.d.ts +103 -0
- package/dist/services/message.d.ts.map +1 -0
- package/dist/services/message.js +422 -0
- package/dist/services/message.js.map +1 -0
- package/dist/services/newtonChat.d.ts +22 -0
- package/dist/services/newtonChat.d.ts.map +1 -0
- package/dist/services/newtonChat.js +174 -0
- package/dist/services/newtonChat.js.map +1 -0
- package/dist/services/notification.d.ts +65 -0
- package/dist/services/notification.d.ts.map +1 -0
- package/dist/services/notification.js +33 -0
- package/dist/services/notification.js.map +1 -0
- package/dist/services/section.d.ts +53 -0
- package/dist/services/section.d.ts.map +1 -0
- package/dist/services/section.js +199 -0
- package/dist/services/section.js.map +1 -0
- package/dist/services/user.d.ts +48 -0
- package/dist/services/user.d.ts.map +1 -0
- package/dist/services/user.js +141 -0
- package/dist/services/user.js.map +1 -0
- package/dist/services/worksheet.d.ts +239 -0
- package/dist/services/worksheet.d.ts.map +1 -0
- package/dist/services/worksheet.js +235 -0
- package/dist/services/worksheet.js.map +1 -0
- package/dist/utils/aiUser.d.ts +1 -3
- package/dist/utils/aiUser.d.ts.map +1 -1
- package/dist/utils/aiUser.js +6 -5
- package/dist/utils/aiUser.js.map +1 -1
- package/dist/utils/email.d.ts +3 -0
- package/dist/utils/email.d.ts.map +1 -1
- package/dist/utils/email.js +7 -4
- package/dist/utils/email.js.map +1 -1
- package/dist/utils/generateInviteCode.d.ts +1 -2
- package/dist/utils/generateInviteCode.d.ts.map +1 -1
- package/dist/utils/generateInviteCode.js +3 -4
- package/dist/utils/generateInviteCode.js.map +1 -1
- package/dist/utils/inference.d.ts +3 -0
- package/dist/utils/inference.d.ts.map +1 -1
- package/dist/utils/inference.js +7 -4
- package/dist/utils/inference.js.map +1 -1
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +5 -2
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/prismaErrorHandler.d.ts.map +1 -1
- package/dist/utils/prismaErrorHandler.js +5 -2
- package/dist/utils/prismaErrorHandler.js.map +1 -1
- package/dist/utils/prismaWrapper.d.ts +1 -0
- package/dist/utils/prismaWrapper.d.ts.map +1 -1
- package/dist/utils/prismaWrapper.js +6 -2
- package/dist/utils/prismaWrapper.js.map +1 -1
- package/docker-compose.yml +5 -0
- package/package.json +4 -3
- package/prisma/schema.prisma +1 -1
- package/src/index.ts +119 -12
- package/src/lib/config/env.ts +6 -0
- package/src/lib/fileUpload.ts +0 -1
- package/src/lib/googleCloudStorage.ts +17 -0
- package/src/lib/pusher.ts +5 -1
- package/src/lib/redis.ts +56 -0
- package/src/lib/thumbnailGenerator.ts +170 -168
- package/src/middleware/auth.ts +80 -137
- package/src/models/agenda.ts +46 -0
- package/src/models/announcement.ts +134 -0
- package/src/models/assignment.ts +322 -0
- package/src/models/attendance.ts +208 -0
- package/src/models/auth.ts +247 -0
- package/src/models/class.ts +703 -0
- package/src/models/comment.ts +152 -0
- package/src/models/conversation.ts +200 -0
- package/src/models/event.ts +177 -0
- package/src/models/file.ts +129 -0
- package/src/models/folder.ts +225 -0
- package/src/models/labChat.ts +213 -0
- package/src/models/marketing.ts +45 -0
- package/src/models/message.ts +153 -0
- package/src/models/newtonChat.ts +70 -0
- package/src/models/notification.ts +54 -0
- package/src/models/section.ts +98 -0
- package/src/models/user.ts +47 -0
- package/src/models/worksheet.ts +294 -0
- package/src/pipelines/aiLabChat.ts +684 -0
- package/src/{server/pipelines → pipelines}/aiNewtonChat.ts +9 -5
- package/src/{server/pipelines → pipelines}/gradeWorksheet.ts +25 -14
- package/src/routers/agenda.ts +3 -66
- package/src/routers/announcement.ts +54 -495
- package/src/routers/assignment.ts +126 -2018
- package/src/routers/attendance.ts +15 -276
- package/src/routers/auth.ts +79 -442
- package/src/routers/class.ts +263 -1187
- package/src/routers/comment.ts +61 -288
- package/src/routers/conversation.ts +51 -360
- package/src/routers/event.ts +50 -481
- package/src/routers/file.ts +45 -368
- package/src/routers/folder.ts +107 -836
- package/src/routers/labChat.ts +35 -604
- package/src/routers/marketing.ts +35 -77
- package/src/routers/message.ts +54 -567
- package/src/routers/newtonChat.ts +17 -278
- package/src/routers/notifications.ts +32 -82
- package/src/routers/section.ts +46 -330
- package/src/routers/user.ts +49 -227
- package/src/routers/worksheet.ts +215 -503
- package/src/services/agenda.ts +21 -0
- package/src/services/announcement.ts +290 -0
- package/src/services/assignment.ts +1198 -0
- package/src/services/attendance.ts +85 -0
- package/src/services/auth.ts +277 -0
- package/src/services/class.ts +629 -0
- package/src/services/comment.ts +106 -0
- package/src/services/conversation.ts +213 -0
- package/src/services/event.ts +231 -0
- package/src/services/file.ts +167 -0
- package/src/services/folder.ts +316 -0
- package/src/services/labChat.ts +458 -0
- package/src/services/marketing.ts +57 -0
- package/src/services/message.ts +554 -0
- package/src/services/newtonChat.ts +222 -0
- package/src/services/notification.ts +50 -0
- package/src/services/section.ts +283 -0
- package/src/services/user.ts +172 -0
- package/src/services/worksheet.ts +358 -0
- package/src/utils/aiUser.ts +4 -3
- package/src/utils/email.ts +5 -3
- package/src/utils/generateInviteCode.ts +1 -3
- package/src/utils/inference.ts +5 -2
- package/src/utils/logger.ts +3 -1
- package/src/utils/prismaErrorHandler.ts +3 -0
- package/src/utils/prismaWrapper.ts +4 -0
- package/tests/globalSetup.ts +62 -0
- package/tests/helpers.ts +22 -0
- package/tests/middleware/security.test.ts +42 -0
- package/tests/routers/agenda.test.ts +138 -0
- package/tests/routers/announcement.test.ts +490 -0
- package/tests/routers/assignment.test.ts +837 -0
- package/tests/{attendance.test.ts → routers/attendance.test.ts} +6 -14
- package/tests/routers/auth.test.ts +171 -0
- package/tests/{class.test.ts → routers/class.test.ts} +131 -85
- package/tests/routers/comment.test.ts +126 -0
- package/tests/routers/conversation.test.ts +145 -0
- package/tests/{event.test.ts → routers/event.test.ts} +93 -32
- package/tests/routers/folder.test.ts +178 -0
- package/tests/routers/labChat.test.ts +115 -0
- package/tests/routers/marketing.test.ts +59 -0
- package/tests/routers/message.test.ts +123 -0
- package/tests/routers/notification.test.ts +69 -0
- package/tests/{section.test.ts → routers/section.test.ts} +5 -13
- package/tests/server/rateLimit.test.ts +73 -0
- package/tests/setup.ts +18 -92
- package/tests/user.test.ts +9 -31
- package/tests/utils/aiUser.test.ts +22 -0
- package/tests/utils/generateInviteCode.test.ts +24 -0
- package/tests/utils/logger.test.ts +74 -0
- package/tests/utils/prismaErrorHandler.test.ts +101 -0
- package/tests/utils/prismaWrapper.test.ts +82 -0
- package/tests/worksheet.test.ts +181 -0
- package/vitest.config.ts +6 -3
- package/vitest.unit.config.ts +21 -0
- package/TODO.md +0 -2
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -12110
- package/coverage/coverage-final.json +0 -44
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -221
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/server/index.html +0 -116
- package/coverage/server/src/exportType.ts.html +0 -109
- package/coverage/server/src/index.html +0 -161
- package/coverage/server/src/index.ts.html +0 -1702
- package/coverage/server/src/instrument.ts.html +0 -130
- package/coverage/server/src/lib/config/env.ts.html +0 -448
- package/coverage/server/src/lib/config/index.html +0 -116
- package/coverage/server/src/lib/fileUpload.ts.html +0 -1138
- package/coverage/server/src/lib/googleCloudStorage.ts.html +0 -334
- package/coverage/server/src/lib/index.html +0 -206
- package/coverage/server/src/lib/jsonConversion.ts.html +0 -2323
- package/coverage/server/src/lib/jsonStyles.ts.html +0 -193
- package/coverage/server/src/lib/notificationHandler.ts.html +0 -193
- package/coverage/server/src/lib/pusher.ts.html +0 -121
- package/coverage/server/src/lib/thumbnailGenerator.ts.html +0 -592
- package/coverage/server/src/middleware/auth.ts.html +0 -646
- package/coverage/server/src/middleware/index.html +0 -146
- package/coverage/server/src/middleware/logging.ts.html +0 -244
- package/coverage/server/src/middleware/security.ts.html +0 -271
- package/coverage/server/src/routers/_app.ts.html +0 -232
- package/coverage/server/src/routers/agenda.ts.html +0 -319
- package/coverage/server/src/routers/announcement.ts.html +0 -3481
- package/coverage/server/src/routers/assignment.ts.html +0 -7633
- package/coverage/server/src/routers/attendance.ts.html +0 -1030
- package/coverage/server/src/routers/auth.ts.html +0 -1081
- package/coverage/server/src/routers/class.ts.html +0 -3535
- package/coverage/server/src/routers/comment.ts.html +0 -991
- package/coverage/server/src/routers/conversation.ts.html +0 -982
- package/coverage/server/src/routers/event.ts.html +0 -1609
- package/coverage/server/src/routers/file.ts.html +0 -1144
- package/coverage/server/src/routers/folder.ts.html +0 -2797
- package/coverage/server/src/routers/index.html +0 -386
- package/coverage/server/src/routers/labChat.ts.html +0 -3073
- package/coverage/server/src/routers/marketing.ts.html +0 -340
- package/coverage/server/src/routers/message.ts.html +0 -1912
- package/coverage/server/src/routers/notifications.ts.html +0 -364
- package/coverage/server/src/routers/section.ts.html +0 -1120
- package/coverage/server/src/routers/user.ts.html +0 -862
- package/coverage/server/src/routers/worksheet.ts.html +0 -1729
- package/coverage/server/src/trpc.ts.html +0 -397
- package/coverage/server/src/types/index.html +0 -116
- package/coverage/server/src/types/trpc.ts.html +0 -127
- package/coverage/server/src/utils/aiUser.ts.html +0 -280
- package/coverage/server/src/utils/email.ts.html +0 -121
- package/coverage/server/src/utils/generateInviteCode.ts.html +0 -106
- package/coverage/server/src/utils/index.html +0 -206
- package/coverage/server/src/utils/inference.ts.html +0 -709
- package/coverage/server/src/utils/logger.ts.html +0 -664
- package/coverage/server/src/utils/prismaErrorHandler.ts.html +0 -907
- package/coverage/server/src/utils/prismaWrapper.ts.html +0 -355
- package/coverage/server/vitest.config.ts.html +0 -196
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/src/lib/notificationHandler.ts +0 -36
- package/src/server/pipelines/aiLabChat.ts +0 -507
- package/tests/announcement.test.ts +0 -164
- package/tests/assignment.test.ts +0 -296
- package/tests/auth.test.ts +0 -48
package/dist/routers/user.js
CHANGED
|
@@ -1,237 +1,62 @@
|
|
|
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]="7b0b6e3d-022d-5fe3-a54e-a8f4a40964f3")}catch(e){}}();
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { createTRPCRouter, protectedProcedure } from "../trpc.js";
|
|
5
|
-
import {
|
|
6
|
-
import { prisma } from "../lib/prisma.js";
|
|
7
|
-
import { logger } from "../utils/logger.js";
|
|
8
|
-
import { env } from "../lib/config/env.js";
|
|
9
|
-
// Helper function to convert file path to backend proxy URL
|
|
10
|
-
function getFileUrl(filePath) {
|
|
11
|
-
if (!filePath)
|
|
12
|
-
return null;
|
|
13
|
-
// If it's already a full URL (DiceBear or external), return as is
|
|
14
|
-
if (filePath.startsWith('http')) {
|
|
15
|
-
return filePath;
|
|
16
|
-
}
|
|
17
|
-
// Convert GCS path to full backend proxy URL
|
|
18
|
-
const backendUrl = env.BACKEND_URL || 'http://localhost:3001';
|
|
19
|
-
return `${backendUrl}/api/files/${encodeURIComponent(filePath)}`;
|
|
20
|
-
}
|
|
21
|
-
// For direct file uploads (file already uploaded to GCS)
|
|
5
|
+
import { getProfile, updateProfile, getUploadUrl, } from "../services/user.js";
|
|
22
6
|
const fileUploadSchema = z.object({
|
|
23
7
|
filePath: z.string().min(1, "File path is required"),
|
|
24
8
|
fileName: z.string().min(1, "File name is required"),
|
|
25
|
-
fileType: z
|
|
9
|
+
fileType: z
|
|
10
|
+
.string()
|
|
11
|
+
.regex(/^image\/(jpeg|jpg|png|gif|webp)$/i, "Only image files (JPEG, PNG, GIF, WebP) are allowed"),
|
|
26
12
|
fileSize: z.number().max(5 * 1024 * 1024, "File size must be less than 5MB"),
|
|
27
13
|
});
|
|
28
|
-
// For DiceBear avatar URL
|
|
29
14
|
const dicebearSchema = z.object({
|
|
30
15
|
url: z.string().url("Invalid DiceBear avatar URL"),
|
|
31
16
|
});
|
|
32
17
|
const profileSchema = z.object({
|
|
33
|
-
displayName: z
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
displayName: z
|
|
19
|
+
.string()
|
|
20
|
+
.nullable()
|
|
21
|
+
.optional()
|
|
22
|
+
.transform((val) => (val === null ? undefined : val)),
|
|
23
|
+
bio: z
|
|
24
|
+
.string()
|
|
25
|
+
.nullable()
|
|
26
|
+
.optional()
|
|
27
|
+
.transform((val) => (val === null ? undefined : val)),
|
|
28
|
+
location: z
|
|
29
|
+
.string()
|
|
30
|
+
.nullable()
|
|
31
|
+
.optional()
|
|
32
|
+
.transform((val) => (val === null ? undefined : val)),
|
|
33
|
+
website: z
|
|
34
|
+
.union([
|
|
37
35
|
z.string().url(),
|
|
38
36
|
z.literal(""),
|
|
39
|
-
z.null().transform(() => undefined)
|
|
40
|
-
])
|
|
37
|
+
z.null().transform(() => undefined),
|
|
38
|
+
])
|
|
39
|
+
.optional(),
|
|
41
40
|
});
|
|
42
41
|
const updateProfileSchema = z.object({
|
|
43
42
|
profile: profileSchema.optional(),
|
|
44
|
-
// Support both custom file upload and DiceBear avatar
|
|
45
43
|
profilePicture: fileUploadSchema.optional(),
|
|
46
44
|
dicebearAvatar: dicebearSchema.optional(),
|
|
47
45
|
});
|
|
48
46
|
const getUploadUrlSchema = z.object({
|
|
49
47
|
fileName: z.string().min(1, "File name is required"),
|
|
50
|
-
fileType: z
|
|
48
|
+
fileType: z
|
|
49
|
+
.string()
|
|
50
|
+
.regex(/^image\/(jpeg|jpg|png|gif|webp)$/i, "Only image files are allowed"),
|
|
51
51
|
});
|
|
52
52
|
export const userRouter = createTRPCRouter({
|
|
53
|
-
getProfile: protectedProcedure
|
|
54
|
-
.query(async ({ ctx }) => {
|
|
55
|
-
if (!ctx.user) {
|
|
56
|
-
throw new TRPCError({
|
|
57
|
-
code: "UNAUTHORIZED",
|
|
58
|
-
message: "User must be authenticated",
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const user = await prisma.user.findUnique({
|
|
62
|
-
where: { id: ctx.user.id },
|
|
63
|
-
select: {
|
|
64
|
-
id: true,
|
|
65
|
-
username: true,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
if (!user) {
|
|
69
|
-
throw new TRPCError({
|
|
70
|
-
code: "NOT_FOUND",
|
|
71
|
-
message: "User not found",
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
// Get user profile separately
|
|
75
|
-
const userProfile = await prisma.userProfile.findUnique({
|
|
76
|
-
where: { userId: ctx.user.id },
|
|
77
|
-
});
|
|
78
|
-
return {
|
|
79
|
-
id: user.id,
|
|
80
|
-
username: user.username,
|
|
81
|
-
profile: userProfile ? {
|
|
82
|
-
displayName: userProfile.displayName || null,
|
|
83
|
-
bio: userProfile.bio || null,
|
|
84
|
-
location: userProfile.location || null,
|
|
85
|
-
website: userProfile.website || null,
|
|
86
|
-
profilePicture: getFileUrl(userProfile.profilePicture),
|
|
87
|
-
profilePictureThumbnail: getFileUrl(userProfile.profilePictureThumbnail),
|
|
88
|
-
} : {
|
|
89
|
-
displayName: null,
|
|
90
|
-
bio: null,
|
|
91
|
-
location: null,
|
|
92
|
-
website: null,
|
|
93
|
-
profilePicture: null,
|
|
94
|
-
profilePictureThumbnail: null,
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
}),
|
|
53
|
+
getProfile: protectedProcedure.query(({ ctx }) => getProfile(ctx.user.id)),
|
|
98
54
|
updateProfile: protectedProcedure
|
|
99
55
|
.input(updateProfileSchema)
|
|
100
|
-
.mutation(
|
|
101
|
-
if (!ctx.user) {
|
|
102
|
-
throw new TRPCError({
|
|
103
|
-
code: "UNAUTHORIZED",
|
|
104
|
-
message: "User must be authenticated",
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
// Get current profile to clean up old profile picture
|
|
108
|
-
const currentProfile = await prisma.userProfile.findUnique({
|
|
109
|
-
where: { userId: ctx.user.id },
|
|
110
|
-
});
|
|
111
|
-
let profilePictureUrl = null;
|
|
112
|
-
let profilePictureThumbnail = null;
|
|
113
|
-
// Handle custom profile picture (already uploaded to GCS)
|
|
114
|
-
if (input.profilePicture) {
|
|
115
|
-
try {
|
|
116
|
-
// File is already uploaded to GCS, just use the path
|
|
117
|
-
profilePictureUrl = input.profilePicture.filePath;
|
|
118
|
-
// Generate thumbnail for the uploaded file
|
|
119
|
-
// TODO: Implement thumbnail generation for direct uploads
|
|
120
|
-
profilePictureThumbnail = null;
|
|
121
|
-
// Clean up old profile picture if it exists
|
|
122
|
-
if (currentProfile?.profilePicture) {
|
|
123
|
-
// TODO: Implement file deletion logic here
|
|
124
|
-
// await deleteFile((currentProfile as any).profilePicture);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
logger.error('Profile picture processing failed', {
|
|
129
|
-
userId: ctx.user.id,
|
|
130
|
-
error: error instanceof Error ? error.message : 'Unknown error'
|
|
131
|
-
});
|
|
132
|
-
throw new TRPCError({
|
|
133
|
-
code: "INTERNAL_SERVER_ERROR",
|
|
134
|
-
message: "Failed to process profile picture. Please try again.",
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
// Handle DiceBear avatar URL
|
|
139
|
-
if (input.dicebearAvatar) {
|
|
140
|
-
profilePictureUrl = input.dicebearAvatar.url;
|
|
141
|
-
// No thumbnail for DiceBear avatars since they're SVG URLs
|
|
142
|
-
profilePictureThumbnail = null;
|
|
143
|
-
}
|
|
144
|
-
// Prepare update data
|
|
145
|
-
const updateData = {};
|
|
146
|
-
if (input.profile) {
|
|
147
|
-
if (input.profile.displayName !== undefined && input.profile.displayName !== null) {
|
|
148
|
-
updateData.displayName = input.profile.displayName;
|
|
149
|
-
}
|
|
150
|
-
if (input.profile.bio !== undefined && input.profile.bio !== null) {
|
|
151
|
-
updateData.bio = input.profile.bio;
|
|
152
|
-
}
|
|
153
|
-
if (input.profile.location !== undefined && input.profile.location !== null) {
|
|
154
|
-
updateData.location = input.profile.location;
|
|
155
|
-
}
|
|
156
|
-
if (input.profile.website !== undefined && input.profile.website !== null) {
|
|
157
|
-
updateData.website = input.profile.website;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (profilePictureUrl !== null)
|
|
161
|
-
updateData.profilePicture = profilePictureUrl;
|
|
162
|
-
if (profilePictureThumbnail !== null)
|
|
163
|
-
updateData.profilePictureThumbnail = profilePictureThumbnail;
|
|
164
|
-
// Upsert user profile with structured data
|
|
165
|
-
const updatedProfile = await prisma.userProfile.upsert({
|
|
166
|
-
where: { userId: ctx.user.id },
|
|
167
|
-
create: {
|
|
168
|
-
userId: ctx.user.id,
|
|
169
|
-
...updateData,
|
|
170
|
-
},
|
|
171
|
-
update: {
|
|
172
|
-
...updateData,
|
|
173
|
-
updatedAt: new Date(),
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
// Get username for response
|
|
177
|
-
const user = await prisma.user.findUnique({
|
|
178
|
-
where: { id: ctx.user.id },
|
|
179
|
-
select: { username: true },
|
|
180
|
-
});
|
|
181
|
-
return {
|
|
182
|
-
id: ctx.user.id,
|
|
183
|
-
username: user?.username || '',
|
|
184
|
-
profile: {
|
|
185
|
-
displayName: updatedProfile.displayName || null,
|
|
186
|
-
bio: updatedProfile.bio || null,
|
|
187
|
-
location: updatedProfile.location || null,
|
|
188
|
-
website: updatedProfile.website || null,
|
|
189
|
-
profilePicture: getFileUrl(updatedProfile.profilePicture),
|
|
190
|
-
profilePictureThumbnail: getFileUrl(updatedProfile.profilePictureThumbnail),
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
}),
|
|
56
|
+
.mutation(({ ctx, input }) => updateProfile(ctx.user.id, input)),
|
|
194
57
|
getUploadUrl: protectedProcedure
|
|
195
58
|
.input(getUploadUrlSchema)
|
|
196
|
-
.mutation(
|
|
197
|
-
if (!ctx.user) {
|
|
198
|
-
throw new TRPCError({
|
|
199
|
-
code: "UNAUTHORIZED",
|
|
200
|
-
message: "User must be authenticated",
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
try {
|
|
204
|
-
// Generate unique filename
|
|
205
|
-
const fileExtension = input.fileName.split('.').pop();
|
|
206
|
-
const uniqueFilename = `${ctx.user.id}-${Date.now()}.${fileExtension}`;
|
|
207
|
-
const filePath = `users/${ctx.user.id}/profile/${uniqueFilename}`;
|
|
208
|
-
// Generate backend proxy upload URL instead of direct GCS signed URL
|
|
209
|
-
const backendUrl = env.BACKEND_URL || 'http://localhost:3001';
|
|
210
|
-
const uploadUrl = `${backendUrl}/api/upload/${encodeURIComponent(filePath)}`;
|
|
211
|
-
logger.info('Generated upload URL', {
|
|
212
|
-
userId: ctx.user.id,
|
|
213
|
-
filePath,
|
|
214
|
-
fileName: uniqueFilename,
|
|
215
|
-
fileType: input.fileType,
|
|
216
|
-
uploadUrl
|
|
217
|
-
});
|
|
218
|
-
return {
|
|
219
|
-
uploadUrl,
|
|
220
|
-
filePath,
|
|
221
|
-
fileName: uniqueFilename,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
logger.error('Failed to generate upload URL', {
|
|
226
|
-
userId: ctx.user.id,
|
|
227
|
-
error: error instanceof Error ? error.message : 'Unknown error'
|
|
228
|
-
});
|
|
229
|
-
throw new TRPCError({
|
|
230
|
-
code: "INTERNAL_SERVER_ERROR",
|
|
231
|
-
message: "Failed to generate upload URL",
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}),
|
|
59
|
+
.mutation(({ ctx, input }) => getUploadUrl(ctx.user.id, input.fileName, input.fileType)),
|
|
235
60
|
});
|
|
236
61
|
//# sourceMappingURL=user.js.map
|
|
237
|
-
//# debugId=
|
|
62
|
+
//# debugId=7b0b6e3d-022d-5fe3-a54e-a8f4a40964f3
|
package/dist/routers/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sources":["routers/user.ts"],"sourceRoot":"/","sourcesContent":["import { z } from \"zod\";\nimport { createTRPCRouter, protectedProcedure } from \"../trpc.js\";\nimport { TRPCError } from \"@trpc/server\";\nimport { prisma } from \"../lib/prisma.js\";\nimport { createDirectUploadFiles, type DirectUploadFile } from \"../lib/fileUpload.js\";\nimport { getSignedUrl } from \"../lib/googleCloudStorage.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { bucket } from \"../lib/googleCloudStorage.js\";\nimport { env } from \"../lib/config/env.js\";\n\n// Helper function to convert file path to backend proxy URL\nfunction getFileUrl(filePath: string | null): string | null {\n if (!filePath) return null;\n \n // If it's already a full URL (DiceBear or external), return as is\n if (filePath.startsWith('http')) {\n return filePath;\n }\n \n // Convert GCS path to full backend proxy URL\n const backendUrl = env.BACKEND_URL || 'http://localhost:3001';\n return `${backendUrl}/api/files/${encodeURIComponent(filePath)}`;\n}\n\n// For direct file uploads (file already uploaded to GCS)\nconst fileUploadSchema = z.object({\n filePath: z.string().min(1, \"File path is required\"),\n fileName: z.string().min(1, \"File name is required\"),\n fileType: z.string().regex(/^image\\/(jpeg|jpg|png|gif|webp)$/i, \"Only image files (JPEG, PNG, GIF, WebP) are allowed\"),\n fileSize: z.number().max(5 * 1024 * 1024, \"File size must be less than 5MB\"),\n});\n\n// For DiceBear avatar URL\nconst dicebearSchema = z.object({\n url: z.string().url(\"Invalid DiceBear avatar URL\"),\n});\n\nconst profileSchema = z.object({\n displayName: z.string().nullable().optional().transform(val => val === null ? undefined : val),\n bio: z.string().nullable().optional().transform(val => val === null ? undefined : val),\n location: z.string().nullable().optional().transform(val => val === null ? undefined : val),\n website: z.union([\n z.string().url(),\n z.literal(\"\"),\n z.null().transform(() => undefined)\n ]).optional(),\n});\n\nconst updateProfileSchema = z.object({\n profile: profileSchema.optional(),\n // Support both custom file upload and DiceBear avatar\n profilePicture: fileUploadSchema.optional(),\n dicebearAvatar: dicebearSchema.optional(),\n});\n\nconst getUploadUrlSchema = z.object({\n fileName: z.string().min(1, \"File name is required\"),\n fileType: z.string().regex(/^image\\/(jpeg|jpg|png|gif|webp)$/i, \"Only image files are allowed\"),\n});\n\nexport const userRouter = createTRPCRouter({\n getProfile: protectedProcedure\n .query(async ({ ctx }) => {\n if (!ctx.user) {\n throw new TRPCError({\n code: \"UNAUTHORIZED\",\n message: \"User must be authenticated\",\n });\n }\n\n const user = await prisma.user.findUnique({\n where: { id: ctx.user.id },\n select: {\n id: true,\n username: true,\n },\n });\n\n if (!user) {\n throw new TRPCError({\n code: \"NOT_FOUND\",\n message: \"User not found\",\n });\n }\n\n // Get user profile separately\n const userProfile = await prisma.userProfile.findUnique({\n where: { userId: ctx.user.id },\n });\n\n return {\n id: user.id,\n username: user.username,\n profile: userProfile ? {\n displayName: (userProfile as any).displayName || null,\n bio: (userProfile as any).bio || null,\n location: (userProfile as any).location || null,\n website: (userProfile as any).website || null,\n profilePicture: getFileUrl((userProfile as any).profilePicture),\n profilePictureThumbnail: getFileUrl((userProfile as any).profilePictureThumbnail),\n } : {\n displayName: null,\n bio: null,\n location: null,\n website: null,\n profilePicture: null,\n profilePictureThumbnail: null,\n },\n };\n }),\n\n updateProfile: protectedProcedure\n .input(updateProfileSchema)\n .mutation(async ({ ctx, input }) => {\n if (!ctx.user) {\n throw new TRPCError({\n code: \"UNAUTHORIZED\",\n message: \"User must be authenticated\",\n });\n }\n\n // Get current profile to clean up old profile picture\n const currentProfile = await prisma.userProfile.findUnique({\n where: { userId: ctx.user.id },\n });\n\n let profilePictureUrl: string | null = null;\n let profilePictureThumbnail: string | null = null;\n\n // Handle custom profile picture (already uploaded to GCS)\n if (input.profilePicture) {\n try {\n // File is already uploaded to GCS, just use the path\n profilePictureUrl = input.profilePicture.filePath;\n \n // Generate thumbnail for the uploaded file\n // TODO: Implement thumbnail generation for direct uploads\n profilePictureThumbnail = null;\n\n // Clean up old profile picture if it exists\n if ((currentProfile as any)?.profilePicture) {\n // TODO: Implement file deletion logic here\n // await deleteFile((currentProfile as any).profilePicture);\n }\n } catch (error) {\n logger.error('Profile picture processing failed', { \n userId: ctx.user.id, \n error: error instanceof Error ? error.message : 'Unknown error' \n });\n throw new TRPCError({\n code: \"INTERNAL_SERVER_ERROR\",\n message: \"Failed to process profile picture. Please try again.\",\n });\n }\n }\n\n // Handle DiceBear avatar URL\n if (input.dicebearAvatar) {\n profilePictureUrl = input.dicebearAvatar.url;\n // No thumbnail for DiceBear avatars since they're SVG URLs\n profilePictureThumbnail = null;\n }\n\n // Prepare update data\n const updateData: any = {};\n if (input.profile) {\n if (input.profile.displayName !== undefined && input.profile.displayName !== null) {\n updateData.displayName = input.profile.displayName;\n }\n if (input.profile.bio !== undefined && input.profile.bio !== null) {\n updateData.bio = input.profile.bio;\n }\n if (input.profile.location !== undefined && input.profile.location !== null) {\n updateData.location = input.profile.location;\n }\n if (input.profile.website !== undefined && input.profile.website !== null) {\n updateData.website = input.profile.website;\n }\n }\n if (profilePictureUrl !== null) updateData.profilePicture = profilePictureUrl;\n if (profilePictureThumbnail !== null) updateData.profilePictureThumbnail = profilePictureThumbnail;\n\n // Upsert user profile with structured data\n const updatedProfile = await prisma.userProfile.upsert({\n where: { userId: ctx.user.id },\n create: {\n userId: ctx.user.id,\n ...updateData,\n },\n update: {\n ...updateData,\n updatedAt: new Date(),\n },\n });\n\n // Get username for response\n const user = await prisma.user.findUnique({\n where: { id: ctx.user.id },\n select: { username: true },\n });\n\n return {\n id: ctx.user.id,\n username: user?.username || '',\n profile: {\n displayName: (updatedProfile as any).displayName || null,\n bio: (updatedProfile as any).bio || null,\n location: (updatedProfile as any).location || null,\n website: (updatedProfile as any).website || null,\n profilePicture: getFileUrl((updatedProfile as any).profilePicture),\n profilePictureThumbnail: getFileUrl((updatedProfile as any).profilePictureThumbnail),\n },\n };\n }),\n\n getUploadUrl: protectedProcedure\n .input(getUploadUrlSchema)\n .mutation(async ({ ctx, input }) => {\n if (!ctx.user) {\n throw new TRPCError({\n code: \"UNAUTHORIZED\",\n message: \"User must be authenticated\",\n });\n }\n\n try {\n // Generate unique filename\n const fileExtension = input.fileName.split('.').pop();\n const uniqueFilename = `${ctx.user.id}-${Date.now()}.${fileExtension}`;\n const filePath = `users/${ctx.user.id}/profile/${uniqueFilename}`;\n\n // Generate backend proxy upload URL instead of direct GCS signed URL\n const backendUrl = env.BACKEND_URL || 'http://localhost:3001';\n const uploadUrl = `${backendUrl}/api/upload/${encodeURIComponent(filePath)}`;\n\n logger.info('Generated upload URL', {\n userId: ctx.user.id,\n filePath,\n fileName: uniqueFilename,\n fileType: input.fileType,\n uploadUrl\n });\n\n return {\n uploadUrl,\n filePath,\n fileName: uniqueFilename,\n };\n } catch (error) {\n logger.error('Failed to generate upload URL', { \n userId: ctx.user.id, \n error: error instanceof Error ? error.message : 'Unknown error' \n });\n throw new TRPCError({\n code: \"INTERNAL_SERVER_ERROR\",\n message: \"Failed to generate upload URL\",\n });\n }\n }),\n}); "],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAE3C,4DAA4D;AAC5D,SAAS,UAAU,CAAC,QAAuB;IACzC,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,kEAAkE;IAClE,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,6CAA6C;IAC7C,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,IAAI,uBAAuB,CAAC;IAC9D,OAAO,GAAG,UAAU,cAAc,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;AACnE,CAAC;AAED,yDAAyD;AACzD,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mCAAmC,EAAE,qDAAqD,CAAC;IACtH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,G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AAE,CAAC;YAE7E,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE;gBAClC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;gBACnB,QAAQ;gBACR,QAAQ,EAAE,cAAc;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,SAAS;aACV,CAAC,CAAC;YAEH,OAAO;gBACL,SAAS;gBACT,QAAQ;gBACR,QAAQ,EAAE,cAAc;aACzB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE;gBAC5C,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;gBACnB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAChE,CAAC,CAAC;YACH,MAAM,IAAI,SAAS,CAAC;gBAClB,IAAI,EAAE,uBAAuB;gBAC7B,OAAO,EAAE,+BAA+B;aACzC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;CACL,CAAC,CAAC","debug_id":"0dff2490-6903-5dec-aa0c-7d8bd2ac7c23"}
|
|
1
|
+
{"version":3,"file":"user.js","sources":["routers/user.ts"],"sourceRoot":"/","sourcesContent":["import { z } from \"zod\";\nimport { createTRPCRouter, protectedProcedure } from \"../trpc.js\";\nimport {\n getProfile,\n updateProfile,\n getUploadUrl,\n} from \"../services/user.js\";\n\nconst fileUploadSchema = z.object({\n filePath: z.string().min(1, \"File path is required\"),\n fileName: z.string().min(1, \"File name is required\"),\n fileType: z\n .string()\n .regex(\n /^image\\/(jpeg|jpg|png|gif|webp)$/i,\n \"Only image files (JPEG, PNG, GIF, WebP) are allowed\"\n ),\n fileSize: z.number().max(5 * 1024 * 1024, \"File size must be less than 5MB\"),\n});\n\nconst dicebearSchema = z.object({\n url: z.string().url(\"Invalid DiceBear avatar URL\"),\n});\n\nconst profileSchema = z.object({\n displayName: z\n .string()\n .nullable()\n .optional()\n .transform((val) => (val === null ? undefined : val)),\n bio: z\n .string()\n .nullable()\n .optional()\n .transform((val) => (val === null ? undefined : val)),\n location: z\n .string()\n .nullable()\n .optional()\n .transform((val) => (val === null ? undefined : val)),\n website: z\n .union([\n z.string().url(),\n z.literal(\"\"),\n z.null().transform(() => undefined),\n ])\n .optional(),\n});\n\nconst updateProfileSchema = z.object({\n profile: profileSchema.optional(),\n profilePicture: fileUploadSchema.optional(),\n dicebearAvatar: dicebearSchema.optional(),\n});\n\nconst getUploadUrlSchema = z.object({\n fileName: z.string().min(1, \"File name is required\"),\n fileType: z\n .string()\n .regex(\n /^image\\/(jpeg|jpg|png|gif|webp)$/i,\n \"Only image files are allowed\"\n ),\n});\n\nexport const userRouter = createTRPCRouter({\n getProfile: protectedProcedure.query(({ ctx }) =>\n getProfile(ctx.user!.id)\n ),\n\n updateProfile: protectedProcedure\n .input(updateProfileSchema)\n .mutation(({ ctx, input }) =>\n updateProfile(ctx.user!.id, input)\n ),\n\n getUploadUrl: protectedProcedure\n .input(getUploadUrlSchema)\n .mutation(({ ctx, input }) =>\n getUploadUrl(ctx.user!.id, input.fileName, input.fileType)\n ),\n});\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACpD,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,KAAK,CACJ,mCAAmC,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Enums.WorksheetQuestionType;
|
|
36
36
|
id: string;
|
|
37
37
|
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
38
39
|
order: number | null;
|
|
39
40
|
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
40
|
-
updatedAt: Date;
|
|
41
|
-
question: string;
|
|
42
|
-
points: number;
|
|
43
41
|
worksheetId: string;
|
|
42
|
+
question: string;
|
|
44
43
|
answer: string;
|
|
44
|
+
points: number;
|
|
45
45
|
}[];
|
|
46
46
|
} & {
|
|
47
47
|
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
classId: string;
|
|
50
48
|
createdAt: Date;
|
|
51
49
|
updatedAt: Date;
|
|
50
|
+
classId: string;
|
|
51
|
+
name: string;
|
|
52
52
|
};
|
|
53
53
|
meta: object;
|
|
54
54
|
}>;
|
|
@@ -71,10 +71,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
71
71
|
id: string;
|
|
72
72
|
}[];
|
|
73
73
|
id: string;
|
|
74
|
-
name: string;
|
|
75
|
-
classId: string;
|
|
76
74
|
createdAt: Date;
|
|
77
75
|
updatedAt: Date;
|
|
76
|
+
classId: string;
|
|
77
|
+
name: string;
|
|
78
78
|
}[];
|
|
79
79
|
meta: object;
|
|
80
80
|
}>;
|
|
@@ -85,10 +85,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
85
85
|
};
|
|
86
86
|
output: {
|
|
87
87
|
id: string;
|
|
88
|
-
name: string;
|
|
89
|
-
classId: string;
|
|
90
88
|
createdAt: Date;
|
|
91
89
|
updatedAt: Date;
|
|
90
|
+
classId: string;
|
|
91
|
+
name: string;
|
|
92
92
|
};
|
|
93
93
|
meta: object;
|
|
94
94
|
}>;
|
|
@@ -98,32 +98,32 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
98
98
|
};
|
|
99
99
|
output: {
|
|
100
100
|
id: string;
|
|
101
|
-
name: string;
|
|
102
|
-
classId: string;
|
|
103
101
|
createdAt: Date;
|
|
104
102
|
updatedAt: Date;
|
|
103
|
+
classId: string;
|
|
104
|
+
name: string;
|
|
105
105
|
};
|
|
106
106
|
meta: object;
|
|
107
107
|
}>;
|
|
108
108
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
109
109
|
input: {
|
|
110
|
-
name: string;
|
|
111
110
|
classId: string;
|
|
111
|
+
name: string;
|
|
112
112
|
};
|
|
113
113
|
output: {
|
|
114
114
|
id: string;
|
|
115
|
-
name: string;
|
|
116
|
-
classId: string;
|
|
117
115
|
createdAt: Date;
|
|
118
116
|
updatedAt: Date;
|
|
117
|
+
classId: string;
|
|
118
|
+
name: string;
|
|
119
119
|
};
|
|
120
120
|
meta: object;
|
|
121
121
|
}>;
|
|
122
122
|
addQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
123
123
|
input: {
|
|
124
124
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
125
|
-
question: string;
|
|
126
125
|
worksheetId: string;
|
|
126
|
+
question: string;
|
|
127
127
|
answer: string;
|
|
128
128
|
options?: any;
|
|
129
129
|
markScheme?: any;
|
|
@@ -134,13 +134,13 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
134
134
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
135
135
|
id: string;
|
|
136
136
|
createdAt: Date;
|
|
137
|
+
updatedAt: Date;
|
|
137
138
|
order: number | null;
|
|
138
139
|
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
139
|
-
updatedAt: Date;
|
|
140
|
-
question: string;
|
|
141
|
-
points: number;
|
|
142
140
|
worksheetId: string;
|
|
141
|
+
question: string;
|
|
143
142
|
answer: string;
|
|
143
|
+
points: number;
|
|
144
144
|
};
|
|
145
145
|
meta: object;
|
|
146
146
|
}>;
|
|
@@ -158,47 +158,47 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
158
158
|
}>;
|
|
159
159
|
updateQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
160
160
|
input: {
|
|
161
|
-
questionId: string;
|
|
162
161
|
worksheetId: string;
|
|
162
|
+
questionId: string;
|
|
163
163
|
options?: any;
|
|
164
164
|
type?: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION" | undefined;
|
|
165
165
|
markScheme?: any;
|
|
166
166
|
question?: string | undefined;
|
|
167
|
-
points?: number | undefined;
|
|
168
167
|
answer?: string | undefined;
|
|
168
|
+
points?: number | undefined;
|
|
169
169
|
};
|
|
170
170
|
output: {
|
|
171
171
|
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
172
172
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
173
173
|
id: string;
|
|
174
174
|
createdAt: Date;
|
|
175
|
+
updatedAt: Date;
|
|
175
176
|
order: number | null;
|
|
176
177
|
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
177
|
-
updatedAt: Date;
|
|
178
|
-
question: string;
|
|
179
|
-
points: number;
|
|
180
178
|
worksheetId: string;
|
|
179
|
+
question: string;
|
|
181
180
|
answer: string;
|
|
181
|
+
points: number;
|
|
182
182
|
};
|
|
183
183
|
meta: object;
|
|
184
184
|
}>;
|
|
185
185
|
deleteQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
186
186
|
input: {
|
|
187
|
-
questionId: string;
|
|
188
187
|
worksheetId: string;
|
|
188
|
+
questionId: string;
|
|
189
189
|
};
|
|
190
190
|
output: {
|
|
191
191
|
options: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
192
192
|
type: import(".prisma/client").$Enums.WorksheetQuestionType;
|
|
193
193
|
id: string;
|
|
194
194
|
createdAt: Date;
|
|
195
|
+
updatedAt: Date;
|
|
195
196
|
order: number | null;
|
|
196
197
|
markScheme: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
197
|
-
updatedAt: Date;
|
|
198
|
-
question: string;
|
|
199
|
-
points: number;
|
|
200
198
|
worksheetId: string;
|
|
199
|
+
question: string;
|
|
201
200
|
answer: string;
|
|
201
|
+
points: number;
|
|
202
202
|
};
|
|
203
203
|
meta: object;
|
|
204
204
|
}>;
|
|
@@ -215,23 +215,23 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
215
215
|
} & {
|
|
216
216
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
217
217
|
id: string;
|
|
218
|
-
feedback: string | null;
|
|
219
|
-
studentId: string;
|
|
220
218
|
createdAt: Date;
|
|
221
219
|
updatedAt: Date | null;
|
|
222
|
-
|
|
220
|
+
feedback: string | null;
|
|
221
|
+
studentId: string;
|
|
222
|
+
points: number;
|
|
223
223
|
response: string;
|
|
224
224
|
isCorrect: boolean;
|
|
225
225
|
markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
226
|
-
points: number;
|
|
227
226
|
studentWorksheetResponseId: string | null;
|
|
227
|
+
questionId: string;
|
|
228
228
|
})[];
|
|
229
229
|
} & {
|
|
230
230
|
id: string;
|
|
231
|
-
submissionId: string | null;
|
|
232
|
-
studentId: string;
|
|
233
231
|
createdAt: Date;
|
|
234
232
|
updatedAt: Date;
|
|
233
|
+
submissionId: string | null;
|
|
234
|
+
studentId: string;
|
|
235
235
|
submittedAt: Date | null;
|
|
236
236
|
submitted: boolean;
|
|
237
237
|
worksheetId: string;
|
|
@@ -240,35 +240,35 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
240
240
|
}>;
|
|
241
241
|
answerQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
242
242
|
input: {
|
|
243
|
-
questionId: string;
|
|
244
243
|
response: string;
|
|
244
|
+
questionId: string;
|
|
245
245
|
worksheetResponseId: string;
|
|
246
246
|
};
|
|
247
|
-
output:
|
|
247
|
+
output: {
|
|
248
248
|
responses: {
|
|
249
249
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
250
250
|
id: string;
|
|
251
|
-
feedback: string | null;
|
|
252
|
-
studentId: string;
|
|
253
251
|
createdAt: Date;
|
|
254
252
|
updatedAt: Date | null;
|
|
255
|
-
|
|
253
|
+
feedback: string | null;
|
|
254
|
+
studentId: string;
|
|
255
|
+
points: number;
|
|
256
256
|
response: string;
|
|
257
257
|
isCorrect: boolean;
|
|
258
258
|
markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
259
|
-
points: number;
|
|
260
259
|
studentWorksheetResponseId: string | null;
|
|
260
|
+
questionId: string;
|
|
261
261
|
}[];
|
|
262
262
|
} & {
|
|
263
263
|
id: string;
|
|
264
|
-
submissionId: string | null;
|
|
265
|
-
studentId: string;
|
|
266
264
|
createdAt: Date;
|
|
267
265
|
updatedAt: Date;
|
|
266
|
+
submissionId: string | null;
|
|
267
|
+
studentId: string;
|
|
268
268
|
submittedAt: Date | null;
|
|
269
269
|
submitted: boolean;
|
|
270
270
|
worksheetId: string;
|
|
271
|
-
}
|
|
271
|
+
};
|
|
272
272
|
meta: object;
|
|
273
273
|
}>;
|
|
274
274
|
cancelGrading: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -279,16 +279,16 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
279
279
|
output: {
|
|
280
280
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
281
281
|
id: string;
|
|
282
|
-
feedback: string | null;
|
|
283
|
-
studentId: string;
|
|
284
282
|
createdAt: Date;
|
|
285
283
|
updatedAt: Date | null;
|
|
286
|
-
|
|
284
|
+
feedback: string | null;
|
|
285
|
+
studentId: string;
|
|
286
|
+
points: number;
|
|
287
287
|
response: string;
|
|
288
288
|
isCorrect: boolean;
|
|
289
289
|
markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
290
|
-
points: number;
|
|
291
290
|
studentWorksheetResponseId: string | null;
|
|
291
|
+
questionId: string;
|
|
292
292
|
};
|
|
293
293
|
meta: object;
|
|
294
294
|
}>;
|
|
@@ -300,31 +300,44 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
300
300
|
output: {
|
|
301
301
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
302
302
|
id: string;
|
|
303
|
-
feedback: string | null;
|
|
304
|
-
studentId: string;
|
|
305
303
|
createdAt: Date;
|
|
306
304
|
updatedAt: Date | null;
|
|
307
|
-
|
|
305
|
+
feedback: string | null;
|
|
306
|
+
studentId: string;
|
|
307
|
+
points: number;
|
|
308
308
|
response: string;
|
|
309
309
|
isCorrect: boolean;
|
|
310
310
|
markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
311
|
-
points: number;
|
|
312
311
|
studentWorksheetResponseId: string | null;
|
|
312
|
+
questionId: string;
|
|
313
313
|
};
|
|
314
314
|
meta: object;
|
|
315
315
|
}>;
|
|
316
316
|
gradeAnswer: import("@trpc/server").TRPCMutationProcedure<{
|
|
317
317
|
input: {
|
|
318
|
-
questionId: string;
|
|
319
318
|
isCorrect: boolean;
|
|
320
319
|
studentWorksheetResponseId: string;
|
|
320
|
+
questionId: string;
|
|
321
321
|
feedback?: string | undefined;
|
|
322
|
+
points?: number | undefined;
|
|
322
323
|
response?: string | undefined;
|
|
323
324
|
markschemeState?: any;
|
|
324
|
-
points?: number | undefined;
|
|
325
325
|
responseId?: string | undefined;
|
|
326
326
|
};
|
|
327
|
-
output:
|
|
327
|
+
output: {
|
|
328
|
+
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
329
|
+
id: string;
|
|
330
|
+
createdAt: Date;
|
|
331
|
+
updatedAt: Date | null;
|
|
332
|
+
feedback: string | null;
|
|
333
|
+
studentId: string;
|
|
334
|
+
points: number;
|
|
335
|
+
response: string;
|
|
336
|
+
isCorrect: boolean;
|
|
337
|
+
markschemeState: import("@prisma/client/runtime/library.js").JsonValue | null;
|
|
338
|
+
studentWorksheetResponseId: string | null;
|
|
339
|
+
questionId: string;
|
|
340
|
+
};
|
|
328
341
|
meta: object;
|
|
329
342
|
}>;
|
|
330
343
|
addComment: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -335,12 +348,12 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
335
348
|
output: {
|
|
336
349
|
status: import(".prisma/client").$Enums.GenerationStatus | null;
|
|
337
350
|
id: string;
|
|
338
|
-
content: string;
|
|
339
351
|
createdAt: Date;
|
|
352
|
+
content: string;
|
|
340
353
|
modifiedAt: Date | null;
|
|
341
354
|
announcementId: string | null;
|
|
342
|
-
parentCommentId: string | null;
|
|
343
355
|
authorId: string;
|
|
356
|
+
parentCommentId: string | null;
|
|
344
357
|
studentQuestionProgressId: string | null;
|
|
345
358
|
};
|
|
346
359
|
meta: object;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet.d.ts","sourceRoot":"/","sources":["routers/worksheet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"worksheet.d.ts","sourceRoot":"/","sources":["routers/worksheet.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiO1B,CAAC"}
|