major update
This commit is contained in:
@@ -7,12 +7,14 @@ use MintyPHP\Repository\Org\DepartmentRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Service\User\UserAccountService;
|
||||
use MintyPHP\Service\User\UserRepositoryFactory;
|
||||
|
||||
class UserImportGateway
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserAccountService $userAccountService
|
||||
private readonly UserAccountService $userAccountService,
|
||||
private readonly UserRepositoryFactory $userRepositoryFactory
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -23,32 +25,32 @@ class UserImportGateway
|
||||
|
||||
public function findTenantByUuid(string $uuid): ?array
|
||||
{
|
||||
return (new TenantRepository())->findByUuid($uuid);
|
||||
return $this->tenantRepository()->findByUuid($uuid);
|
||||
}
|
||||
|
||||
public function findTenantById(int $id): ?array
|
||||
{
|
||||
return (new TenantRepository())->find($id);
|
||||
return $this->tenantRepository()->find($id);
|
||||
}
|
||||
|
||||
public function findRoleByUuid(string $uuid): ?array
|
||||
{
|
||||
return (new RoleRepository())->findByUuid($uuid);
|
||||
return $this->roleRepository()->findByUuid($uuid);
|
||||
}
|
||||
|
||||
public function findRoleById(int $id): ?array
|
||||
{
|
||||
return (new RoleRepository())->find($id);
|
||||
return $this->roleRepository()->find($id);
|
||||
}
|
||||
|
||||
public function findDepartmentByUuid(string $uuid): ?array
|
||||
{
|
||||
return (new DepartmentRepository())->findByUuid($uuid);
|
||||
return $this->departmentRepository()->findByUuid($uuid);
|
||||
}
|
||||
|
||||
public function findDepartmentById(int $id): ?array
|
||||
{
|
||||
return (new DepartmentRepository())->find($id);
|
||||
return $this->departmentRepository()->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,4 +61,19 @@ class UserImportGateway
|
||||
{
|
||||
return $this->userAccountService->createFromAdmin($input, $currentUserId);
|
||||
}
|
||||
|
||||
private function tenantRepository(): TenantRepository
|
||||
{
|
||||
return $this->userRepositoryFactory->createTenantRepository();
|
||||
}
|
||||
|
||||
private function roleRepository(): RoleRepository
|
||||
{
|
||||
return $this->userRepositoryFactory->createRoleRepository();
|
||||
}
|
||||
|
||||
private function departmentRepository(): DepartmentRepository
|
||||
{
|
||||
return $this->userRepositoryFactory->createDepartmentRepository();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user