refactor page to use services
This commit is contained in:
22
apps/website/lib/services/dashboard/DashboardService.ts
Normal file
22
apps/website/lib/services/dashboard/DashboardService.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { DashboardOverviewViewModel } from '../../view-models/DashboardOverviewViewModel';
|
||||
import { DashboardApiClient } from '../../api/dashboard/DashboardApiClient';
|
||||
|
||||
/**
|
||||
* Dashboard Service
|
||||
*
|
||||
* Orchestrates dashboard operations by coordinating API calls and view model creation.
|
||||
* All dependencies are injected via constructor.
|
||||
*/
|
||||
export class DashboardService {
|
||||
constructor(
|
||||
private readonly apiClient: DashboardApiClient
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get dashboard overview data with view model transformation
|
||||
*/
|
||||
async getDashboardOverview(): Promise<DashboardOverviewViewModel> {
|
||||
const dto = await this.apiClient.getDashboardOverview();
|
||||
return new DashboardOverviewViewModel(dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user