feat: UI/UX, add reset cache to admin

This commit is contained in:
2025-11-16 20:34:03 +03:00
parent 6ac6a42e21
commit 09f1e514a9
21 changed files with 227 additions and 886 deletions

View File

@@ -6,6 +6,7 @@ use Bastion\Exceptions\BotTokenConfiguratorException;
use Bastion\Services\BotTokenConfigurator;
use Bastion\Services\SettingsService;
use Exception;
use Openguru\OpenCartFramework\Cache\CacheInterface;
use Openguru\OpenCartFramework\Config\Settings;
use Openguru\OpenCartFramework\Http\JsonResponse;
use Openguru\OpenCartFramework\Http\Request;
@@ -17,15 +18,18 @@ class SettingsHandler
private BotTokenConfigurator $botTokenConfigurator;
private Settings $settings;
private SettingsService $settingsUpdateService;
private CacheInterface $cache;
public function __construct(
BotTokenConfigurator $botTokenConfigurator,
Settings $settings,
SettingsService $settingsUpdateService
SettingsService $settingsUpdateService,
CacheInterface $cache
) {
$this->botTokenConfigurator = $botTokenConfigurator;
$this->settings = $settings;
$this->settingsUpdateService = $settingsUpdateService;
$this->cache = $cache;
}
public function configureBotToken(Request $request): JsonResponse
@@ -71,4 +75,11 @@ class SettingsHandler
private function validate(array $input): void
{
}
public function resetCache(): JsonResponse
{
$this->cache->prune();
return new JsonResponse([], Response::HTTP_ACCEPTED);
}
}

View File

@@ -21,4 +21,5 @@ return [
'getAutocompleteCategories' => [AutocompleteHandler::class, 'getCategories'],
'getAutocompleteCategoriesFlat' => [AutocompleteHandler::class, 'getCategoriesFlat'],
'resetCache' => [SettingsHandler::class, 'resetCache'],
];

View File

@@ -11,4 +11,6 @@ interface CacheInterface
public function delete(string $key): void;
public function clear(): void;
public function prune(): void;
}

View File

@@ -41,4 +41,9 @@ class SymfonyMySqlCache implements CacheInterface
{
$this->cache->clear();
}
public function prune(): void
{
$this->cache->prune();
}
}