DocumentID is now generated, saved and recalled using ModelCardDatabase

This commit is contained in:
Ralph Wessel
2024-11-06 16:25:13 +00:00
parent 03ad5a80af
commit 4e60d95ce9
2 changed files with 5 additions and 2 deletions
@@ -45,6 +45,7 @@ std::unique_ptr<Cargo> GetDocumentInfo::run() const {
docInfo->location = *info.path;
if (auto cardDatabase = connectorProject->getModelCardDatabase(); cardDatabase != nullptr)
docInfo->ID = cardDatabase->getStoreID();
docInfo->ID = Guid{true}.operator String();
else
docInfo->ID = Guid{true}.operator String();
return std::make_unique<WrappedValue>(std::move(docInfo));
} //GetDocumentInfo::run
@@ -180,8 +180,10 @@ namespace speckle::database {
//Read the data stored in the document
auto storedData = readStore();
m_cache = std::make_unique<Cache>();
if (!storedData)
if (!storedData) {
m_cache->setID(speckle::utility::Guid{true}.operator String()); //Needs an ID - used as substitute for the Speckle 'document ID'
return m_cache.get(); //Return an empty container if there's no data
}
//Import the document data into the record cache
if constexpr (std::is_same_v<ObjWrapper, Obj>)
Transport().receive(std::forward<active::serialise::Cargo&&>(*m_cache), active::serialise::Identity{}, storedData);