Skip to content

Commit 84a3384

Browse files
committed
feat(facade): creates singup in facade to set create user
1 parent 7bb6727 commit 84a3384

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/context/auth/application/facades/auth.facade.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AuthUser } from '../../domain/user/user.entity';
44
import { AuthStatePort } from '../../domain/port/auth-state.port';
55
import { LogoutUseCase } from '../logout.use-case';
66
import { InitializeAuthUseCase } from '../initialize-auth.use-case';
7+
import { CreateUserUseCase } from '../create-user.use-case';
78

89
@Injectable()
910
export class AuthFacade {
@@ -16,6 +17,7 @@ export class AuthFacade {
1617
private readonly logoutUseCase: LogoutUseCase,
1718
private readonly authStatePort: AuthStatePort,
1819
private readonly initializeAuthUseCase: InitializeAuthUseCase,
20+
private readonly createUserUseCase: CreateUserUseCase,
1921
) {}
2022

2123
async login(email: string, password: string): Promise<AuthUser> {
@@ -35,6 +37,15 @@ export class AuthFacade {
3537
this.authStatePort.clearUser();
3638
}
3739

40+
async singUp(email: string, password: string): Promise<void> {
41+
const result = await this.createUserUseCase.execute(email, password);
42+
43+
if (result) {
44+
const user = result;
45+
this.authStatePort.setUser(user);
46+
}
47+
}
48+
3849
async initialize(): Promise<void> {
3950
const result = await this.initializeAuthUseCase.execute();
4051

0 commit comments

Comments
 (0)