auth => clean archi
This commit is contained in:
10
src/app/usecase/authentification/get-current-user.usecase.ts
Normal file
10
src/app/usecase/authentification/get-current-user.usecase.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
10
src/app/usecase/authentification/login.usecase.ts
Normal file
10
src/app/usecase/authentification/login.usecase.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
9
src/app/usecase/authentification/logout.usecase.ts
Normal file
9
src/app/usecase/authentification/logout.usecase.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
10
src/app/usecase/authentification/register.usecase.ts
Normal file
10
src/app/usecase/authentification/register.usecase.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
8
src/app/usecase/authentification/verify-email.usecase.ts
Normal file
8
src/app/usecase/authentification/verify-email.usecase.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user