Entity list call optimization.

This commit is contained in:
stephb9959
2021-12-05 22:14:46 -08:00
parent 76a3d0198b
commit 7af553c174
2 changed files with 3 additions and 5 deletions

View File

@@ -14,14 +14,13 @@
namespace OpenWifi{
void RESTAPI_entity_list_handler::DoGet() {
std::string Arg;
if(!QB_.Select.empty()) {
return ReturnRecordList<decltype(StorageService()->EntityDB()),
ProvObjects::Entity>("entities",StorageService()->EntityDB(),*this );
} else if(QB_.CountOnly) {
auto C = StorageService()->EntityDB().Count();
return ReturnCountOnly(C);
} if (HasParameter("getTree",Arg) && Arg=="true") {
} else if (GetBoolParameter("getTree",false)) {
Poco::JSON::Object FullTree;
StorageService()->EntityDB().BuildTree(FullTree);
return ReturnObject(FullTree);
@@ -33,8 +32,7 @@ namespace OpenWifi{
}
void RESTAPI_entity_list_handler::DoPost() {
std::string Arg;
if (HasParameter("setTree",Arg) && Arg=="true") {
if (GetBoolParameter("setTree",false)) {
auto FullTree = ParseStream();
StorageService()->EntityDB().ImportTree(FullTree);
return OK();