getMessaging method
Implementation
Future<UserMessagingModel> getMessaging(String userId) async {
try {
final snapshot = await _db
.collection('Users')
.doc(userId)
.collection('Private')
.doc('messaging')
.get();
if (snapshot.data() != null) {
final model = await UserMessagingModel.fromDocumentSnapshot(snapshot);
return model;
}
throw UserMessagingDataServiceException(
code: RdevCode.NotFound,
message: 'UserMessaging with for user:${userId} was not found');
} catch (err) {
if (err is UserMessagingDataServiceException) {
rethrow;
}
if (err is FirebaseException) {
throw UserMessagingDataServiceException(message: err.toString());
}
throw UserMessagingDataServiceException(message: err.toString());
}
}