2026-02-23 12:58:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Service\Import\Profile;
|
|
|
|
|
|
2026-03-05 08:26:51 +01:00
|
|
|
use MintyPHP\Repository\Access\RoleRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
2026-02-23 12:58:19 +01:00
|
|
|
use MintyPHP\Service\User\UserAccountService;
|
|
|
|
|
|
|
|
|
|
class UserImportGateway
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
2026-03-05 08:26:51 +01:00
|
|
|
private readonly UserReadRepositoryInterface $userReadRepository,
|
2026-03-04 15:56:58 +01:00
|
|
|
private readonly UserAccountService $userAccountService,
|
2026-03-05 11:17:42 +01:00
|
|
|
private readonly TenantRepositoryInterface $tenantRepository,
|
|
|
|
|
private readonly RoleRepositoryInterface $roleRepository,
|
|
|
|
|
private readonly DepartmentRepositoryInterface $departmentRepository,
|
2026-02-23 12:58:19 +01:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findUserByEmail(string $email): ?array
|
|
|
|
|
{
|
|
|
|
|
return $this->userReadRepository->findByEmail($email);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findTenantByUuid(string $uuid): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->tenantRepository->findByUuid($uuid);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findTenantById(int $id): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->tenantRepository->find($id);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findRoleByUuid(string $uuid): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->roleRepository->findByUuid($uuid);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findRoleById(int $id): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->roleRepository->find($id);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findDepartmentByUuid(string $uuid): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->departmentRepository->findByUuid($uuid);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findDepartmentById(int $id): ?array
|
|
|
|
|
{
|
2026-03-05 11:17:42 +01:00
|
|
|
return $this->departmentRepository->find($id);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param array<string, mixed> $input
|
|
|
|
|
* @return array<string, mixed>
|
|
|
|
|
*/
|
|
|
|
|
public function createUserFromAdmin(array $input, int $currentUserId): array
|
|
|
|
|
{
|
|
|
|
|
return $this->userAccountService->createFromAdmin($input, $currentUserId);
|
|
|
|
|
}
|
|
|
|
|
}
|