getReportsByUser method
- String userId
Gets reports created by a specific user
Implementation
Future<List<Report>> getReportsByUser(String userId) async {
try {
final querySnapshot = await _firestore
.collection(_collectionPath)
.where('createdBy', isEqualTo: userId)
.get();
return querySnapshot.docs
.map((doc) => Report.fromMap(doc.data(), doc.id))
.toList();
} catch (e) {
print('Error getting user reports: $e');
rethrow;
}
}