# đŸ—ïž Logic Spec: Service Finder 3-Level Platform Architecture **VerziĂł:** 1.0 **DĂĄtum:** 2026-07-09 **Állapot:** Tervezet (Architect Review) **HatĂĄskör:** Teljes platform — Admin (Mission Control), User (Provider Hub), Robot/AI (Intelligence Layer) --- ## 1. 🎯 Modul CĂ©lja Ă©s Masterbook 2.0 IlleszkedĂ©s ### CĂ©l A Service Finder platform hĂĄrom architekturĂĄlis szintre bomlik, amelyek egyĂŒtt alkotjĂĄk a teljes ökoszisztĂ©mĂĄt: | Szint | ElnevezĂ©s | ElsƑdleges CĂ©l | |-------|-----------|----------------| | **Szint 1** | đŸ›ïž **Admin — Mission Control** | FlottavezetƑk, moderĂĄtorok, superadminok irĂĄnyĂ­tĂłközpontja | | **Szint 2** | đŸ‘€ **User — Provider Hub** | SzolgĂĄltatĂłk Ă©s flottatulajdonosok önkiszolgĂĄlĂł felĂŒlete | | **Szint 3** | đŸ€– **Robot/AI — Intelligence Layer** | Automatikus adatkinyerĂ©s, intelligens rangsorolĂĄs, szemantikus keresĂ©s | ### Masterbook 2.0 IlleszkedĂ©s - **Dual Entity (Person/User):** Minden jogi entitĂĄs kĂ©t szinten kezelve — hĂșs-vĂ©r szemĂ©ly vs. technikai fiĂłk - **Triple Wallet:** VĂĄsĂĄrolt, keresett Ă©s szolgĂĄltatĂĄsi kreditek elkĂŒlönĂ­tett kezelĂ©se - **Dual Control (Moderation):** KĂ©tlĂ©pcsƑs jĂłvĂĄhagyĂĄsi folyamat minden szolgĂĄltatĂłi rekordhoz - **2-Step Asset Flow:** Draft → Active Ă©letciklus minden jĂĄrmƱ Ă©s eszköz esetĂ©ben - **4-Level Expertise Taxonomy:** Vehicle Type → Industry → Profession → Specific Task - **P0 Hybrid Vendor Refactor:** HĂĄrom pĂĄrhuzamos szolgĂĄltatĂłi adatforrĂĄs egyesĂ­tĂ©se --- ## 2. 📊 Jelenlegi Rendszer Állapota (Audit Summary) ### 2.1 AdatbĂĄzis Modellek — Teljes KörkĂ©p #### identity sĂ©ma | TĂĄbla | StĂĄtusz | FĂĄjl | |-------|---------|------| | `users` | ✅ KÉSZ | [`social.py`](backend/app/models/identity/social.py:26) | | `persons` | ✅ KÉSZ | — | | `wallets` | ✅ KÉSZ | Triple Wallet (4 zseb) | | `service_providers` | ✅ KÉSZ | KözössĂ©gi szolgĂĄltatĂłk moderĂĄciĂłval | | `provider_validations` | ✅ KÉSZ | ValidĂĄciĂłs rekordok sĂșlyozĂĄssal | | `votes` | ✅ KÉSZ | +1/-1 közössĂ©gi szavazĂĄs | | `user_scores` | ✅ KÉSZ | PontszĂĄmok | | `service_reviews` | ✅ KÉSZ | ÉrtĂ©kelĂ©s + transaction_id | | `competitions` | ✅ KÉSZ | Versenyek | #### marketplace sĂ©ma | TĂĄbla | StĂĄtusz | FĂĄjl | |-------|---------|------| | `service_profiles` | ✅ KÉSZ | [`service.py`](backend/app/models/marketplace/service.py:21) | | `expertise_tags` | ✅ KÉSZ | 4-level hierarchy (parent_id, path, level) | | `service_expertise` | ✅ KÉSZ | Junction table | | `service_staging` | ✅ KÉSZ | Robot-hunted providers | | `discovery_parameters` | ✅ KÉSZ | FelfedezĂ©si paramĂ©terek | | `costs` | ✅ KÉSZ | KöltsĂ©g fƑkönyv | | `organizations` | ✅ KÉSZ | Hivatalos garĂĄzs/szerviz szervezetek | | `organization_members` | ✅ KÉSZ | Tagok szerepkörökkel | | `branches` | ✅ KÉSZ | PostGIS location, opening_hours | | `organization_financials` | ✅ KÉSZ | PĂ©nzĂŒgyi adatok | #### ❌ HIÁNYZÓ modellek | Modell | Tervezett TĂĄbla | Ok | |--------|-----------------|----| | `KYCVerification` | `identity.kyc_verifications` | KYC dokumentumok Ă©s stĂĄtusz követĂ©se | | `ServicePricing` | `marketplace.service_pricing` | SzolgĂĄltatĂĄs ĂĄrazĂĄs (alkatrĂ©sz + munkadĂ­j) | | `ServiceBooking` | `marketplace.service_bookings` | FoglalĂĄsi naplĂł | | `VeszĂ©lyesZĂłnaGatekeeper` | `system.gatekeeper_log` | Hard/soft delete tranzakciĂł-ellenƑrzĂ©s | ### 2.2 Service Layer | Service | FĂĄjl | FunkciĂłk | |---------|------|----------| | `search_providers()` | [`provider_service.py:125`](backend/app/services/provider_service.py:125) | Unified search, geo-filter, trust score | | `quick_add_provider()` | [`provider_service.py:578`](backend/app/services/provider_service.py:578) | Gyors lĂ©trehozĂĄs + gamification | | `update_provider()` | [`provider_service.py:909`](backend/app/services/provider_service.py:909) | Teljes frissĂ­tĂ©s (category sync, expertise) | | `_award_provider_points()` | [`provider_service.py:63`](backend/app/services/provider_service.py:63) | Gamification pontozĂĄs | | `_sync_service_expertises()` | [`provider_service.py:742`](backend/app/services/provider_service.py:742) | 4-level hybrid mentĂ©s | | `find_nearby_services()` | [`search_service.py:24`](backend/app/services/search_service.py:24) | PostGIS + weighted ranking | | `AIService._execute_ai_call()` | [`ai_service.py:23`](backend/app/services/ai_service.py:23) | Ollama → Groq/Gemini fallback | | `AIService._fallback_ai_call()` | [`ai_service.py:81`](backend/app/services/ai_service.py:81) | Cloud fallback (Gemini → Groq) | | `AIService.process_ocr_document()` | [`ai_service.py:174`](backend/app/services/ai_service.py:174) | OCR dokumentum feldolgozĂĄs | | `CostService.record_cost()` | [`cost_service.py`](backend/app/services/cost_service.py) | KöltsĂ©grögzĂ­tĂ©s | ### 2.3 API VĂ©gpontok — Állapot | VĂ©gpont | MetĂłdus | StĂĄtusz | LeĂ­rĂĄs | |---------|---------|---------|--------| | `/admin/providers` | GET | ✅ KÉSZ | Unified provider list (3 tĂĄbla UNION ALL) | | `/admin/providers/stats` | GET | ✅ KÉSZ | StatisztikĂĄk | | `/admin/providers/{id}` | GET | ✅ KÉSZ | Detail + history + validations | | `/admin/providers/{id}/approve` | POST | ✅ KÉSZ | JĂłvĂĄhagyĂĄs + Promotion Engine | | `/admin/providers/{id}/reject` | POST | ✅ KÉSZ | ElutasĂ­tĂĄs okĂĄval | | `/admin/providers/{id}/restore` | POST | ✅ KÉSZ | VisszaĂĄllĂ­tĂĄs | | `/admin/providers/{id}/flag` | POST | ✅ KÉSZ | MegjelölĂ©s (audit) | | `/admin/providers/{id}` | DELETE | ✅ KÉSZ | Soft delete | | `/admin/providers/{id}` | PATCH | ✅ KÉSZ | Teljes update + ServiceProfile auto-create | | `/admin/providers/{id}/validations` | GET | ✅ KÉSZ | ValidĂĄciĂłs rekordok | | `/admin/providers/{id}/history` | GET | ✅ KÉSZ | Audit log | | `/search/match` | GET | ✅ KÉSZ | PostGIS geofencing search | #### ❌ HIÁNYZÓ VĂ©gpontok | VĂ©gpont | MetĂłdus | PrioritĂĄs | |---------|---------|-----------| | `/admin/gatekeeper/hard-delete` | POST | **P0** — VeszĂ©lyes zĂłna hard delete | | `/admin/gatekeeper/log` | GET | **P0** — Gatekeeper audit log | | `/admin/kyc/{user_id}` | GET/PUT | **P1** — KYC dokumentumok kezelĂ©se | | `/admin/kyc/pending` | GET | **P1** — FĂŒggƑ KYC kĂ©relmek | | `/admin/subscriptions` | CRUD | **P1** — ElƑfizetĂ©sek kezelĂ©se | | `/admin/analytics/tco` | GET | **P1** — TCO aggregĂĄciĂł | | `/admin/analytics/provider-rankings` | GET | **P2** — SzolgĂĄltatĂł rangsor analitika | | `/providers/me/profile` | GET/PUT | **P1** — SzolgĂĄltatĂł sajĂĄt profil | | `/providers/me/services` | CRUD | **P1** — SajĂĄt szolgĂĄltatĂĄsok | | `/providers/me/bookings` | GET | **P2** — SajĂĄt foglalĂĄsok | | `/search/semantic` | POST | **P2** — NLP alapĂș keresĂ©s | | `/search/ai-rank` | POST | **P2** — AI rangsorolĂĄs | --- ## 3. đŸ›ïž Admin Level — Mission Control ### 3.1 JĂłvĂĄhagyĂĄsi Munkafolyamat (✅ KÉSZ) ``` flowchart LR A[FĂŒggƑ SzolgĂĄltatĂł] --> B{Admin DöntĂ©s} B -->|Approve| C[Promotion Engine] B -->|Reject| D[ElutasĂ­tĂĄs IndoklĂĄssal] C --> E[ServiceProvider lĂ©trehozva] C --> F[ServiceProfile auto-generated] C --> G[Gamification XP jĂłvĂĄĂ­rva] C --> H[AuditLog naplĂłzva] D --> I[ProviderValidation rekord] D --> J[Status: rejected] B -->|Flag| K[Audit megjelölĂ©s] K --> L[ManuĂĄlis felĂŒlvizsgĂĄlat] ``` ### 3.2 KYC VerifikĂĄciĂł (❌ HIÁNYZIK — P1) **Tervezett Modell:** ```python class KYCVerification(Base): __tablename__ = "kyc_verifications" __table_args__ = {"schema": "identity"} id: int (PK) user_id: int (FK → users.id) person_id: bigint (FK → persons.id) documents: dict (JSONB) — feltöltött dokumentumok status: enum(pending, verified, rejected) verified_by: int (FK → users.id, nullable) verified_at: datetime notes: text expires_at: datetime created_at: datetime updated_at: datetime ``` ### 3.3 KategĂłria Menedzsment (✅ RÉSZBEN) **MeglĂ©vƑ:** - ✅ 4-level ExpertiseTag hierarchia (parent_id, path, level, name_i18n, search_keywords) - ✅ Seed szkriptek: `seed_expertise_tags.py`, `seed_expertise_taxonomy.py` - ✅ 136 kategĂłria (utolsĂł seed: 768) - ✅ `_sync_service_expertises()` — 4-level hybrid mentĂ©s - ✅ `_create_new_tags()` — Új cĂ­mkĂ©k automatikus lĂ©trehozĂĄsa **HiĂĄnyzĂł:** - ❌ KategĂłria kezelƑ admin UI (CRUD + ĂĄtrendezĂ©s) - ❌ KategĂłria lĂĄthatĂłsĂĄgi szabĂĄlyok (Global/Country/Region) ### 3.4 PĂ©nzĂŒgyi & ElƑfizetĂ©s Kontroll (❌ HIÁNYZIK — P1) **MeglĂ©vƑ:** - ✅ Triple Wallet modell (`identity.wallets`) - ✅ FinancialLedger (`audit.financial_ledger`) - ✅ Stripe webhook (Double Lock protokoll) - ✅ Billing Engine (vĂ­zesĂ©s modell) - ✅ `Organization.subscription_tier_id`, `subscription_plan`, `subscription_tier` kapcsolat **HiĂĄnyzĂł:** - ❌ Admin elƑfizetĂ©s kezelƑ UI - ❌ ElƑfizetĂ©s szĂĄmlĂĄzĂĄsi adatok admin felĂŒlet - ❌ Wallet egyenlegek admin ĂĄttekintĂ©se ### 3.5 VeszĂ©lyes ZĂłna — Gatekeeper (❌ HIÁNYZIK — P0 KRITIKUS) **Tervezett architektĂșra:** ```python # system.gatekeeper_log tĂĄbla class GatekeeperLog(Base): __tablename__ = "gatekeeper_log" __table_args__ = {"schema": "system"} id: int (PK) action: enum(soft_delete, hard_delete, restore, purge) target_table: str target_id: int initiated_by: int (FK → users.id) approved_by: int (FK → users.id, nullable) status: enum(pending, approved, rejected, executed) reason: text backup_snapshot: dict (JSONB) — hard delete elƑtti adatmentĂ©s executed_at: datetime created_at: datetime ``` **Hard Delete Folyamat:** 1. Admin kivĂĄlaszt egy rekordot hard delete-re 2. GatekeeperLog lĂ©trehozĂĄsa `pending` stĂĄtusszal 3. Backup snapshot JSONB-ben (mentĂ©s az adatrĂłl) 4. MĂĄsodik admin jĂłvĂĄhagyĂĄsa szĂŒksĂ©ges (Dual Control) 5. Atomi tranzakciĂł: DELETE + AuditLog + GatekeeperLog.status=executed 6. Rollback lehetƑsĂ©g a backup snapshot-bĂłl **Referencia:** [`test_hard_delete.py`](backend/test_hard_delete.py:7) — lĂ©tezik referencia implementĂĄciĂł --- ## 4. đŸ‘€ User Level — Provider Hub ### 4.1 Profil Menedzsment (✅ RÉSZBEN) **MeglĂ©vƑ:** - ✅ `ProviderUpdateInput` sĂ©ma (category_ids, supported_vehicle_classes, specializations, opening_hours) - ✅ `update_provider()` — Teljes provider frissĂ­tĂ©s - ✅ `quick_add_provider()` — Gyors lĂ©trehozĂĄs gamification hook-kal - ✅ AddressManager integrĂĄciĂł (P0 Unified Address Refactor) - ✅ Frontend_admin: [`providers/[id]/edit.vue`](frontend_admin/pages/providers/[id]/edit.vue) — Teljes admin szerkesztƑ **HiĂĄnyzĂł:** - ❌ SzolgĂĄltatĂłi self-service frontend (public felĂŒleten) - ❌ Provider dashboard (sajĂĄt statisztikĂĄk, Ă©rtĂ©kelĂ©sek) - ❌ Multi-language profil szerkesztĂ©s (name_i18n) ### 4.2 SzolgĂĄltatĂĄs KatalĂłgus (❌ HIÁNYZIK — P1) **Tervezett Modell:** ```python class ServicePricing(Base): __tablename__ = "service_pricing" __table_args__ = {"schema": "marketplace"} id: int (PK) service_profile_id: int (FK → marketplace.service_profiles.id) category_id: int (FK → marketplace.expertise_tags.id) name: str name_i18n: dict (JSONB) — Twin-technika description: str description_i18n: dict (JSONB) labor_cost: Decimal(18,4) parts_cost: Decimal(18,4) currency: str (default: "HUF") is_flat_rate: bool estimated_duration_minutes: int is_active: bool valid_from: datetime valid_until: datetime (nullable) ``` ### 4.3 ÉrtĂ©kelĂ©sek & GamifikĂĄciĂł (✅ RÉSZBEN) **MeglĂ©vƑ:** - ✅ `ServiceReview` modell — rating, review_text, transaction_id - ✅ `PointRule` — gamification pontszabĂĄlyok - ✅ `_award_provider_points()` — Provider pontozĂĄs - ✅ Gamification admin frontend: [`gamification/`](frontend_admin/pages/gamification/) - ✅ Leaderboard, badges, competitions, seasons **HiĂĄnyzĂł:** - ❌ Review moderĂĄciĂłs admin UI (flag-elt review-k) - ❌ Gamification widget a provider dashboardon - ❌ PontszabĂĄlyok vizuĂĄlis szerkesztƑje ### 4.4 Lead Menedzsment (❌ HIÁNYZIK — P2) **MeglĂ©vƑ:** - ✅ `ServiceRequest` kapcsolat a `Branch` modellben **HiĂĄnyzĂł:** - ❌ Teljes foglalĂĄsi munkafolyamat (ServiceBooking model) - ❌ Geofenced broadcast (körzetes Ă©rtesĂ­tĂ©s) - ❌ ÉrtesĂ­tĂ©si csatornĂĄk (email, push, in-app) --- ## 5. đŸ€– Robot/AI Level — Intelligence Layer ### 5.1 Szemantikus KeresĂ©s (❌ HIÁNYZIK — P2) **MeglĂ©vƑ:** - ✅ PostGIS geofencing (`ST_DWithin`, `ST_DistanceSphere`) - ✅ Config-driven weighted ranking (ad_weight, partner_weight, trust_weight, dist_penalty, pref_weight) - ✅ Hierarchical ranking config (SystemParameter) **Tervezett NLP Search:** ```python class SemanticSearchEngine: """ Tervezett motor a meglĂ©vƑ SearchService kiterjesztĂ©sĂ©re. """ @classmethod async def semantic_search(cls, query: str, lat: float, lng: float, radius_km: float): # 1. Query embedding (Ollama / local) query_embedding = await AIService.get_embedding(query) # 2. Hybrid search: PostGIS + embedding similarity results = await cls._hybrid_search(query_embedding, lat, lng, radius_km) # 3. AI re-ranking reranked = await AIService.rerank_results(query, results) return reranked ``` ### 5.2 Intelligens RangsorolĂĄs (✅ RÉSZBEN) **Weighted Scoring Formula** ([`search_service.py:92`](backend/app/services/search_service.py:92)): ``` score = (ad_weight * is_advertiser) + (partner_weight * is_partner) + (trust_weight * trust_score) - (dist_penalty * dist_km) + (pref_weight * is_preferred) ``` **HiĂĄnyzĂł:** - ❌ ML-alapĂș rangsorolĂĄs (felhasznĂĄlĂłi viselkedĂ©s alapjĂĄn) - ❌ A/B tesztelĂ©si keretrendszer - ❌ RangsorolĂĄsi metrikĂĄk admin dashboard ### 5.3 Automatikus AdatkinyerĂ©s (✅ RÉSZBEN) **MeglĂ©vƑ:** - ✅ [`AIService`](backend/app/services/ai_service.py) — Multi-Agent gateway - ✅ Ollama local → Groq/Gemini cloud fallback - ✅ `process_ocr_document()` — OCR dokumentum feldolgozĂĄs - ✅ `get_gold_data_from_research()` — Arany adatkinyerĂ©s - ✅ `get_clean_vehicle_data()` — AdattisztĂ­tĂĄs - ✅ `robot_1_ocr_processor.py` — OCR robot **HiĂĄnyzĂł:** - ❌ Document pipeline admin UI (OCR eredmĂ©nyek ellenƑrzĂ©se) - ❌ AI prompt konfigurĂĄciĂłs admin panel - ❌ Fallback monitoring Ă©s naplĂłzĂĄs --- ## 6. 🔧 Adatmodell Terv — RĂ©szletes ### 6.1 MeglĂ©vƑ Modellek ÖsszefoglalĂłja | SĂ©ma | TĂĄbla | Oszlopok | Kulcs (PK/FK) | JSONB | i18n | Soft Delete | |------|-------|----------|---------------|-------|------|-------------| | `identity` | `users` | 20+ | PK, FK→persons | preferences | — | `deleted_at` | | `identity` | `persons` | 22+ | PK, FK→users, FK→address | identity_docs, ice_contact | — | `deleted_at` | | `identity` | `service_providers` | 12+ | PK, FK→address | — | — | `status=rejected` | | `identity` | `wallets` | 10+ | PK, FK→users | — | — | — | | `marketplace` | `service_profiles` | 18+ | PK, FK→service_providers | opening_hours, specializations | — | — | | `marketplace` | `expertise_tags` | 10+ | PK, FK→self (parent) | name_i18n, search_keywords | ✅ 4 mezƑ | — | | `marketplace` | `organizations` | 25+ | PK, FK→address | custom_features, visual_settings, settings, aliases, tags | — | `is_deleted` | | `marketplace` | `branches` | 12+ | PK, FK→organization, FK→address | opening_hours | — | `is_deleted` | | `marketplace` | `service_staging` | 12+ | PK | raw_data | — | — | | `audit` | `financial_ledger` | 8+ | PK, FK→users | details | — | — | ### 6.2 Twin-technika (TöbbnyelvƱsĂ©g) **MeglĂ©vƑ implementĂĄciĂł:** - `ExpertiseTag.name_i18n` (JSONB) — {"hu": "Olajcsere", "en": "Oil Change", "de": "Ölwechsel"} - `ExpertiseTag.description_i18n` (JSONB) - `ExpertiseTag.search_keywords` (JSONB) — {"hu": ["olaj", "motorolaj"], "en": ["oil", "motor oil"]} **KötelezƑ minden Ășj i18n mezƑre:** ```python name_i18n: Mapped[dict] = mapped_column(JSONB, server_default=text("'{}'::jsonb")) ``` ### 6.3 Soft-delete Logika | TĂĄbla | Soft Delete MezƑ | TĂ­pus | |-------|------------------|-------| | `users` | `deleted_at` | DateTime (nullable) | | `persons` | `deleted_at` | DateTime (nullable) | | `organizations` | `is_deleted` | Boolean | | `branches` | `is_deleted` | Boolean | | `service_providers` | `status = rejected` | Enum | | `organization_members` | `status != active` | Enum | **HiĂĄnyzĂł Gatekeeper:** A VeszĂ©lyes ZĂłna funkciĂłhoz dedikĂĄlt `gatekeeper_log` tĂĄbla szĂŒksĂ©ges (LĂĄsd 3.5) ### 6.4 HiĂĄnyzĂł Modellek — Alembic Migration Terv | # | Modell | TĂĄbla | TĂ­pus | MigrĂĄciĂł | |---|--------|-------|-------|----------| | 1 | `GatekeeperLog` | `system.gatekeeper_log` | **P0** | `gatekeeper_log_v1` | | 2 | `KYCVerification` | `identity.kyc_verifications` | P1 | `kyc_verification_v1` | | 3 | `ServicePricing` | `marketplace.service_pricing` | P1 | `service_pricing_v1` | | 4 | `ServiceBooking` | `marketplace.service_bookings` | P2 | `service_booking_v1` | | 5 | `AIRequestLog` | `audit.ai_request_logs` | P2 | `ai_request_log_v1` | --- ## 7. ⚙ Admin Kontroll RendszervĂĄltozĂłk ### 7.1 Hierarchikus Config VĂĄltozĂłk A rendszer nĂ©gy szinten kezeli a konfigurĂĄciĂłs vĂĄltozĂłkat: | Szint | TĂĄbla | HatĂĄskör | |-------|-------|-----------| | **Global** | `system.system_parameters` | Az összes rĂ©giĂłra Ă©s felhasznĂĄlĂłra | | **Country** | `system.system_parameters` (scope=country) | Adott orszĂĄgra | | **Region** | `system.system_parameters` (scope=region) | Adott rĂ©giĂłra | | **User** | `identity.users.preferences` | Egyedi felhasznĂĄlĂłra | ### 7.2 MeglĂ©vƑ RendszervĂĄltozĂłk | Kulcs | TĂ­pus | Scope | ÉrtĂ©k | |-------|-------|-------|-------| | `GAMIFICATION_MASTER_CONFIG` | JSONB | Global | Gamification master config | | `AI_REQUEST_DELAY` | Float | Global | KĂ©sleltetĂ©s AI hĂ­vĂĄsok között | | `AI_TEMPERATURE` | Float | Global | AI hƑmĂ©rsĂ©klet paramĂ©ter | | `AI_TIMEOUT_LOCAL` | Integer | Global | Helyi AI timeout (sec) | | `ENABLE_AI_FALLBACK` | Boolean | Global | Cloud fallback engedĂ©lyezĂ©se | | `AI_MODEL_TEXT` | String | Global | Szöveg AI modell neve | | `AI_MODEL_VISION` | String | Global | KĂ©p AI modell neve | | `DVLA_DAILY_LIMIT` | Integer | Global | Napi DVLA API limit | ### 7.3 Tervezett Új VĂĄltozĂłk | Kulcs | TĂ­pus | Scope | CĂ©l | |-------|-------|-------|-----| | `SEARCH_RANKING_CONFIG` | JSONB | Global | SĂșlyozĂĄsi mĂĄtrix (ad/partner/trust/dist/pref) | | `GATEKEEPER_REQUIRED_APPROVALS` | Integer | Global | HĂĄny admin kell hard delete-hez | | `KYC_REQUIRED_LEVELS` | JSONB | Country | OrszĂĄgonkĂ©nti KYC követelmĂ©nyek | | `PROVIDER_AUTO_APPROVE` | Boolean | Country | Automatikus jĂłvĂĄhagyĂĄs engedĂ©lyezĂ©se | | `REVIEW_MODERATION_ENABLED` | Boolean | Global | Review moderĂĄciĂł bekapcsolĂĄsa | --- ## 8. 🌍 Geo-Logika Ă©s RangsorolĂĄs ### 8.1 PostGIS AlapĂș KeresĂ©s A [`search_service.py`](backend/app/services/search_service.py:24) a `find_nearby_services()` metĂłdussal PostGIS `ST_DWithin` Ă©s `ST_DistanceSphere` fĂŒggvĂ©nyeket hasznĂĄl: ```sql -- GenerĂĄlt SQL (lekĂ©rdezĂ©s logika) SELECT o.id, o.name, gpc.city, b.branch_rating, ST_DistanceSphere(b.location, ST_MakePoint(:lng, :lat)) AS distance_meters FROM marketplace.organizations o JOIN marketplace.branches b ON o.id = b.organization_id LEFT JOIN system.addresses a ON a.id = b.address_id LEFT JOIN system.geo_postal_codes gpc ON gpc.id = a.postal_code_id WHERE o.is_active = true AND b.is_deleted = false AND ST_DWithin(b.location, ST_MakePoint(:lng, :lat), :radius_meters) ORDER BY distance_meters ASC; ``` ### 8.2 SĂșlyozott RangsorolĂĄs A [`SearchService`](backend/app/services/search_service.py) config-driven sĂșlyozĂĄst hasznĂĄl: ```python score = ( r["ad_weight"] * is_advertiser + # HirdetĂ©si sĂșly (default: 10) r["partner_weight"] * is_partner + # Partner sĂșly (default: 5) r["trust_weight"] * trust_score - # Bizalmi sĂșly (default: 2) r["dist_penalty"] * dist_km + # TĂĄvolsĂĄg bĂŒntetĂ©s (default: 0.5) r["pref_weight"] * is_preferred # PreferĂĄlt sĂșly (default: 3) ) ``` ### 8.3 Csomag Szintek Szerinti RangsorolĂĄs | Csomag Szint | ad_weight | partner_weight | max_distance_km | PrioritĂĄs | |-------------|-----------|----------------|-----------------|-----------| | **Free** | 0 | 0 | 20 | Alacsony | | **Basic** | 2 | 1 | 50 | Közepes | | **Premium** | 5 | 3 | 100 | Magas | | **Enterprise** | 10 | 5 | 200 | Legmagasabb | --- ## 9. 📅 ImplementĂĄciĂłs Sorrend Ă©s FĂŒggƑsĂ©gek ### 9.1 FĂŒggƑsĂ©gi GrĂĄf ```mermaid flowchart TD P0[P0: VeszĂ©lyes ZĂłna Gatekeeper] --> P1a[P1: KYC VerifikĂĄciĂł] P0 --> P1b[P1: ElƑfizetĂ©s Admin UI] P1a --> P2a[P2: SzolgĂĄltatĂł Self-Service] P1b --> P2b[P2: FoglalĂĄsi Rendszer] P2a --> P2c[P2: NLP Szemantikus KeresĂ©s] P2b --> P2d[P2: AI RangsorolĂĄs] style P0 fill:#ff4444,color:#fff style P1a fill:#ffaa00,color:#000 style P1b fill:#ffaa00,color:#000 style P2a fill:#44aa44,color:#fff style P2b fill:#44aa44,color:#fff style P2c fill:#44aa44,color:#fff style P2d fill:#44aa44,color:#fff ``` ### 9.2 PrioritĂĄsi Sorrend #### P0 — Kritikus (HiĂĄnyzĂł biztonsĂĄgi funkciĂłk) | # | Feladat | Érintett FĂĄjlok | |---|---------|-----------------| | 1 | **Gatekeeper hard/soft delete** — TranzakciĂł-ellenƑrzĂ©s Dual Control-lal | [`admin_providers.py`](backend/app/api/v1/endpoints/admin_providers.py:1109), [`test_hard_delete.py`](backend/test_hard_delete.py) | | 2 | **Gatekeeper admin API** — DELETE jogosultsĂĄg ellenƑrzĂ©s + AuditLog | Ășj vĂ©gpont | #### P1 — Magas PrioritĂĄs (HiĂĄnyzĂł ĂŒzleti funkciĂłk) | # | Feladat | Érintett FĂĄjlok | |---|---------|-----------------| | 3 | **KYCVerification modell + API** — DokumentumfeltöltĂ©s Ă©s stĂĄtusz | Ășj modell + endpoint | | 4 | **KYC admin UI** — FĂŒggƑ kĂ©relmek kezelĂ©se | Ășj frontend oldal | | 5 | **ServicePricing modell + API** — ÁrazĂĄsi adatok | Ășj modell + endpoint | | 6 | **ElƑfizetĂ©s admin UI** — Subscription CRUD | Ășj frontend oldal | | 7 | **SzolgĂĄltatĂłi self-service API** — SajĂĄt profil kezelĂ©s | Ășj vĂ©gpontok | #### P2 — FejlesztĂ©si CĂ©l (Intelligens funkciĂłk) | # | Feladat | Érintett FĂĄjlok | |---|---------|-----------------| | 8 | **NLP szemantikus keresĂ©s** — Embedding + hybrid search | [`search_service.py`](backend/app/services/search_service.py) kiterjesztĂ©se | | 9 | **AI rangsorolĂĄs** — ML-based ranking | [`ai_service.py`](backend/app/services/ai_service.py) kiterjesztĂ©se | | 10 | **FoglalĂĄsi rendszer** — ServiceBooking flow | Ășj modell + endpoint | | 11 | **Lead management** — ÉrtesĂ­tĂ©si csatornĂĄk | Ășj service | | 12 | **Document pipeline admin UI** — OCR eredmĂ©nyek | Ășj frontend oldal | ### 9.3 ImplementĂĄciĂłs Szekvencia **FĂĄzis 1 — BiztonsĂĄgi Alapok (P0)** 1. `GatekeeperLog` modell lĂ©trehozĂĄsa (`system` sĂ©ma) 2. Admin hard-delete API vĂ©gpont (Dual Control) 3. Admin gatekeeper log UI 4. MeglĂ©vƑ DELETE vĂ©gpontok gatekeeper-en keresztĂŒl vezetĂ©se **FĂĄzis 2 — Admin KibƑvĂ­tĂ©s (P1)** 5. `KYCVerification` modell + API 6. KYC admin frontend 7. `ServicePricing` modell + API 8. ElƑfizetĂ©s admin UI **FĂĄzis 3 — ÖnkiszolgĂĄlĂĄs (P1)** 9. Provider self-service API (CRUD) 10. Provider dashboard frontend 11. Multi-language profil szerkesztĂ©s **FĂĄzis 4 — Intelligens RĂ©teg (P2)** 12. NLP szemantikus keresƑmotor 13. AI rangsorolĂĄs 14. FoglalĂĄsi rendszer 15. Lead management --- ## 10. 🔗 Érintett FĂĄjlok Teljes ListĂĄja ### Backend — Modellek - [`social.py`](backend/app/models/identity/social.py) — ServiceProvider, ProviderValidation, Vote, ServiceReview - [`service.py`](backend/app/models/marketplace/service.py) — ServiceProfile, ExpertiseTag, ServiceExpertise, ServiceStaging - [`organization.py`](backend/app/models/marketplace/organization.py) — Organization, Branch, OrganizationMember - [`audit.py`](backend/app/models/audit.py) — AuditLog, FinancialLedger ### Backend — API VĂ©gpontok - [`admin_providers.py`](backend/app/api/v1/endpoints/admin_providers.py) — Admin provider moderĂĄciĂł (1224+ sor) - [`providers.py`](backend/app/api/v1/endpoints/providers.py) — Public provider API - [`search.py`](backend/app/api/v1/endpoints/search.py) — Geofencing keresƑ (99 sor) ### Backend — Service Layer - [`provider_service.py`](backend/app/services/provider_service.py) — Provider CRUD, gamification, search - [`search_service.py`](backend/app/services/search_service.py) — PostGIS + weighted ranking - [`ai_service.py`](backend/app/services/ai_service.py) — Multi-Agent AI gateway (Ollama → Groq/Gemini) - [`cost_service.py`](backend/app/services/cost_service.py) — KöltsĂ©grögzĂ­tĂ©s ### Frontend — Admin (Nuxt) - [`providers/index.vue`](frontend_admin/pages/providers/index.vue) — Provider lista - [`providers/pending.vue`](frontend_admin/pages/providers/pending.vue) — FĂŒggƑ jĂłvĂĄhagyĂĄsok - [`providers/[id]/index.vue`](frontend_admin/pages/providers/[id]/index.vue) — Provider rĂ©szletek - [`providers/[id]/edit.vue`](frontend_admin/pages/providers/[id]/edit.vue) — Provider szerkesztĂ©s - [`gamification/`](frontend_admin/pages/gamification/) — Gamification admin felĂŒlet ### Frontend — Public (Vue+Vite) - [`provider/ProviderEditModal.vue`](frontend_app/src/components/provider/ProviderEditModal.vue) — Provider szerkesztĂ©s - [`provider/ProviderDetailModal.vue`](frontend_app/src/components/provider/ProviderDetailModal.vue) — Provider rĂ©szletek - [`provider/ProviderQuickAddModal.vue`](frontend_app/src/components/provider/ProviderQuickAddModal.vue) — Gyors hozzĂĄadĂĄs - [`dashboard/ServiceFinderCard.vue`](frontend_app/src/components/dashboard/ServiceFinderCard.vue) — KeresƑ widget ### DokumentĂĄciĂłk - [`admin_providers_root_cause_analysis.md`](docs/admin_providers_root_cause_analysis.md) — Root cause analysis - [`epic_10_admin_frontend_spec.md`](docs/sf/epic_10_admin_frontend_spec.md) — Epic 10 spec - [`Masterbook_2.0_Status.md`](docs/Masterbook_2.0_Status.md) — Projekt stĂĄtusz - [`full_db_schema_blueprint.md`](docs/full_db_schema_blueprint.md) — Teljes sĂ©ma blueprint --- ## ✅ VerifikĂĄciĂłs Checklist ### Admin Level - [ ] Admin provider moderĂĄciĂł (approve/reject/flag/restore) — ✅ KÉSZ - [ ] UNION ALL query (3 tĂĄbla egyesĂ­tĂ©se) — ✅ KÉSZ - [ ] Promotion Engine (Staging → Live) — ✅ KÉSZ - [ ] VeszĂ©lyes ZĂłna Gatekeeper — ❌ HIÁNYZIK (P0) - [ ] KYC VerifikĂĄciĂł — ❌ HIÁNYZIK (P1) - [ ] ElƑfizetĂ©s admin UI — ❌ HIÁNYZIK (P1) - [ ] KategĂłria menedzsment admin UI — ❌ HIÁNYZIK (P1) ### User Level - [ ] Provider CRUD (quick_add, update) — ✅ KÉSZ - [ ] Geofencing keresƑ (PostGIS) — ✅ KÉSZ - [ ] SzolgĂĄltatĂłi self-service — ❌ HIÁNYZIK (P1) - [ ] ServicePricing modell — ❌ HIÁNYZIK (P1) - [ ] FoglalĂĄsi rendszer — ❌ HIÁNYZIK (P2) - [ ] ÉrtĂ©kelĂ©s Ă©s gamifikĂĄciĂł — ✅ RÉSZBEN ### Robot/AI Level - [ ] Multi-Agent AI Gateway (Ollama → Groq/Gemini) — ✅ KÉSZ - [ ] OCR dokumentum feldolgozĂĄs — ✅ KÉSZ - [ ] Config-driven weighted ranking — ✅ KÉSZ - [ ] NLP szemantikus keresĂ©s — ❌ HIÁNYZIK (P2) - [ ] ML-alapĂș rangsorolĂĄs — ❌ HIÁNYZIK (P2) - [ ] AI prompt admin panel — ❌ HIÁNYZIK (P2)