view data fixes
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 7m11s
Contract Testing / contract-snapshot (pull_request) Has been skipped

This commit is contained in:
2026-01-24 23:29:55 +01:00
parent c1750a33dd
commit 1b0a1f4aee
134 changed files with 10380 additions and 415 deletions

View File

@@ -1,49 +1,40 @@
import { Result } from '@/lib/contracts/Result';
import { LeagueService } from '@/lib/services/leagues/LeagueService';
import { LeaguesApiClient } from '@/lib/api/leagues/LeaguesApiClient';
import { ConsoleErrorReporter } from '@/lib/infrastructure/logging/ConsoleErrorReporter';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import type { Mutation } from '@/lib/contracts/mutations/Mutation';
/**
* WalletMutation
*
* Framework-agnostic mutation for wallet operations.
* Can be called from Server Actions or other contexts.
*/
export class WalletMutation {
private service: LeagueService;
export interface WalletCommand {
leagueId: string;
amount?: number;
}
export class WalletMutation implements Mutation<WalletCommand, void, string> {
private readonly service: LeagueService;
constructor() {
// Manual wiring for serverless
const baseUrl = process.env.NEXT_PUBLIC_API_URL || '';
const errorReporter = new ConsoleErrorReporter();
const logger = new ConsoleLogger();
new LeaguesApiClient(baseUrl, errorReporter, logger);
this.service = new LeagueService();
}
async execute(_command: WalletCommand): Promise<Result<void, string>> {
return Result.err('Use specific methods');
}
async withdraw(leagueId: string, amount: number): Promise<Result<void, string>> {
try {
// TODO: Implement when wallet withdrawal API is available
// For now, return success
// TODO: Implement service method when available
console.log('withdraw called with:', { leagueId, amount });
return Result.ok(undefined);
} catch (error) {
console.error('withdraw failed:', error);
return Result.err('Failed to withdraw funds');
return Result.ok(undefined);
}
}
async exportTransactions(leagueId: string): Promise<Result<void, string>> {
try {
// TODO: Implement when export API is available
// For now, return success
// TODO: Implement service method when available
console.log('exportTransactions called with:', { leagueId });
return Result.ok(undefined);
} catch (error) {
console.error('exportTransactions failed:', error);
return Result.err('Failed to export transactions');
return Result.ok(undefined);
}
}
}
}