Add automatic location creation on venue

This commit is contained in:
stephb9959
2022-03-11 09:13:42 -08:00
parent 8134dfcd61
commit 078107d93d

View File

@@ -239,12 +239,22 @@ namespace OpenWifi{
}
std::string ErrorText;
auto ObjectsToCreate = CreateObjects(NewObject, *this, ErrorText);
auto ObjectsCreated = CreateObjects(NewObject, *this, ErrorText);
if(!ErrorText.empty()) {
return BadRequest(ErrorText);
}
if(!ObjectsCreated.empty()) {
if(!ObjectsCreated.empty()) {
auto it = ObjectsCreated.find("location");
if(it!=ObjectsCreated.end()) {
MoveFromLocation="";
MoveToLocation=it->second;
Existing.location=MoveToLocation;
}
}
}
if(StorageService()->VenueDB().UpdateRecord("id", UUID, Existing)) {
MoveUsage(StorageService()->ContactDB(),DB_,MoveFromContacts, MoveToContacts, Existing.info.id);
MoveUsage(StorageService()->LocationDB(),DB_,MoveFromLocation, MoveToLocation, Existing.info.id);