This commit is contained in:
Felipe
2024-04-18 18:29:41 -05:00
parent 8084d5fc7f
commit c874178019
12 changed files with 1042 additions and 557 deletions
@@ -63,6 +63,26 @@ class FirebaseScoreRepository {
}
}
Stream<List<CommentEntity>> getScoresForUser(String userId) {
return commentsCollection
.where('destination_id', isEqualTo: userId)
.where('is_from_user', isEqualTo: false)
.snapshots()
.map((querySnapshot) => querySnapshot.docs
.map((doc) => CommentEntity.fromDocument(doc.data()))
.toList());
}
Stream<List<CommentEntity>> getScoresForProfessional(String userId) {
return commentsCollection
.where('destination_id', isEqualTo: userId)
.where('is_from_user', isEqualTo: true)
.snapshots()
.map((querySnapshot) => querySnapshot.docs
.map((doc) => CommentEntity.fromDocument(doc.data()))
.toList());
}
addComment(CommentEntity comment) async {
await commentsCollection.add(comment.toDocument());