Page MenuHomePhabricator

D11902.id39987.diff
No OneTemporary

D11902.id39987.diff

diff --git a/native/cpp/CommonCpp/NativeModules/AuxUserStoreOperations.h b/native/cpp/CommonCpp/NativeModules/AuxUserStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/AuxUserStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/AuxUserStoreOperations.h
@@ -1,17 +1,13 @@
#pragma once
#include "../DatabaseManagers/entities/AuxUserInfo.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class AuxUserStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~AuxUserStoreOperationBase(){};
-};
-class RemoveAuxUserInfosOperation : public AuxUserStoreOperationBase {
+class RemoveAuxUserInfosOperation : public DBOperationBase {
public:
RemoveAuxUserInfosOperation(std::vector<std::string> ids) : ids{ids} {
}
@@ -24,7 +20,7 @@
std::vector<std::string> ids;
};
-class ReplaceAuxUserInfoOperation : public AuxUserStoreOperationBase {
+class ReplaceAuxUserInfoOperation : public DBOperationBase {
public:
ReplaceAuxUserInfoOperation(AuxUserInfo &&auxUserInfo)
: auxUserInfo{std::move(auxUserInfo)} {
@@ -38,7 +34,7 @@
AuxUserInfo auxUserInfo;
};
-class RemoveAllAuxUserInfosOperation : public AuxUserStoreOperationBase {
+class RemoveAllAuxUserInfosOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllAuxUserInfos();
diff --git a/native/cpp/CommonCpp/NativeModules/CommunityStoreOperations.h b/native/cpp/CommonCpp/NativeModules/CommunityStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/CommunityStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/CommunityStoreOperations.h
@@ -1,17 +1,13 @@
#pragma once
#include "../DatabaseManagers/entities/CommunityInfo.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class CommunityStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~CommunityStoreOperationBase(){};
-};
-class RemoveCommunitiesOperation : public CommunityStoreOperationBase {
+class RemoveCommunitiesOperation : public DBOperationBase {
public:
RemoveCommunitiesOperation(std::vector<std::string> ids) : ids{ids} {
}
@@ -24,7 +20,7 @@
std::vector<std::string> ids;
};
-class ReplaceCommunityOperation : public CommunityStoreOperationBase {
+class ReplaceCommunityOperation : public DBOperationBase {
public:
ReplaceCommunityOperation(CommunityInfo &&community)
: community{std::move(community)} {
@@ -38,7 +34,7 @@
CommunityInfo community;
};
-class RemoveAllCommunitiesOperation : public CommunityStoreOperationBase {
+class RemoveAllCommunitiesOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllCommunities();
diff --git a/native/cpp/CommonCpp/NativeModules/DBOperationBase.h b/native/cpp/CommonCpp/NativeModules/DBOperationBase.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/NativeModules/DBOperationBase.h
@@ -0,0 +1,11 @@
+#pragma once
+
+namespace comm {
+
+class DBOperationBase {
+public:
+ virtual void execute() = 0;
+ virtual ~DBOperationBase(){};
+};
+
+} // namespace comm
diff --git a/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h b/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
@@ -1,5 +1,6 @@
#pragma once
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <jsi/jsi.h>
@@ -7,13 +8,7 @@
namespace jsi = facebook::jsi;
-class DraftStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~DraftStoreOperationBase(){};
-};
-
-class UpdateDraftOperation : public DraftStoreOperationBase {
+class UpdateDraftOperation : public DBOperationBase {
public:
UpdateDraftOperation(jsi::Runtime &rt, const jsi::Object &payload)
: key{payload.getProperty(rt, "key").asString(rt).utf8(rt)},
@@ -28,7 +23,7 @@
std::string text;
};
-class MoveDraftOperation : public DraftStoreOperationBase {
+class MoveDraftOperation : public DBOperationBase {
public:
MoveDraftOperation(jsi::Runtime &rt, const jsi::Object &payload)
: oldKey{payload.getProperty(rt, "oldKey").asString(rt).utf8(rt)},
@@ -43,14 +38,14 @@
std::string newKey;
};
-class RemoveAllDraftsOperation : public DraftStoreOperationBase {
+class RemoveAllDraftsOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllDrafts();
}
};
-class RemoveDraftsOperation : public DraftStoreOperationBase {
+class RemoveDraftsOperation : public DBOperationBase {
public:
RemoveDraftsOperation(jsi::Runtime &rt, const jsi::Object &payload)
: idsToRemove{} {
diff --git a/native/cpp/CommonCpp/NativeModules/IntegrityStoreOperations.h b/native/cpp/CommonCpp/NativeModules/IntegrityStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/IntegrityStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/IntegrityStoreOperations.h
@@ -1,18 +1,13 @@
#pragma once
#include "../DatabaseManagers/entities/IntegrityThreadHash.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class IntegrityStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~IntegrityStoreOperationBase(){};
-};
-class RemoveIntegrityThreadHashesOperation
- : public IntegrityStoreOperationBase {
+class RemoveIntegrityThreadHashesOperation : public DBOperationBase {
public:
RemoveIntegrityThreadHashesOperation(std::vector<std::string> ids)
: ids{ids} {
@@ -26,8 +21,7 @@
std::vector<std::string> ids;
};
-class ReplaceIntegrityThreadHashesOperation
- : public IntegrityStoreOperationBase {
+class ReplaceIntegrityThreadHashesOperation : public DBOperationBase {
public:
ReplaceIntegrityThreadHashesOperation(
std::vector<IntegrityThreadHash> &&threadHashes)
@@ -43,8 +37,7 @@
std::vector<IntegrityThreadHash> threadHashes;
};
-class RemoveAllIntegrityThreadHashesOperation
- : public IntegrityStoreOperationBase {
+class RemoveAllIntegrityThreadHashesOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllIntegrityThreadHashes();
diff --git a/native/cpp/CommonCpp/NativeModules/KeyserverStoreOperations.h b/native/cpp/CommonCpp/NativeModules/KeyserverStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/KeyserverStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/KeyserverStoreOperations.h
@@ -1,17 +1,13 @@
#pragma once
#include "../DatabaseManagers/entities/KeyserverInfo.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class KeyserverStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~KeyserverStoreOperationBase(){};
-};
-class RemoveKeyserversOperation : public KeyserverStoreOperationBase {
+class RemoveKeyserversOperation : public DBOperationBase {
public:
RemoveKeyserversOperation(std::vector<std::string> ids) : ids{ids} {
}
@@ -24,7 +20,7 @@
std::vector<std::string> ids;
};
-class ReplaceKeyserverOperation : public KeyserverStoreOperationBase {
+class ReplaceKeyserverOperation : public DBOperationBase {
public:
ReplaceKeyserverOperation(KeyserverInfo &&keyserver)
: keyserver{std::move(keyserver)} {
@@ -38,7 +34,7 @@
KeyserverInfo keyserver;
};
-class RemoveAllKeyserversOperation : public KeyserverStoreOperationBase {
+class RemoveAllKeyserversOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllKeyservers();
diff --git a/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h b/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h
@@ -2,17 +2,13 @@
#include "../DatabaseManagers/entities/Media.h"
#include "../DatabaseManagers/entities/Message.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class MessageStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~MessageStoreOperationBase(){};
-};
-class RemoveMessagesOperation : public MessageStoreOperationBase {
+class RemoveMessagesOperation : public DBOperationBase {
public:
RemoveMessagesOperation(jsi::Runtime &rt, const jsi::Object &payload)
: msg_ids_to_remove{} {
@@ -33,7 +29,7 @@
std::vector<std::string> msg_ids_to_remove;
};
-class RemoveMessagesForThreadsOperation : public MessageStoreOperationBase {
+class RemoveMessagesForThreadsOperation : public DBOperationBase {
public:
RemoveMessagesForThreadsOperation(
jsi::Runtime &rt,
@@ -57,7 +53,7 @@
std::vector<std::string> thread_ids;
};
-class ReplaceMessageOperation : public MessageStoreOperationBase {
+class ReplaceMessageOperation : public DBOperationBase {
public:
ReplaceMessageOperation(jsi::Runtime &rt, const jsi::Object &payload)
: media_vector{} {
@@ -133,7 +129,7 @@
std::vector<std::unique_ptr<Media>> media_vector;
};
-class RekeyMessageOperation : public MessageStoreOperationBase {
+class RekeyMessageOperation : public DBOperationBase {
public:
RekeyMessageOperation(jsi::Runtime &rt, const jsi::Object &payload) {
this->from = payload.getProperty(rt, "from").asString(rt).utf8(rt);
@@ -151,7 +147,7 @@
std::string to;
};
-class RemoveAllMessagesOperation : public MessageStoreOperationBase {
+class RemoveAllMessagesOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllMessages();
@@ -159,7 +155,7 @@
}
};
-class ReplaceMessageThreadsOperation : public MessageStoreOperationBase {
+class ReplaceMessageThreadsOperation : public DBOperationBase {
public:
ReplaceMessageThreadsOperation(jsi::Runtime &rt, const jsi::Object &payload)
: msg_threads{} {
@@ -185,14 +181,14 @@
std::vector<MessageStoreThread> msg_threads;
};
-class RemoveAllMessageStoreThreadsOperation : public MessageStoreOperationBase {
+class RemoveAllMessageStoreThreadsOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllMessageStoreThreads();
}
};
-class RemoveMessageStoreThreadsOperation : public MessageStoreOperationBase {
+class RemoveMessageStoreThreadsOperation : public DBOperationBase {
public:
RemoveMessageStoreThreadsOperation(
jsi::Runtime &rt,
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.h
@@ -3,13 +3,13 @@
#include "../../../DatabaseManagers/entities/AuxUserInfo.h"
#include "AuxUserStoreOperations.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include <jsi/jsi.h>
namespace comm {
-class AuxUserStore
- : public BaseDataStore<AuxUserStoreOperationBase, AuxUserInfo> {
+class AuxUserStore : public BaseDataStore<DBOperationBase, AuxUserInfo> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -18,7 +18,7 @@
public:
AuxUserStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<AuxUserStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/AuxUserStore.cpp
@@ -1,5 +1,6 @@
#include "AuxUserStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -30,10 +31,10 @@
return jsiAuxUserInfos;
}
-std::vector<std::unique_ptr<AuxUserStoreOperationBase>>
-AuxUserStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<AuxUserStoreOperationBase>> auxUserStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> AuxUserStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> auxUserStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.h
@@ -3,13 +3,13 @@
#include "../../../DatabaseManagers/entities/CommunityInfo.h"
#include "BaseDataStore.h"
#include "CommunityStoreOperations.h"
+#include "DBOperationBase.h"
#include <jsi/jsi.h>
namespace comm {
-class CommunityStore
- : public BaseDataStore<CommunityStoreOperationBase, CommunityInfo> {
+class CommunityStore : public BaseDataStore<DBOperationBase, CommunityInfo> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -18,7 +18,7 @@
public:
CommunityStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<CommunityStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/CommunityStore.cpp
@@ -1,5 +1,6 @@
#include "CommunityStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -29,10 +30,10 @@
return jsiCommunities;
}
-std::vector<std::unique_ptr<CommunityStoreOperationBase>>
-CommunityStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<CommunityStoreOperationBase>> communityStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> CommunityStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> communityStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.h
@@ -2,13 +2,14 @@
#include "../../../DatabaseManagers/entities/Draft.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "DraftStoreOperations.h"
#include <jsi/jsi.h>
namespace comm {
-class DraftStore : public BaseDataStore<DraftStoreOperationBase, Draft> {
+class DraftStore : public BaseDataStore<DBOperationBase, Draft> {
private:
static OperationType UPDATE_DRAFT_OPERATION;
static OperationType MOVE_DRAFT_OPERATION;
@@ -18,7 +19,7 @@
public:
DraftStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<DraftStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/DraftStore.cpp
@@ -1,5 +1,6 @@
#include "DraftStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -36,10 +37,10 @@
return jsiDrafts;
}
-std::vector<std::unique_ptr<DraftStoreOperationBase>>
-DraftStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<DraftStoreOperationBase>> draftStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> DraftStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> draftStoreOps;
for (auto idx = 0; idx < operations.size(rt); idx++) {
auto op = operations.getValueAtIndex(rt, idx).asObject(rt);
auto op_type = op.getProperty(rt, "type").asString(rt).utf8(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.h
@@ -2,6 +2,7 @@
#include "../../../DatabaseManagers/entities/IntegrityThreadHash.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "IntegrityStoreOperations.h"
#include <jsi/jsi.h>
@@ -9,7 +10,7 @@
namespace comm {
class IntegrityStore
- : public BaseDataStore<IntegrityStoreOperationBase, IntegrityThreadHash> {
+ : public BaseDataStore<DBOperationBase, IntegrityThreadHash> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -18,7 +19,7 @@
public:
IntegrityStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<IntegrityStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
@@ -1,6 +1,7 @@
#include "IntegrityStore.h"
#include "../../../DatabaseManagers/entities/IntegrityThreadHash.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -38,10 +39,10 @@
return jsiIntegrityThreadHashes;
}
-std::vector<std::unique_ptr<IntegrityStoreOperationBase>>
-IntegrityStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<IntegrityStoreOperationBase>> integrityStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> IntegrityStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> integrityStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.h
@@ -2,14 +2,14 @@
#include "../../../DatabaseManagers/entities/KeyserverInfo.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "KeyserverStoreOperations.h"
#include <jsi/jsi.h>
namespace comm {
-class KeyserverStore
- : public BaseDataStore<KeyserverStoreOperationBase, KeyserverInfo> {
+class KeyserverStore : public BaseDataStore<DBOperationBase, KeyserverInfo> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -18,7 +18,7 @@
public:
KeyserverStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<KeyserverStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp
@@ -1,5 +1,6 @@
#include "KeyserverStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -31,10 +32,10 @@
return jsiKeyservers;
}
-std::vector<std::unique_ptr<KeyserverStoreOperationBase>>
-KeyserverStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<KeyserverStoreOperationBase>> keyserverStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> KeyserverStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> keyserverStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h
@@ -3,6 +3,7 @@
#include "../../../DatabaseManagers/entities/Media.h"
#include "../../../DatabaseManagers/entities/Message.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "MessageStoreOperations.h"
#include <jsi/jsi.h>
@@ -11,8 +12,7 @@
using MessageEntity = std::pair<Message, std::vector<Media>>;
-class MessageStore
- : public BaseDataStore<MessageStoreOperationBase, MessageEntity> {
+class MessageStore : public BaseDataStore<DBOperationBase, MessageEntity> {
private:
static OperationType REKEY_OPERATION;
static OperationType REMOVE_OPERATION;
@@ -27,7 +27,7 @@
public:
MessageStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<MessageStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp
@@ -1,5 +1,6 @@
#include "MessageStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -73,11 +74,11 @@
return jsiMessages;
}
-std::vector<std::unique_ptr<MessageStoreOperationBase>>
-MessageStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
+std::vector<std::unique_ptr<DBOperationBase>> MessageStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
- std::vector<std::unique_ptr<MessageStoreOperationBase>> messageStoreOps;
+ std::vector<std::unique_ptr<DBOperationBase>> messageStoreOps;
for (auto idx = 0; idx < operations.size(rt); idx++) {
auto op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.h
@@ -2,13 +2,14 @@
#include "../../../DatabaseManagers/entities/Report.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "ReportStoreOperations.h"
#include <jsi/jsi.h>
namespace comm {
-class ReportStore : public BaseDataStore<ReportStoreOperationBase, Report> {
+class ReportStore : public BaseDataStore<DBOperationBase, Report> {
private:
static OperationType REPLACE_REPORT_OPERATION;
static OperationType REMOVE_REPORTS_OPERATION;
@@ -17,7 +18,7 @@
public:
ReportStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<ReportStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ReportStore.cpp
@@ -1,5 +1,6 @@
#include "ReportStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -30,10 +31,10 @@
return jsiReports;
}
-std::vector<std::unique_ptr<ReportStoreOperationBase>>
-ReportStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<ReportStoreOperationBase>> reportStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> ReportStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> reportStoreOps;
for (auto idx = 0; idx < operations.size(rt); idx++) {
auto op = operations.getValueAtIndex(rt, idx).asObject(rt);
auto op_type = op.getProperty(rt, "type").asString(rt).utf8(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.h
@@ -2,15 +2,15 @@
#include "../../../DatabaseManagers/entities/SyncedMetadataEntry.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "SyncedMetadataStoreOperations.h"
#include <jsi/jsi.h>
namespace comm {
-class SyncedMetadataStore : public BaseDataStore<
- SyncedMetadataStoreOperationBase,
- SyncedMetadataEntry> {
+class SyncedMetadataStore
+ : public BaseDataStore<DBOperationBase, SyncedMetadataEntry> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -19,9 +19,9 @@
public:
SyncedMetadataStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<SyncedMetadataStoreOperationBase>>
- createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const override;
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const override;
jsi::Array parseDBDataStore(
jsi::Runtime &rt,
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp
@@ -1,5 +1,6 @@
#include "SyncedMetadataStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -33,12 +34,11 @@
return jsiSyncedMetadata;
}
-std::vector<std::unique_ptr<SyncedMetadataStoreOperationBase>>
+std::vector<std::unique_ptr<DBOperationBase>>
SyncedMetadataStore::createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const {
- std::vector<std::unique_ptr<SyncedMetadataStoreOperationBase>>
- syncedMetadataStoreOps;
+ std::vector<std::unique_ptr<DBOperationBase>> syncedMetadataStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.h
@@ -2,15 +2,15 @@
#include "../../../DatabaseManagers/entities/ThreadActivityEntry.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "ThreadActivityStoreOperations.h"
#include <jsi/jsi.h>
namespace comm {
-class ThreadActivityStore : public BaseDataStore<
- ThreadActivityStoreOperationBase,
- ThreadActivityEntry> {
+class ThreadActivityStore
+ : public BaseDataStore<DBOperationBase, ThreadActivityEntry> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -19,9 +19,9 @@
public:
ThreadActivityStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<ThreadActivityStoreOperationBase>>
- createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const override;
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const override;
jsi::Array parseDBDataStore(
jsi::Runtime &rt,
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp
@@ -1,5 +1,6 @@
#include "ThreadActivityStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -39,12 +40,11 @@
return jsiThreadActivitiyEntries;
}
-std::vector<std::unique_ptr<ThreadActivityStoreOperationBase>>
+std::vector<std::unique_ptr<DBOperationBase>>
ThreadActivityStore::createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const {
- std::vector<std::unique_ptr<ThreadActivityStoreOperationBase>>
- threadActivityStoreOps;
+ std::vector<std::unique_ptr<DBOperationBase>> threadActivityStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.h
@@ -2,13 +2,14 @@
#include "../../../DatabaseManagers/entities/Thread.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "ThreadStoreOperations.h"
#include <jsi/jsi.h>
namespace comm {
-class ThreadStore : public BaseDataStore<ThreadStoreOperationBase, Thread> {
+class ThreadStore : public BaseDataStore<DBOperationBase, Thread> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -17,7 +18,7 @@
public:
ThreadStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<ThreadStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadStore.cpp
@@ -1,5 +1,6 @@
#include "ThreadStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -77,10 +78,10 @@
return jsiThreads;
}
-std::vector<std::unique_ptr<ThreadStoreOperationBase>>
-ThreadStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<ThreadStoreOperationBase>> threadStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> ThreadStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> threadStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.h
@@ -2,13 +2,14 @@
#include "../../../DatabaseManagers/entities/UserInfo.h"
#include "BaseDataStore.h"
+#include "DBOperationBase.h"
#include "UserStoreOperations.h"
#include <jsi/jsi.h>
namespace comm {
-class UserStore : public BaseDataStore<UserStoreOperationBase, UserInfo> {
+class UserStore : public BaseDataStore<DBOperationBase, UserInfo> {
private:
static OperationType REMOVE_OPERATION;
static OperationType REMOVE_ALL_OPERATION;
@@ -17,7 +18,7 @@
public:
UserStore(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
- std::vector<std::unique_ptr<UserStoreOperationBase>> createOperations(
+ std::vector<std::unique_ptr<DBOperationBase>> createOperations(
jsi::Runtime &rt,
const jsi::Array &operations) const override;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/UserStore.cpp
@@ -1,5 +1,6 @@
#include "UserStore.h"
+#include "DBOperationBase.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/jsi.h>
@@ -28,10 +29,10 @@
return jsiUsers;
}
-std::vector<std::unique_ptr<UserStoreOperationBase>>
-UserStore::createOperations(jsi::Runtime &rt, const jsi::Array &operations)
- const {
- std::vector<std::unique_ptr<UserStoreOperationBase>> userStoreOps;
+std::vector<std::unique_ptr<DBOperationBase>> UserStore::createOperations(
+ jsi::Runtime &rt,
+ const jsi::Array &operations) const {
+ std::vector<std::unique_ptr<DBOperationBase>> userStoreOps;
for (size_t idx = 0; idx < operations.size(rt); idx++) {
jsi::Object op = operations.getValueAtIndex(rt, idx).asObject(rt);
diff --git a/native/cpp/CommonCpp/NativeModules/ReportStoreOperations.h b/native/cpp/CommonCpp/NativeModules/ReportStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/ReportStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/ReportStoreOperations.h
@@ -2,17 +2,13 @@
#include "../DatabaseManagers/entities/Media.h"
#include "../DatabaseManagers/entities/Report.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class ReportStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~ReportStoreOperationBase(){};
-};
-class RemoveReportsOperation : public ReportStoreOperationBase {
+class RemoveReportsOperation : public DBOperationBase {
public:
RemoveReportsOperation(jsi::Runtime &rt, const jsi::Object &payload)
: ids_to_remove{} {
@@ -31,7 +27,7 @@
std::vector<std::string> ids_to_remove;
};
-class ReplaceReportOperation : public ReportStoreOperationBase {
+class ReplaceReportOperation : public DBOperationBase {
public:
ReplaceReportOperation(jsi::Runtime &rt, const jsi::Object &payload) {
auto report_id = payload.getProperty(rt, "id").asString(rt).utf8(rt);
@@ -47,7 +43,7 @@
std::unique_ptr<Report> report;
};
-class RemoveAllReportsOperation : public ReportStoreOperationBase {
+class RemoveAllReportsOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllReports();
diff --git a/native/cpp/CommonCpp/NativeModules/SyncedMetadataStoreOperations.h b/native/cpp/CommonCpp/NativeModules/SyncedMetadataStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/SyncedMetadataStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/SyncedMetadataStoreOperations.h
@@ -1,18 +1,13 @@
#pragma once
#include "../DatabaseManagers/entities/SyncedMetadataEntry.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class SyncedMetadataStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~SyncedMetadataStoreOperationBase(){};
-};
-
-class RemoveSyncedMetadataOperation : public SyncedMetadataStoreOperationBase {
+class RemoveSyncedMetadataOperation : public DBOperationBase {
public:
RemoveSyncedMetadataOperation(std::vector<std::string> names) : names{names} {
}
@@ -25,7 +20,7 @@
std::vector<std::string> names;
};
-class ReplaceSyncedMetadataOperation : public SyncedMetadataStoreOperationBase {
+class ReplaceSyncedMetadataOperation : public DBOperationBase {
public:
ReplaceSyncedMetadataOperation(SyncedMetadataEntry &&syncedMetadataEntry)
: syncedMetadataEntry{std::move(syncedMetadataEntry)} {
@@ -40,8 +35,7 @@
SyncedMetadataEntry syncedMetadataEntry;
};
-class RemoveAllSyncedMetadataOperation
- : public SyncedMetadataStoreOperationBase {
+class RemoveAllSyncedMetadataOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllSyncedMetadata();
diff --git a/native/cpp/CommonCpp/NativeModules/ThreadActivityStoreOperations.h b/native/cpp/CommonCpp/NativeModules/ThreadActivityStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/ThreadActivityStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/ThreadActivityStoreOperations.h
@@ -1,18 +1,13 @@
#pragma once
#include "../DatabaseManagers/entities/ThreadActivityEntry.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class ThreadActivityStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~ThreadActivityStoreOperationBase(){};
-};
-class RemoveThreadActivityEntriesOperation
- : public ThreadActivityStoreOperationBase {
+class RemoveThreadActivityEntriesOperation : public DBOperationBase {
public:
RemoveThreadActivityEntriesOperation(std::vector<std::string> ids)
: ids{ids} {
@@ -26,8 +21,7 @@
std::vector<std::string> ids;
};
-class ReplaceThreadActivityEntryOperation
- : public ThreadActivityStoreOperationBase {
+class ReplaceThreadActivityEntryOperation : public DBOperationBase {
public:
ReplaceThreadActivityEntryOperation(ThreadActivityEntry &&threadActivityEntry)
: threadActivityEntry{std::move(threadActivityEntry)} {
@@ -42,8 +36,7 @@
ThreadActivityEntry threadActivityEntry;
};
-class RemoveAllThreadActivityEntriesOperation
- : public ThreadActivityStoreOperationBase {
+class RemoveAllThreadActivityEntriesOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllThreadActivityEntries();
diff --git a/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h b/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h
@@ -2,17 +2,13 @@
#include "../DatabaseManagers/entities/Media.h"
#include "../DatabaseManagers/entities/Thread.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class ThreadStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~ThreadStoreOperationBase(){};
-};
-class RemoveThreadsOperation : public ThreadStoreOperationBase {
+class RemoveThreadsOperation : public DBOperationBase {
public:
RemoveThreadsOperation(std::vector<std::string> ids) : ids{ids} {
}
@@ -25,7 +21,7 @@
std::vector<std::string> ids;
};
-class ReplaceThreadOperation : public ThreadStoreOperationBase {
+class ReplaceThreadOperation : public DBOperationBase {
public:
ReplaceThreadOperation(Thread &&thread) : thread{std::move(thread)} {
}
@@ -38,7 +34,7 @@
Thread thread;
};
-class RemoveAllThreadsOperation : public ThreadStoreOperationBase {
+class RemoveAllThreadsOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllThreads();
diff --git a/native/cpp/CommonCpp/NativeModules/UserStoreOperations.h b/native/cpp/CommonCpp/NativeModules/UserStoreOperations.h
--- a/native/cpp/CommonCpp/NativeModules/UserStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/UserStoreOperations.h
@@ -1,17 +1,13 @@
#pragma once
#include "../DatabaseManagers/entities/UserInfo.h"
+#include "DBOperationBase.h"
#include "DatabaseManager.h"
#include <vector>
namespace comm {
-class UserStoreOperationBase {
-public:
- virtual void execute() = 0;
- virtual ~UserStoreOperationBase(){};
-};
-class RemoveUsersOperation : public UserStoreOperationBase {
+class RemoveUsersOperation : public DBOperationBase {
public:
RemoveUsersOperation(std::vector<std::string> ids) : ids{ids} {
}
@@ -24,7 +20,7 @@
std::vector<std::string> ids;
};
-class ReplaceUserOperation : public UserStoreOperationBase {
+class ReplaceUserOperation : public DBOperationBase {
public:
ReplaceUserOperation(UserInfo &&user) : user{std::move(user)} {
}
@@ -37,7 +33,7 @@
UserInfo user;
};
-class RemoveAllUsersOperation : public UserStoreOperationBase {
+class RemoveAllUsersOperation : public DBOperationBase {
public:
virtual void execute() override {
DatabaseManager::getQueryExecutor().removeAllUsers();

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 10:33 PM (16 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692761
Default Alt Text
D11902.id39987.diff (43 KB)

Event Timeline