2025-02-15 21:30:12 +00:00
|
|
|
import { ITransactionManager } from "@common/infrastructure/database";
|
2025-02-16 19:30:20 +00:00
|
|
|
import { RegisterData } from "@contexts/auth/domain";
|
2025-02-15 21:30:12 +00:00
|
|
|
import { IAuthService } from "@contexts/auth/domain/services";
|
|
|
|
|
|
2025-02-16 19:30:20 +00:00
|
|
|
export class RegisterUseCase {
|
2025-02-15 21:30:12 +00:00
|
|
|
constructor(
|
|
|
|
|
private readonly authService: IAuthService,
|
|
|
|
|
private readonly transactionManager: ITransactionManager
|
|
|
|
|
) {}
|
|
|
|
|
|
2025-02-16 19:30:20 +00:00
|
|
|
public async execute(registerData: RegisterData) {
|
2025-02-15 21:30:12 +00:00
|
|
|
return await this.transactionManager.complete(async (transaction) => {
|
2025-02-16 19:30:20 +00:00
|
|
|
return await this.authService.registerUser(registerData, transaction);
|
2025-02-15 21:30:12 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|