fix: additional podcast service updates
This commit is contained in:
@@ -61,6 +61,17 @@ class PodcastService:
|
|||||||
)
|
)
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
|
def get_project_by_idea(self, user_id: str, idea: str) -> Optional[PodcastProject]:
|
||||||
|
"""Find a project by matching idea (case-insensitive, partial match)."""
|
||||||
|
# Normalize idea for comparison
|
||||||
|
normalized_idea = idea.strip().lower()
|
||||||
|
return self.db.query(PodcastProject).filter(
|
||||||
|
and_(
|
||||||
|
PodcastProject.user_id == user_id,
|
||||||
|
PodcastProject.idea.ilike(f"%{normalized_idea}%")
|
||||||
|
)
|
||||||
|
).order_by(desc(PodcastProject.updated_at)).first()
|
||||||
|
|
||||||
def update_project(
|
def update_project(
|
||||||
self,
|
self,
|
||||||
user_id: str,
|
user_id: str,
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ class LimitValidator:
|
|||||||
self.db.refresh(usage)
|
self.db.refresh(usage)
|
||||||
except Exception as query_err:
|
except Exception as query_err:
|
||||||
error_str = str(query_err).lower()
|
error_str = str(query_err).lower()
|
||||||
if 'no such column' in error_str and 'exa_calls' in error_str:
|
if 'no such column' in error_str and ('exa_calls' in error_str or 'wavespeed' in error_str):
|
||||||
logger.warning("Missing column detected in usage query, fixing schema and retrying...")
|
logger.warning("Missing column detected in usage query, fixing schema and retrying...")
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import services.subscription.schema_utils as schema_utils
|
import services.subscription.schema_utils as schema_utils
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ def ensure_usage_summaries_columns(db: Session) -> None:
|
|||||||
"image_edit_cost": "REAL DEFAULT 0.0",
|
"image_edit_cost": "REAL DEFAULT 0.0",
|
||||||
"audio_calls": "INTEGER DEFAULT 0",
|
"audio_calls": "INTEGER DEFAULT 0",
|
||||||
"audio_cost": "REAL DEFAULT 0.0",
|
"audio_cost": "REAL DEFAULT 0.0",
|
||||||
|
"wavespeed_calls": "INTEGER DEFAULT 0",
|
||||||
|
"wavespeed_tokens": "INTEGER DEFAULT 0",
|
||||||
|
"wavespeed_cost": "REAL DEFAULT 0.0",
|
||||||
}
|
}
|
||||||
|
|
||||||
for col_name, ddl in required_columns.items():
|
for col_name, ddl in required_columns.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user