fix: Resolve APIProvider enum mismatch causing dashboard errors

- Fix import path in subscriptions.py (pricing_service location)
- Add values_callable to APIUsageLog.provider enum column
- Normalize provider values to lowercase in usage trends helpers
- Add migration script for existing databases
This commit is contained in:
ajaysi
2026-03-29 12:50:50 +05:30
parent d6ad903e3d
commit 557f700f68
4 changed files with 176 additions and 9 deletions

View File

@@ -155,7 +155,7 @@ class APIUsageLog(Base):
user_id = Column(String(100), nullable=False)
# API Details
provider = Column(Enum(APIProvider), nullable=False)
provider = Column(Enum(APIProvider, values_callable=lambda obj: [e.value for e in obj]), nullable=False)
endpoint = Column(String(200), nullable=False)
method = Column(String(10), nullable=False)
model_used = Column(String(100), nullable=True) # e.g., "gemini-2.5-flash"