21 lines
585 B
TypeScript
21 lines
585 B
TypeScript
import { User } from '../../domain/entities/User';
|
|
import { IUserRepository } from '../../domain/repositories/IUserRepository';
|
|
// No direct import of apps/api DTOs in core module
|
|
|
|
/**
|
|
* Application Use Case: GetCurrentSessionUseCase
|
|
*
|
|
* Retrieves the current user session information.
|
|
*/
|
|
export class GetCurrentSessionUseCase {
|
|
constructor(private userRepo: IUserRepository) {}
|
|
|
|
async execute(userId: string): Promise<User | null> {
|
|
const stored = await this.userRepo.findById(userId);
|
|
if (!stored) {
|
|
return null;
|
|
}
|
|
return User.fromStored(stored);
|
|
}
|
|
}
|