fix(social-audit): Convert opening_hours dict to JSON for JSONB column

Fixes: psycopg2.ProgrammingError: can't adapt type 'dict'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-01-09 05:14:01 +01:00
parent deed279521
commit 8fed190303

View File

@ -1041,6 +1041,10 @@ class SocialMediaAuditor:
google_reviews = result.get('google_reviews', {})
# Convert opening_hours dict to JSON string for JSONB column
opening_hours = google_reviews.get('google_opening_hours')
opening_hours_json = json.dumps(opening_hours) if opening_hours else None
session.execute(upsert_website, {
'company_id': company_id,
'analyzed_at': result['audit_date'],
@ -1061,7 +1065,7 @@ class SocialMediaAuditor:
'cms_detected': website.get('site_generator'),
'google_rating': google_reviews.get('google_rating'),
'google_reviews_count': google_reviews.get('google_reviews_count'),
'google_opening_hours': google_reviews.get('google_opening_hours'),
'google_opening_hours': opening_hours_json,
'google_photos_count': google_reviews.get('google_photos_count'),
'audit_source': 'automated',
'audit_version': '1.0',