30 lines
941 B
TypeScript
30 lines
941 B
TypeScript
import { AnalyticsApiClient } from '../../api/analytics/AnalyticsApiClient';
|
|
import { AnalyticsDashboardViewModel, AnalyticsMetricsViewModel } from '../../view-models';
|
|
|
|
/**
|
|
* 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: AnalyticsApiClient
|
|
) {}
|
|
|
|
/**
|
|
* Get dashboard data with view model transformation
|
|
*/
|
|
async getDashboardData(): Promise<AnalyticsDashboardViewModel> {
|
|
const dto = await this.apiClient.getDashboardData();
|
|
return new AnalyticsDashboardViewModel(dto);
|
|
}
|
|
|
|
/**
|
|
* Get analytics metrics with view model transformation
|
|
*/
|
|
async getAnalyticsMetrics(): Promise<AnalyticsMetricsViewModel> {
|
|
const dto = await this.apiClient.getAnalyticsMetrics();
|
|
return new AnalyticsMetricsViewModel(dto);
|
|
}
|
|
} |