From 92ac4107077179cbd34bcfcdef87ce0fb81a23d7 Mon Sep 17 00:00:00 2001 From: ajaysi Date: Fri, 3 Apr 2026 07:00:14 +0530 Subject: [PATCH] fix: additional podcast service updates --- backend/services/podcast_service.py | 11 +++++++++++ backend/services/subscription/limit_validation.py | 2 +- backend/services/subscription/schema_utils.py | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/backend/services/podcast_service.py b/backend/services/podcast_service.py index 1c9783e9..56b69ca9 100644 --- a/backend/services/podcast_service.py +++ b/backend/services/podcast_service.py @@ -61,6 +61,17 @@ class PodcastService: ) ).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( self, user_id: str, diff --git a/backend/services/subscription/limit_validation.py b/backend/services/subscription/limit_validation.py index 009bf5ec..90b2853a 100644 --- a/backend/services/subscription/limit_validation.py +++ b/backend/services/subscription/limit_validation.py @@ -431,7 +431,7 @@ class LimitValidator: self.db.refresh(usage) except Exception as query_err: 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...") import sqlite3 import services.subscription.schema_utils as schema_utils diff --git a/backend/services/subscription/schema_utils.py b/backend/services/subscription/schema_utils.py index 842a614d..7e0d508f 100644 --- a/backend/services/subscription/schema_utils.py +++ b/backend/services/subscription/schema_utils.py @@ -88,6 +88,9 @@ def ensure_usage_summaries_columns(db: Session) -> None: "image_edit_cost": "REAL DEFAULT 0.0", "audio_calls": "INTEGER DEFAULT 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():