Extract searchEvents() to EventIndexService, reduce duplication across controllers

- Add searchEvents() method: Meilisearch search with DB fallback
- Use in HomeController, AdminController, AccountController (removes ~45 duplicated lines)
- Add assets/vendor/ to ESLint ignores
- Update EventIndexServiceTest for new constructor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-20 21:33:37 +01:00
parent 13b6fd95be
commit 2ed17defe0
7 changed files with 34 additions and 91 deletions

View File

@@ -6,6 +6,7 @@ use App\Entity\Event;
use App\Entity\User;
use App\Service\EventIndexService;
use App\Service\MeilisearchService;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase;
class EventIndexServiceTest extends TestCase
@@ -16,7 +17,8 @@ class EventIndexServiceTest extends TestCase
protected function setUp(): void
{
$this->meilisearch = $this->createMock(MeilisearchService::class);
$this->service = new EventIndexService($this->meilisearch);
$em = $this->createMock(EntityManagerInterface::class);
$this->service = new EventIndexService($this->meilisearch, $em);
}
private function createEvent(bool $online = true, bool $secret = false): Event