optimize retrieval

This commit is contained in:
team 1
2026-04-23 15:47:53 +02:00
parent 8a31e99669
commit 87417febf4
13 changed files with 2093 additions and 287 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Controller;
use App\Commerce\CommerceReferenceStore;
use App\Context\ContextService;
use App\Http\ClientIdResolver;
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -27,9 +28,11 @@ use Symfony\Component\Routing\Annotation\Route;
final readonly class HistoryController
{
public function __construct(
private ContextService $contextService,
private ContextService $contextService,
private ClientIdResolver $clientIdResolver,
) {}
private CommerceReferenceStore $commerceReferenceStore,
) {
}
/**
* Returns the full conversation history for the current client
@@ -101,10 +104,11 @@ final readonly class HistoryController
$clientId = $this->clientIdResolver->resolve($request, $response);
$this->contextService->deleteHistory($clientId);
$this->commerceReferenceStore->clear($clientId);
return $this->jsonWithCookies(
[
'status' => 'ok',
'status' => 'ok',
'message' => 'History deleted',
],
$response
@@ -113,6 +117,8 @@ final readonly class HistoryController
/**
* Helper to return JSON responses while forwarding cookies.
*
* @param array<string, mixed>|array<int, array<string, string>> $data
*/
private function jsonWithCookies(array $data, Response $cookieResponse): JsonResponse
{
@@ -124,4 +130,4 @@ final readonly class HistoryController
return $json;
}
}
}