Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-02-06 01:45:58 +01:00
parent 8e5d0c6854
commit f1c7019cc5
21 changed files with 607 additions and 616 deletions

View File

@@ -185,7 +185,7 @@ $product = \shop\Product::getFromCache($product_id, $lang_id, $permutation_hash)
autoload/
├── Domain/ # Nowa warstwa biznesowa (namespace \Domain\)
│ ├── Product/
│ │ └── ProductRepository.php # getQuantity, getPrice, getName, find, updateQuantity
│ │ └── ProductRepository.php # getQuantity, getPrice, getName, find, updateQuantity, archive, unarchive
│ ├── Banner/
│ │ └── BannerRepository.php # find, delete, save
│ ├── Settings/
@@ -194,8 +194,9 @@ autoload/
│ └── CacheRepository.php # clearCache (dirs + Redis)
├── admin/
│ ├── Controllers/ # Nowe kontrolery (namespace \admin\Controllers\)
│ │ ├── BannerController.php # DI, instancyjny
│ │ ── SettingsController.php # DI, instancyjny (clearCache, save, view)
│ │ ├── BannerController.php # DI, instancyjny
│ │ ── SettingsController.php # DI, instancyjny (clearCache, save, view)
│ │ └── ProductArchiveController.php # DI, instancyjny (list, unarchive)
│ ├── class.Site.php # Router: nowy kontroler → fallback stary
│ ├── controls/ # Stare kontrolery (niezależny fallback)
│ ├── factory/ # Stare helpery (niezależny fallback)
@@ -240,13 +241,25 @@ tests/
│ │ ├── Settings/SettingsRepositoryTest.php # 3 testy
│ │ └── Cache/CacheRepositoryTest.php # 4 testy
│ └── admin/
│ └── Controllers/SettingsControllerTest.php # 7 testów
│ └── Controllers/
│ ├── SettingsControllerTest.php # 7 testów
│ └── ProductArchiveControllerTest.php # 6 testów
└── Integration/
```
**Łącznie: 29 testów, 60 asercji**
**Łącznie: 39 testów, 73 asercji**
## Ostatnie modyfikacje
### 2026-02-06: Migracja ProductArchive (ver. 0.241)
- **NOWE:** `admin\Controllers\ProductArchiveController` - kontroler archiwum produktów z DI
- **NOWE:** `ProductRepository::archive()`, `unarchive()` - operacje archiwizacji w repozytorium
- **RENAME:** `admin/templates/archive/``admin/templates/product_archive/`
- **FIX:** SQL w `ajax_products_list_archive()` - puste wyszukiwanie generowało `name|ean|sku LIKE '%%'` (NULL bitwise OR filtrował wyniki)
- **FIX:** Brakujący `archive = 1` w branchu bez wyszukiwania
- **CLEANUP:** Usunięto zbędny JS z szablonu archiwum (apilo, baselinker, duplikowanie, edycja cen)
- Stary kontroler `admin\controls\Archive` zachowany jako fallback
- Testy: 39 testów, 73 asercji (+10 nowych)
### 2026-02-05: Migracja Settings + Cache (ver. 0.240)
- **NOWE:** `Domain\Settings\SettingsRepository` - repozytorium ustawień (fasada → factory)
- **NOWE:** `Domain\Cache\CacheRepository` - repozytorium cache (dirs + Redis)