TF-1865: Create func update sending email in data layer
(cherry picked from commit d2b2f7af4afd4fc817ae404548650182deb9e0ed)
This commit is contained in:
@@ -92,7 +92,9 @@ abstract class EmailDataSource {
|
||||
|
||||
Future<void> storeSendingEmail(AccountId accountId, UserName userName, SendingEmail sendingEmail);
|
||||
|
||||
Future<List<SendingEmail>> getAllSendingEmails(AccountId accountId, UserName userName, {bool needToReopen = false});
|
||||
Future<void> updateSendingEmail(AccountId accountId, UserName userName, SendingEmail sendingEmail);
|
||||
|
||||
Future<List<SendingEmail>> getAllSendingEmails(AccountId accountId, UserName userName);
|
||||
|
||||
Future<void> deleteSendingEmail(AccountId accountId, UserName userName, String sendingId);
|
||||
}
|
||||
@@ -203,4 +203,9 @@ class EmailDataSourceImpl extends EmailDataSource {
|
||||
Future<void> deleteSendingEmail(AccountId accountId, UserName userName, String sendingId) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateSendingEmail(AccountId accountId, UserName userName, SendingEmail sendingEmail) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
@@ -267,4 +267,11 @@ class EmailHiveCacheDataSourceImpl extends EmailDataSource {
|
||||
return await _sendingEmailCacheManager.deleteSendingEmail(accountId, userName, sendingId);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateSendingEmail(AccountId accountId, UserName userName, SendingEmail sendingEmail) {
|
||||
return Future.sync(() async {
|
||||
return await _sendingEmailCacheManager.updateSendingEmail(accountId, userName, sendingEmail.toHiveCache());
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
}
|
||||
@@ -56,4 +56,14 @@ class SendingEmailCacheManager {
|
||||
}
|
||||
|
||||
Future<void> clearAllSendingEmails() => _hiveCacheClient.clearAllData();
|
||||
|
||||
Future<void> updateSendingEmail(
|
||||
AccountId accountId,
|
||||
UserName userName,
|
||||
SendingEmailHiveCache sendingEmailHiveCache
|
||||
) async {
|
||||
final keyCache = TupleKey(sendingEmailHiveCache.sendingId, accountId.asString, userName.value).encodeKey;
|
||||
log('SendingEmailCacheManager::updateSendingEmail():keyCache: $keyCache | sendingEmailHiveCache: $sendingEmailHiveCache');
|
||||
return await _hiveCacheClient.updateItem(keyCache, sendingEmailHiveCache, needToReopen: true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user