17 lines
553 B
TypeScript
17 lines
553 B
TypeScript
|
|
import { ITransactionManager } from "@common/infrastructure/database";
|
||
|
|
import { LoginData } from "@contexts/auth/domain";
|
||
|
|
import { IAuthService } from "@contexts/auth/domain/services";
|
||
|
|
|
||
|
|
export class LoginUseCase {
|
||
|
|
constructor(
|
||
|
|
private readonly authService: IAuthService,
|
||
|
|
private readonly transactionManager: ITransactionManager
|
||
|
|
) {}
|
||
|
|
|
||
|
|
public async execute(loginData: LoginData) {
|
||
|
|
return await this.transactionManager.complete(async (transaction) => {
|
||
|
|
return await this.authService.loginUser(loginData, transaction);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|