view models

This commit is contained in:
2025-12-18 01:20:23 +01:00
parent 7c449af311
commit cc2553876a
216 changed files with 485 additions and 10179 deletions

View File

@@ -1,11 +1,10 @@
import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
import { presentWallet } from '../../presenters/WalletPresenter';
import type { WalletViewModel } from '../../view-models';
import { WalletViewModel } from '../../view-models';
/**
* Wallet Service
*
* Orchestrates wallet operations by coordinating API calls and presentation logic.
* Orchestrates wallet operations by coordinating API calls and view model creation.
* All dependencies are injected via constructor.
*/
export class WalletService {
@@ -14,14 +13,10 @@ export class WalletService {
) {}
/**
* Get wallet by driver ID with presentation transformation
* Get wallet by driver ID with view model transformation
*/
async getWallet(driverId: string): Promise<WalletViewModel> {
try {
const dto = await this.apiClient.getWallet(driverId);
return presentWallet(dto);
} catch (error) {
throw error;
}
const dto = await this.apiClient.getWallet(driverId);
return new WalletViewModel(dto);
}
}