Phase 1.3: Create price endpoint for users

Add GET /api/exchange/price endpoint:
- Available to regular users (BOOK_APPOINTMENT permission)
- Returns current BTC/EUR price with admin premium applied
- Uses cached price from PriceHistory if not stale
- Fetches fresh price from Bitfinex if needed
- Returns is_stale flag when price is older than 5 minutes
- Includes exchange configuration (min/max EUR, increment)
- Handles fetch failures gracefully (returns stale price with error)
This commit is contained in:
counterweight 2025-12-22 18:22:46 +01:00
parent 61e95e56d5
commit 2702b66fd2
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 176 additions and 0 deletions

View file

@ -10,6 +10,7 @@ from routes import audit as audit_routes
from routes import auth as auth_routes
from routes import availability as availability_routes
from routes import booking as booking_routes
from routes import exchange as exchange_routes
from routes import invites as invites_routes
from routes import meta as meta_routes
from routes import profile as profile_routes
@ -40,6 +41,7 @@ app.add_middleware(
# Include routers - modules with single router
app.include_router(auth_routes.router)
app.include_router(audit_routes.router)
app.include_router(exchange_routes.router)
app.include_router(profile_routes.router)
app.include_router(availability_routes.router)
app.include_router(meta_routes.router)