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,28 +1,22 @@
import { AuthApiClient } from '../../api/auth/AuthApiClient';
import { SessionPresenter } from '../../presenters/SessionPresenter';
import type { SessionViewModel } from '../../view-models';
import { SessionViewModel } from '../../view-models';
/**
* Session Service
*
* Orchestrates session operations by coordinating API calls and presentation logic.
* Orchestrates session operations by coordinating API calls and view model creation.
* All dependencies are injected via constructor.
*/
export class SessionService {
constructor(
private readonly apiClient: AuthApiClient,
private readonly presenter: SessionPresenter
private readonly apiClient: AuthApiClient
) {}
/**
* Get current user session with presentation transformation
* Get current user session with view model transformation
*/
async getSession(): Promise<SessionViewModel | null> {
try {
const dto = await this.apiClient.getSession();
return this.presenter.presentSession(dto);
} catch (error) {
throw error;
}
const dto = await this.apiClient.getSession();
return dto ? new SessionViewModel(dto) : null;
}
}