no update fechas

Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
Omar Sánchez Pizarro
2026-01-20 13:53:13 +01:00
parent 084e2eebff
commit ec073db1db

View File

@@ -123,7 +123,7 @@ class MongoDBArticleCache:
'url': article.get_url(), 'url': article.get_url(),
'images': article.get_images(), 'images': article.get_images(),
'modified_at': article.get_modified_at(), 'modified_at': article.get_modified_at(),
'expiresAt': expires_at, #'expiresAt': expires_at,
} }
# Preparar user_info # Preparar user_info
@@ -197,14 +197,18 @@ class MongoDBArticleCache:
'notified_at': now, 'notified_at': now,
'is_favorite': False, 'is_favorite': False,
}] }]
new_article_data['createdAt'] = now
new_article_data['updatedAt'] = now
# Usar $setOnInsert para createdAt y updatedAt
# Solo se establecerán si el documento es nuevo (insert), no si ya existe (update)
operations.append( operations.append(
UpdateOne( UpdateOne(
{'platform': platform, 'id': article_id}, {'platform': platform, 'id': article_id},
{ {
'$set': new_article_data, '$set': new_article_data,
'$setOnInsert': {
'createdAt': now,
'updatedAt': now
}
}, },
upsert=True upsert=True
) )
@@ -258,8 +262,7 @@ class MongoDBArticleCache:
{'platform': platform, 'id': str(article_id)}, {'platform': platform, 'id': str(article_id)},
{ {
'$set': { '$set': {
'user_info': user_info_list, 'user_info': user_info_list
'updatedAt': datetime.utcnow()
} }
} }
) )