diff --git a/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h b/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h index 1e9db827d..6c0478a9f 100644 --- a/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h +++ b/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h @@ -1,82 +1,83 @@ #pragma once #include "../DatabaseManagers/entities/Media.h" #include "../DatabaseManagers/entities/Message.h" #include "DatabaseManager.h" #include namespace comm { class MessageStoreOperationBase { public: virtual void execute() = 0; + virtual ~MessageStoreOperationBase(){}; }; class RemoveMessagesOperation : public MessageStoreOperationBase { public: RemoveMessagesOperation(std::vector ids) : ids{ids} { } virtual void execute() override { DatabaseManager::getQueryExecutor().removeMessages(this->ids); DatabaseManager::getQueryExecutor().removeMediaForMessages(this->ids); } private: const std::vector ids; }; class RemoveMessagesForThreadsOperation : public MessageStoreOperationBase { public: RemoveMessagesForThreadsOperation(std::vector ids) : ids{ids} { } virtual void execute() override { DatabaseManager::getQueryExecutor().removeMessagesForThreads(this->ids); DatabaseManager::getQueryExecutor().removeMediaForThreads(this->ids); } private: const std::vector ids; }; class ReplaceMessageOperation : public MessageStoreOperationBase { public: ReplaceMessageOperation(Message msg, std::vector media_vector) : msg{std::move(msg)}, media_vector{std::move(media_vector)} { } virtual void execute() override { for (const Media &media : this->media_vector) { DatabaseManager::getQueryExecutor().replaceMedia(media); } DatabaseManager::getQueryExecutor().replaceMessage(this->msg); } private: const Message msg; const std::vector media_vector; }; class RekeyMessageOperation : public MessageStoreOperationBase { public: RekeyMessageOperation(std::string from, std::string to) : from{from}, to{to} { } virtual void execute() override { DatabaseManager::getQueryExecutor().rekeyMessage(this->from, this->to); } private: const std::string from; const std::string to; }; class RemoveAllMessagesOperation : public MessageStoreOperationBase { public: virtual void execute() override { DatabaseManager::getQueryExecutor().removeAllMessages(); DatabaseManager::getQueryExecutor().removeAllMedia(); } }; } // namespace comm diff --git a/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h b/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h index e16322820..3af66ec24 100644 --- a/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h +++ b/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h @@ -1,47 +1,48 @@ #pragma once #include "../DatabaseManagers/entities/Media.h" #include "../DatabaseManagers/entities/Thread.h" #include "DatabaseManager.h" #include namespace comm { class ThreadStoreOperationBase { public: virtual void execute() = 0; + virtual ~ThreadStoreOperationBase(){}; }; class RemoveThreadsOperation : public ThreadStoreOperationBase { public: RemoveThreadsOperation(std::vector ids) : ids{ids} { } virtual void execute() override { DatabaseManager::getQueryExecutor().removeThreads(this->ids); } private: std::vector ids; }; class ReplaceThreadOperation : public ThreadStoreOperationBase { public: ReplaceThreadOperation(Thread &&thread) : thread{std::move(thread)} { } virtual void execute() override { DatabaseManager::getQueryExecutor().replaceThread(this->thread); } private: Thread thread; }; class RemoveAllThreadsOperation : public ThreadStoreOperationBase { public: virtual void execute() override { DatabaseManager::getQueryExecutor().removeAllThreads(); } }; } // namespace comm