updateCommentPropertiesCount method
Future<void>
updateCommentPropertiesCount(
{
})
Implementation
Future<void> updateCommentPropertiesCount({
required final String feedId,
required final String commentId,
final int reactionsCount = 0,
final int repliesCount = 0,
}) async {
try {
final _feedRef = PeamanReferenceHelper.feedsCol.doc(feedId);
final _parentCommentRef = _feedRef.collection('comments').doc(commentId);
final _data = <String, dynamic>{
'reactions_count': FieldValue.increment(reactionsCount),
'replies_count': FieldValue.increment(repliesCount),
};
await _parentCommentRef.update(_data);
print('Success: Updating comment properties count of $commentId');
} catch (e) {
print(e);
print('Error!!!: Updating comment properties count of $commentId');
return null;
}
}