code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped

This commit is contained in:
2026-01-26 12:52:24 +01:00
parent f877f821ef
commit cfc30c79a8
62 changed files with 227 additions and 173 deletions

View File

@@ -2,34 +2,36 @@
* In-Memory Implementation: InMemoryWalletRepository
*/
import type { Transaction, Wallet } from '@core/payments/domain/entities/Wallet';
import type { WalletRepository, TransactionRepository } from '@core/payments/domain/repositories/WalletRepository';
import type { Logger } from '@core/shared/domain/Logger';
import type { LeagueWalletRepository } from '@core/racing/domain/repositories/LeagueWalletRepository';
import type { Wallet } from '@core/payments/domain/entities/Wallet';
import type { LeagueWallet } from '@core/racing/domain/entities/league-wallet/LeagueWallet';
import type { Transaction } from '@core/payments/domain/entities/league-wallet/Transaction';
const wallets: Map<string, any> = new Map();
const transactions: Map<string, any> = new Map();
const wallets: Map<string, Wallet | LeagueWallet> = new Map();
const transactions: Map<string, Transaction> = new Map();
export class InMemoryWalletRepository implements WalletRepository, LeagueWalletRepository {
constructor(private readonly logger: Logger) {}
async findById(id: string): Promise<any | null> {
async findById(id: string): Promise<Wallet | LeagueWallet | null> {
this.logger.debug('[InMemoryWalletRepository] findById', { id });
return wallets.get(id) || null;
}
async findByLeagueId(leagueId: string): Promise<any | null> {
async findByLeagueId(leagueId: string): Promise<LeagueWallet | null> {
this.logger.debug('[InMemoryWalletRepository] findByLeagueId', { leagueId });
return Array.from(wallets.values()).find(w => w.leagueId.toString() === leagueId) || null;
return (Array.from(wallets.values()).find(w => (w as LeagueWallet).leagueId.toString() === leagueId) as LeagueWallet) || null;
}
async create(wallet: any): Promise<any> {
async create(wallet: Wallet | LeagueWallet): Promise<Wallet | LeagueWallet> {
this.logger.debug('[InMemoryWalletRepository] create', { wallet });
wallets.set(wallet.id.toString(), wallet);
return wallet;
}
async update(wallet: any): Promise<any> {
async update(wallet: Wallet | LeagueWallet): Promise<Wallet | LeagueWallet> {
this.logger.debug('[InMemoryWalletRepository] update', { wallet });
wallets.set(wallet.id.toString(), wallet);
return wallet;