auth => clean archi

This commit is contained in:
styve Lioumba
2025-11-19 16:25:32 +01:00
parent c8d0f96b31
commit dd77e3d023
47 changed files with 696 additions and 545 deletions

View File

@@ -0,0 +1,10 @@
import { AuthRepository } from '@app/domain/authentification/auth.repository';
import { User } from '@app/domain/users/user.model';
export class GetCurrentUserUseCase {
constructor(private readonly authRepo: AuthRepository) {}
execute(): User | undefined {
return this.authRepo.get();
}
}

View File

@@ -0,0 +1,10 @@
import { AuthRepository } from '@app/domain/authentification/auth.repository';
import { LoginDto } from '@app/domain/authentification/dto/login-dto';
export class LoginUseCase {
constructor(private readonly authRepo: AuthRepository) {}
execute(loginDto: LoginDto) {
return this.authRepo.login(loginDto);
}
}

View File

@@ -0,0 +1,9 @@
import { AuthRepository } from '@app/domain/authentification/auth.repository';
export class LogoutUseCase {
constructor(private readonly authRepo: AuthRepository) {}
execute() {
this.authRepo.logout();
}
}

View File

@@ -0,0 +1,10 @@
import { AuthRepository } from '@app/domain/authentification/auth.repository';
import { RegisterDto } from '@app/domain/authentification/dto/register-dto';
export class RegisterUseCase {
constructor(private readonly authRepo: AuthRepository) {}
execute(registerDto: RegisterDto) {
return this.authRepo.register(registerDto);
}
}

View File

@@ -0,0 +1,9 @@
import { AuthRepository } from '@app/domain/authentification/auth.repository';
export class SendVerificationEmailUsecase {
constructor(private readonly authRepo: AuthRepository) {}
execute(email: string) {
return this.authRepo.sendVerificationEmail(email);
}
}

View File

@@ -0,0 +1,8 @@
import { AuthRepository } from '@app/domain/authentification/auth.repository';
export class VerifyAuthenticatedUsecase {
constructor(private readonly authRepo: AuthRepository) {}
execute(): boolean {
return this.authRepo.isAuthenticated();
}
}

View File

@@ -0,0 +1,8 @@
import { AuthRepository } from '@app/domain/authentification/auth.repository';
export class VerifyEmailUseCase {
constructor(private readonly authRepo: AuthRepository) {}
execute(): boolean {
return this.authRepo.isEmailVerified();
}
}