mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-24 15:48:11 +02:00
feat: Hardcode French e-commerce websites configuration
- Remove ability to add/edit/delete search sites from settings UI - Configure 16 French e-commerce sites with search URLs: - Discount: Gifi, Stokomani, B&M, Centrakor, L'Incroyable, Action, La Foir'Fouille - Grandes Surfaces: E.Leclerc, Auchan, Carrefour - E-commerce: Amazon France, Cdiscount - Électronique: Darty, Boulanger, Fnac - Add automatic database seeding on application startup - Add /api/search-sites/seed and /api/search-sites/reset endpoints - Add cookie consent banner handling for sites that require it - Simplify Settings page to only show site list with toggle for active state
This commit is contained in:
5 files changed
+449
-468
No files matched your search
+17
-1
@@ -11,10 +11,11 @@ from slowapi import _rate_limit_exceeded_handler
|
||||
from slowapi.errors import RateLimitExceeded
|
||||
from sqlalchemy import text
|
||||
|
||||
from app.database import engine
|
||||
from app.database import SessionLocal, engine
|
||||
from app.limiter import limiter
|
||||
from app.routers import items, jobs, notifications, openrouter, search, search_sites, settings
|
||||
from app.services.scheduler_service import scheduled_refresh, scheduler
|
||||
from app.services import search_service
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(
|
||||
@@ -80,6 +81,21 @@ async def lifespan(app: FastAPI):
|
||||
except Exception as e:
|
||||
logger.error(f"Migration error: {e}")
|
||||
|
||||
# Seed default sites
|
||||
logger.info("Seeding default search sites...")
|
||||
try:
|
||||
db = SessionLocal()
|
||||
try:
|
||||
created = search_service.seed_default_sites(db)
|
||||
if created > 0:
|
||||
logger.info(f"{created} site(s) de recherche créé(s)")
|
||||
else:
|
||||
logger.info("Sites de recherche déjà initialisés")
|
||||
finally:
|
||||
db.close()
|
||||
except Exception as e:
|
||||
logger.error(f"Error seeding sites: {e}")
|
||||
|
||||
logger.info("Starting smart scheduler (Heartbeat: 1 minute)")
|
||||
scheduler.add_job(scheduled_refresh, IntervalTrigger(minutes=1), id="refresh_job", replace_existing=True)
|
||||
scheduler.start()
|
||||
|
||||
Reference in new issue
Block a user