Uecko_ERP/apps/server/src/contexts/auth/application/register/register.use-case.ts

17 lines
571 B
TypeScript
Raw Normal View History

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
});
}
}