Commit workspace changes

This commit is contained in:
2026-04-05 19:42:33 +02:00
parent 148a3bbe43
commit 08ad757bcb
312 changed files with 35149 additions and 399 deletions

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Api\Search;
use App\Http\Controllers\Controller;
use App\Services\GroupDiscoveryService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
final class GroupSearchController extends Controller
{
public function __construct(private readonly GroupDiscoveryService $groups) {}
public function __invoke(Request $request): JsonResponse
{
$q = trim((string) $request->query('q', ''));
if (mb_strlen($q) < 2) {
return response()->json(['data' => []]);
}
$perPage = min(max((int) $request->query('per_page', 6), 1), 12);
$items = array_map(function (array $group): array {
$group['group_type'] = $group['type'] ?? null;
$group['type'] = 'group';
return $group;
}, $this->groups->searchCards($q, $request->user(), $perPage));
return response()->json([
'data' => $items,
]);
}
}