refactor: massive codebase stabilization, strict TS, UI/UX overhaul, and central logging

This commit is contained in:
iqubik
2026-03-28 18:33:13 +03:00
parent 388417cec9
commit 8f8a3bf724
69 changed files with 4272 additions and 1693 deletions
+9
View File
@@ -0,0 +1,9 @@
import { Module, Global } from '@nestjs/common';
import { SessionService } from './session.service';
@Global()
@Module({
providers: [SessionService],
exports: [SessionService],
})
export class SessionModule {}
+48
View File
@@ -0,0 +1,48 @@
import { Injectable, Logger } from '@nestjs/common';
/**
* Сервис для управления сессионными cookie
* Хранит и предоставляет cookie для HTTP-запросов к внешним API
*/
@Injectable()
export class SessionService {
private readonly logger = new Logger(SessionService.name);
private cookie: string | null = null;
/**
* Получить текущую сессионную cookie
*/
getCookie(): string | null {
return this.cookie;
}
/**
* Установить сессионную cookie из заголовков ответа
* @param setCookieHeader Массив заголовков Set-Cookie
*/
setFromHeaders(setCookieHeader: string[] | undefined): void {
if (!setCookieHeader) {
this.logger.warn('Set-Cookie заголовок отсутствует');
return;
}
this.cookie = setCookieHeader.map((c) => c.split(';')[0]).join('; ');
this.logger.debug('Сессионная cookie обновлена');
}
/**
* Очистить сессионную cookie
*/
clear(): void {
this.cookie = null;
this.logger.debug('Сессионная cookie очищена');
}
/**
* Проверить наличие сессионной cookie
*/
hasCookie(): boolean {
return this.cookie !== null && this.cookie.length > 0;
}
}