website refactor
This commit is contained in:
@@ -1,9 +1,26 @@
|
||||
import { Result } from '@/lib/contracts/Result';
|
||||
import { Service } from '@/lib/contracts/services/Service';
|
||||
import { Service, DomainError } from '@/lib/contracts/services/Service';
|
||||
import { LeagueWalletApiDto } from '@/lib/types/tbd/LeagueWalletApiDto';
|
||||
|
||||
export class LeagueWalletService implements Service {
|
||||
async getWalletData(leagueId: string): Promise<Result<LeagueWalletApiDto, never>> {
|
||||
async getWalletForLeague(leagueId: string): Promise<LeagueWalletApiDto> {
|
||||
const result = await this.getWalletData(leagueId);
|
||||
if (result.isErr()) throw new Error(result.getError().message);
|
||||
return result.unwrap();
|
||||
}
|
||||
|
||||
async withdraw(
|
||||
leagueId: string,
|
||||
amount: number,
|
||||
currency: string,
|
||||
seasonId: string,
|
||||
destinationId: string
|
||||
): Promise<{ success: boolean; message?: string }> {
|
||||
// Mock implementation
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
async getWalletData(leagueId: string): Promise<Result<LeagueWalletApiDto, DomainError>> {
|
||||
// Mock data since backend not implemented
|
||||
const mockData: LeagueWalletApiDto = {
|
||||
leagueId,
|
||||
@@ -46,4 +63,4 @@ export class LeagueWalletService implements Service {
|
||||
};
|
||||
return Result.ok(mockData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user