fel kesz game backend

This commit is contained in:
2025-09-15 19:00:35 +02:00
parent 7963f28021
commit 3af8de2797
267 changed files with 15655 additions and 347 deletions
@@ -5,6 +5,7 @@ import { IChatArchiveRepository } from '../../Domain/IRepository/IChatArchiveRep
import { IDeckRepository } from '../../Domain/IRepository/IDeckRepository';
import { IOrganizationRepository } from '../../Domain/IRepository/IOrganizationRepository';
import { IContactRepository } from '../../Domain/IRepository/IContactRepository';
import { IGameRepository } from '../../Domain/IRepository/IGameRepository';
// Repository Implementations
import { UserRepository } from '../../Infrastructure/Repository/UserRepository';
@@ -13,10 +14,12 @@ import { ChatArchiveRepository } from '../../Infrastructure/Repository/ChatArchi
import { DeckRepository } from '../../Infrastructure/Repository/DeckRepository';
import { OrganizationRepository } from '../../Infrastructure/Repository/OrganizationRepository';
import { ContactRepository } from '../../Infrastructure/Repository/ContactRepository';
import { GameRepository } from '../../Infrastructure/Repository/GameRepository';
// Command Handlers
import { CreateUserCommandHandler } from '../User/commands/CreateUserCommandHandler';
import { LoginCommandHandler } from '../User/commands/LoginCommandHandler';
import { LogoutCommandHandler } from '../User/commands/LogoutCommandHandler';
import { UpdateUserCommandHandler } from '../User/commands/UpdateUserCommandHandler';
import { DeactivateUserCommandHandler } from '../User/commands/DeactivateUserCommandHandler';
import { DeleteUserCommandHandler } from '../User/commands/DeleteUserCommandHandler';
@@ -55,6 +58,10 @@ import { GetContactsByPageQueryHandler } from '../Contact/queries/GetContactsByP
import { JWTService } from './JWTService';
import { ContactEmailService } from './ContactEmailService';
import { DeckImportExportService } from './DeckImportExportService';
import { RedisService } from './RedisService';
import { GameService } from '../Game/GameService';
import { BoardGenerationService } from '../Game/BoardGenerationService';
import { GenerateBoardCommandHandler } from '../Game/commands/GenerateBoardCommandHandler';
/**
* Central Dependency Injection Container
@@ -70,15 +77,19 @@ export class DIContainer {
private _deckRepository: IDeckRepository | null = null;
private _organizationRepository: IOrganizationRepository | null = null;
private _contactRepository: IContactRepository | null = null;
private _gameRepository: IGameRepository | null = null;
// Services
private _jwtService: JWTService | null = null;
private _contactEmailService: ContactEmailService | null = null;
private _deckImportExportService: DeckImportExportService | null = null;
private _gameService: GameService | null = null;
private _boardGenerationService: BoardGenerationService | null = null;
// Command Handlers
private _createUserCommandHandler: CreateUserCommandHandler | null = null;
private _loginCommandHandler: LoginCommandHandler | null = null;
private _logoutCommandHandler: LogoutCommandHandler | null = null;
private _updateUserCommandHandler: UpdateUserCommandHandler | null = null;
private _deactivateUserCommandHandler: DeactivateUserCommandHandler | null = null;
private _deleteUserCommandHandler: DeleteUserCommandHandler | null = null;
@@ -99,6 +110,7 @@ export class DIContainer {
private _createContactCommandHandler: CreateContactCommandHandler | null = null;
private _updateContactCommandHandler: UpdateContactCommandHandler | null = null;
private _deleteContactCommandHandler: DeleteContactCommandHandler | null = null;
private _generateBoardCommandHandler: GenerateBoardCommandHandler | null = null;
// Query Handlers
private _getUserByIdQueryHandler: GetUserByIdQueryHandler | null = null;
@@ -167,6 +179,13 @@ export class DIContainer {
return this._contactRepository;
}
public get gameRepository(): IGameRepository {
if (!this._gameRepository) {
this._gameRepository = new GameRepository();
}
return this._gameRepository;
}
// Services getters
public get jwtService(): JWTService {
if (!this._jwtService) {
@@ -189,6 +208,20 @@ export class DIContainer {
return this._deckImportExportService;
}
public get gameService(): GameService {
if (!this._gameService) {
this._gameService = new GameService();
}
return this._gameService;
}
public get boardGenerationService(): BoardGenerationService {
if (!this._boardGenerationService) {
this._boardGenerationService = new BoardGenerationService();
}
return this._boardGenerationService;
}
// Command Handler getters
public get createUserCommandHandler(): CreateUserCommandHandler {
if (!this._createUserCommandHandler) {
@@ -204,6 +237,13 @@ export class DIContainer {
return this._loginCommandHandler;
}
public get logoutCommandHandler(): LogoutCommandHandler {
if (!this._logoutCommandHandler) {
this._logoutCommandHandler = new LogoutCommandHandler(this.userRepository);
}
return this._logoutCommandHandler;
}
public get updateUserCommandHandler(): UpdateUserCommandHandler {
if (!this._updateUserCommandHandler) {
this._updateUserCommandHandler = new UpdateUserCommandHandler(this.userRepository);
@@ -348,6 +388,13 @@ export class DIContainer {
return this._deleteContactCommandHandler;
}
public get generateBoardCommandHandler(): GenerateBoardCommandHandler {
if (!this._generateBoardCommandHandler) {
this._generateBoardCommandHandler = new GenerateBoardCommandHandler(this.boardGenerationService, RedisService.getInstance());
}
return this._generateBoardCommandHandler;
}
// Query Handler getters
public get getUserByIdQueryHandler(): GetUserByIdQueryHandler {
if (!this._getUserByIdQueryHandler) {