SHAFI commited on
Commit
c88a0c2
·
1 Parent(s): 6c42811

fix: initialize required engagement fields (likes, dislike, views) to 0 to match Appwrite schema

Browse files
Files changed (1) hide show
  1. app/services/appwrite_db.py +5 -1
app/services/appwrite_db.py CHANGED
@@ -309,7 +309,11 @@ class AppwriteDatabase:
309
  'fetched_at': datetime.now().isoformat(),
310
  'url_hash': url_hash,
311
  'slug': str(get_field(article, 'slug', ''))[:200],
312
- 'quality_score': int(get_field(article, 'quality_score', 50))
 
 
 
 
313
  }
314
 
315
  # Try to create document
 
309
  'fetched_at': datetime.now().isoformat(),
310
  'url_hash': url_hash,
311
  'slug': str(get_field(article, 'slug', ''))[:200],
312
+ 'quality_score': int(get_field(article, 'quality_score', 50)),
313
+ # FIX: Initialize engagement metrics (required by Appwrite schema)
314
+ 'likes': 0,
315
+ 'dislike': 0, # Note: Schema uses singular 'dislike' based on error logs/screenshots
316
+ 'views': 0
317
  }
318
 
319
  # Try to create document