diff --git a/server/.gitignore b/server/.gitignore index 87e5610..6972de0 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -14,6 +14,7 @@ # production /build +/dist # misc .DS_Store diff --git a/server/src/controllers/session.ts b/server/src/controllers/session.ts index 40cd612..a858d28 100644 --- a/server/src/controllers/session.ts +++ b/server/src/controllers/session.ts @@ -208,36 +208,17 @@ export const sessionController = new Elysia({ prefix: "/sessions" }) }), } ) - // GET /sessions/:id - получить информацию о конкретной сессии (optional auth) - .get("/:id", async ({ params, currentUser, status }) => { + // GET /sessions/:id - получить информацию о конкретной сессии (доступен всем) + .get("/:id", async ({ params, status }) => { const { id } = params; - // Для авторизованных пользователей - проверяем ownership - if (currentUser) { - const session = await serverSessionService.findByIdForUser( - id, - currentUser.id - ); - - if (!session) { - return status(404, "Session not found"); - } - - return { session }; - } - - // Для неавторизованных - просто находим сессию по ID + // Получаем сессию по ID const session = await serverSessionService.findById(id); if (!session) { return status(404, "Session not found"); } - // Проверяем, что это сессия без userId (неавторизованная) - if (session.userId) { - return status(403, "This session belongs to an authenticated user"); - } - return { session }; }) // Все остальные роуты требуют авторизации