105 lines
4.2 KiB
Markdown
105 lines
4.2 KiB
Markdown
---
|
||
phase: 06-integrations-refactoring
|
||
plan: 01
|
||
subsystem: domain
|
||
tags: [apilo, integrations, refactoring, repository]
|
||
|
||
requires: []
|
||
provides:
|
||
- "ApiloRepository — klasa z 8 pub metodami Apilo (OAuth, keepalive, fetchList, products)"
|
||
- "ApiloRepositoryTest — 9 testów jednostkowych"
|
||
affects: [06-02-consumers-migration]
|
||
|
||
tech-stack:
|
||
added: []
|
||
patterns:
|
||
- "ApiloRepository: własna stała SETTINGS_TABLE, prywatne getApiloSettings/saveApiloSetting zamiast delegacji do IntegrationsRepository"
|
||
|
||
key-files:
|
||
created:
|
||
- autoload/Domain/Integrations/ApiloRepository.php
|
||
- tests/Unit/Domain/Integrations/ApiloRepositoryTest.php
|
||
modified: []
|
||
|
||
key-decisions:
|
||
- "ApiloRepository nie dziedziczy z IntegrationsRepository — własny $db, własna const SETTINGS_TABLE"
|
||
- "Non-breaking: IntegrationsRepository zachowany bez zmian do planu 06-02"
|
||
- "saveApiloSetting/getApiloSettings jako prywatne — nie duplikują interfejsu publicznego"
|
||
|
||
patterns-established:
|
||
- "Ekstrakcja domenowej podklasy: nowa klasa z własnym $db, prywatnym dostępem do settings swojej tabeli"
|
||
|
||
duration: ~15min
|
||
started: 2026-03-12T00:00:00Z
|
||
completed: 2026-03-12T00:00:00Z
|
||
---
|
||
|
||
# Phase 6 Plan 01: IntegrationsRepository split — ApiloRepository Summary
|
||
|
||
**Wyekstrahowano 8 metod Apilo (~330 linii) z IntegrationsRepository do nowego ApiloRepository — non-breaking, 826/826 testów green.**
|
||
|
||
## Performance
|
||
|
||
| Metric | Value |
|
||
|--------|-------|
|
||
| Duration | ~15 min |
|
||
| Completed | 2026-03-12 |
|
||
| Tasks | 2 / 2 |
|
||
| Files created | 2 |
|
||
| Files modified | 0 |
|
||
|
||
## Acceptance Criteria Results
|
||
|
||
| Criterion | Status | Notes |
|
||
|-----------|--------|-------|
|
||
| AC-1: ApiloRepository zawiera wszystkie metody Apilo | Pass | 8 pub metod + 6 priv helperów |
|
||
| AC-2: Własny DI przez konstruktor ($db) | Pass | brak zależności od IntegrationsRepository |
|
||
| AC-3: IntegrationsRepository niezmieniony (backward compatible) | Pass | plik nie był modyfikowany |
|
||
| AC-4: Testy ApiloRepository przechodzą | Pass | 9/9 testów, 826/826 full suite |
|
||
|
||
## Accomplishments
|
||
|
||
- `ApiloRepository.php` — 330 linii: OAuth (authorize, getAccessToken, keepalive, refresh), integracja status, fetchList/fetchListResult, productSearch, createProduct
|
||
- `ApiloRepositoryTest.php` — 9 testów: getAccessToken, shouldRefreshAccessToken (×2), fetchList invalid type, fetchListResult config missing, integrationStatus missing config, normalizeApiloMapList (×2), allPublicMethodsExist
|
||
- Full suite wzrosła z 817 do 826 testów (zero regresji)
|
||
|
||
## Files Created/Modified
|
||
|
||
| File | Change | Purpose |
|
||
|------|--------|---------|
|
||
| `autoload/Domain/Integrations/ApiloRepository.php` | Created | Klasa Apilo: OAuth, keepalive, fetchList, produkty |
|
||
| `tests/Unit/Domain/Integrations/ApiloRepositoryTest.php` | Created | Testy jednostkowe ApiloRepository |
|
||
|
||
## Decisions Made
|
||
|
||
| Decision | Rationale | Impact |
|
||
|----------|-----------|--------|
|
||
| Prywatne `getApiloSettings()` / `saveApiloSetting()` zamiast dziedziczenia | Unika coupling z IntegrationsRepository, czysta encapsulacja | 06-02 nie potrzebuje IntegrationsRepository w ApiloRepository |
|
||
| Zachowanie `APILO_ENDPOINTS` i `APILO_SETTINGS_KEYS` jako class constants | Były private const w IntegrationsRepository — logicznie należą do ApiloRepository | Stałe są prywatne, nie wymuszają zmian w konsumentach |
|
||
| Non-breaking w 06-01 | Migracja konsumentów w 06-02 — mniejsze ryzyko, łatwiejszy review | IntegrationsRepository nadal działa dla wszystkich konsumentów |
|
||
|
||
## Deviations from Plan
|
||
|
||
Brak — plan wykonany dokładnie jak napisano.
|
||
|
||
## Issues Encountered
|
||
|
||
Brak.
|
||
|
||
## Next Phase Readiness
|
||
|
||
**Ready:**
|
||
- `ApiloRepository` gotowy do użycia przez konsumentów
|
||
- Interfejs publiczny identyczny z metodami `apilo*` w IntegrationsRepository
|
||
- Testy stanowią baseline dla weryfikacji po migracji konsumentów
|
||
|
||
**Concerns:**
|
||
- `IntegrationsController` używa zarówno metod Apilo jak i Settings/ShopPRO — po 06-02 będzie potrzebować obu repozytoriów w konstruktorze
|
||
- `OrderAdminService` tworzy `new IntegrationsRepository($db)` lokalnie w 5 miejscach — po 06-02 trzeba zmienić na `new ApiloRepository($db)`
|
||
|
||
**Blockers:** Brak
|
||
|
||
---
|
||
*Phase: 06-integrations-refactoring, Plan: 01*
|
||
*Completed: 2026-03-12*
|