Add automatic configuration creation on tag

This commit is contained in:
stephb9959
2022-03-11 09:07:39 -08:00
parent 6739cfbd64
commit 8134dfcd61
2 changed files with 12 additions and 1 deletions

View File

@@ -421,11 +421,20 @@ namespace OpenWifi{
}
std::string ErrorText;
auto ObjectsCreated = CreateObjects(NewObject,*this,ErrorText);
auto ObjectsCreated = CreateObjects(Existing,*this,ErrorText);
if(!ErrorText.empty()) {
return BadRequest(ErrorText);
}
if(!ObjectsCreated.empty()) {
auto it = ObjectsCreated.find("configuration");
if(it!=ObjectsCreated.end()) {
FromConfiguration="";
ToConfiguration=it->second;
Existing.deviceConfiguration=ToConfiguration;
}
}
if(StorageService()->InventoryDB().UpdateRecord("id", Existing.info.id, Existing)) {
MoveUsage(StorageService()->PolicyDB(),DB_,FromPolicy,ToPolicy,Existing.info.id);
MoveUsage(StorageService()->LocationDB(),DB_,FromLocation,ToLocation,Existing.info.id);