mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-06-12 10:35:15 -04:00
[EGD-4553] Notes search engine implemented. (#1112)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "NotesRepository.hpp"
|
||||
|
||||
#include <module-db/queries/notes/QueryNotesGet.hpp>
|
||||
#include <module-db/queries/notes/QueryNotesGetByText.hpp>
|
||||
#include <module-db/queries/notes/QueryNoteStore.hpp>
|
||||
#include <module-db/queries/notes/QueryNoteRemove.hpp>
|
||||
|
||||
@@ -30,6 +31,22 @@ namespace app::notes
|
||||
DBServiceAPI::GetQuery(application, db::Interface::Name::Notes, std::move(query));
|
||||
}
|
||||
|
||||
void NotesDBRepository::getByText(const std::string &text, const OnFilteredCallback &callback)
|
||||
{
|
||||
auto query = std::make_unique<db::query::QueryNotesGetByText>(text);
|
||||
query->setQueryListener(db::QueryCallback::fromFunction([callback](auto response) {
|
||||
auto result = dynamic_cast<db::query::NotesGetByTextResult *>(response);
|
||||
if (result == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (callback) {
|
||||
callback(result->getRecords());
|
||||
}
|
||||
return true;
|
||||
}));
|
||||
DBServiceAPI::GetQuery(application, db::Interface::Name::Notes, std::move(query));
|
||||
}
|
||||
|
||||
void NotesDBRepository::save(const NotesRecord ¬e, const OnResultCallback &callback)
|
||||
{
|
||||
auto query = std::make_unique<db::query::QueryNoteStore>(note);
|
||||
|
||||
Reference in New Issue
Block a user