|
@@ -5,7 +5,6 @@ import { z } from "zod";
|
|
import { selPool } from "#db/db.js";
|
|
import { selPool } from "#db/db.js";
|
|
import { sql } from "slonik";
|
|
import { sql } from "slonik";
|
|
import { DbSchema } from "#db/db-schema.js";
|
|
import { DbSchema } from "#db/db-schema.js";
|
|
-
|
|
|
|
class SessionService {
|
|
class SessionService {
|
|
// getUserFromCookies(cookies: {
|
|
// getUserFromCookies(cookies: {
|
|
// userData: {
|
|
// userData: {
|
|
@@ -45,6 +44,9 @@ class SessionService {
|
|
|
|
|
|
// TODO: Добавить ограничение в БД что только один ивент может быть актуальным
|
|
// TODO: Добавить ограничение в БД что только один ивент может быть актуальным
|
|
async getCurrentEventFromReq(req: Request) {
|
|
async getCurrentEventFromReq(req: Request) {
|
|
|
|
+ if (!req.eventCode) {
|
|
|
|
+ throw ApiError.UnauthorizedError();
|
|
|
|
+ }
|
|
const eventCodeSafe = z.string().safeParse(req.eventCode);
|
|
const eventCodeSafe = z.string().safeParse(req.eventCode);
|
|
|
|
|
|
if (!eventCodeSafe.success) {
|
|
if (!eventCodeSafe.success) {
|