Fixing location/contact deletion.

This commit is contained in:
stephb9959
2021-10-21 08:44:35 -07:00
parent e49cef57e6
commit f28ef3f65b
6 changed files with 9 additions and 4 deletions

2
build
View File

@@ -1 +1 @@
352
354

View File

@@ -70,6 +70,8 @@ namespace OpenWifi{
}
if(DB_.DeleteRecord("id",UUID)) {
if(!Existing.entity.empty())
Storage()->EntityDB().DeleteLocation("id",Existing.entity,UUID);
return OK();
}
InternalError(RESTAPI::Errors::CouldNotBeDeleted);

View File

@@ -23,7 +23,7 @@ namespace OpenWifi{
AddContactExtendedInfo(E, Obj);
ObjArr.add(Obj);
} else {
return BadRequest(RESTAPI::Errors::UnknownId + " ("+i+")");
return BadRequest(RESTAPI::Errors::ContactMustExist + " ("+i+")");
}
}
Poco::JSON::Object Answer;

View File

@@ -68,6 +68,9 @@ namespace OpenWifi{
}
if(DB_.DeleteRecord("id",UUID)) {
if(!Existing.entity.empty())
Storage()->EntityDB().DeleteLocation("id",Existing.entity,UUID);
return OK();
}
InternalError(RESTAPI::Errors::CouldNotBeDeleted);

View File

@@ -24,7 +24,7 @@ namespace OpenWifi{
AddLocationExtendedInfo(E, Obj);
ObjArr.add(Obj);
} else {
return BadRequest(RESTAPI::Errors::UnknownId + " ("+i+")");
return BadRequest(RESTAPI::Errors::LocationMustExist + " ("+i+")");
}
}
Poco::JSON::Object Answer;

View File

@@ -15,7 +15,7 @@ namespace OpenWifi::RESTAPI::Errors {
static const std::string CouldNotBeDeleted{"Element could not be deleted."};
static const std::string NameMustBeSet{"The name property must be set."};
static const std::string ConfigBlockInvalid{"Configuration block type invalid."};
static const std::string UnknownId{"Unknown management policy."};
static const std::string UnknownId{"Unknown UUID."};
static const std::string InvalidDeviceTypes{"Unknown or invalid device type(s)."};
static const std::string RecordNotCreated{"Record could not be created."};
static const std::string RecordNotUpdated{"Record could not be updated."};