instances added god may help
This commit is contained in:
62
lib/Service/Import/Profile/UserImportGateway.php
Normal file
62
lib/Service/Import/Profile/UserImportGateway.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Service\Import\Profile;
|
||||
|
||||
use MintyPHP\Repository\Access\RoleRepository;
|
||||
use MintyPHP\Repository\Org\DepartmentRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Service\User\UserAccountService;
|
||||
|
||||
class UserImportGateway
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserAccountService $userAccountService
|
||||
) {
|
||||
}
|
||||
|
||||
public function findUserByEmail(string $email): ?array
|
||||
{
|
||||
return $this->userReadRepository->findByEmail($email);
|
||||
}
|
||||
|
||||
public function findTenantByUuid(string $uuid): ?array
|
||||
{
|
||||
return (new TenantRepository())->findByUuid($uuid);
|
||||
}
|
||||
|
||||
public function findTenantById(int $id): ?array
|
||||
{
|
||||
return (new TenantRepository())->find($id);
|
||||
}
|
||||
|
||||
public function findRoleByUuid(string $uuid): ?array
|
||||
{
|
||||
return (new RoleRepository())->findByUuid($uuid);
|
||||
}
|
||||
|
||||
public function findRoleById(int $id): ?array
|
||||
{
|
||||
return (new RoleRepository())->find($id);
|
||||
}
|
||||
|
||||
public function findDepartmentByUuid(string $uuid): ?array
|
||||
{
|
||||
return (new DepartmentRepository())->findByUuid($uuid);
|
||||
}
|
||||
|
||||
public function findDepartmentById(int $id): ?array
|
||||
{
|
||||
return (new DepartmentRepository())->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $input
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function createUserFromAdmin(array $input, int $currentUserId): array
|
||||
{
|
||||
return $this->userAccountService->createFromAdmin($input, $currentUserId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user