stephb9959
2023-02-21 13:34:41 -08:00
parent bf6f5389d7
commit ac6780d094
165 changed files with 16172 additions and 16329 deletions

View File

@@ -7,35 +7,34 @@
//
#include "RESTAPI_entity_list_handler.h"
#include "StorageService.h"
#include "RESTAPI_db_helpers.h"
#include "StorageService.h"
namespace OpenWifi{
namespace OpenWifi {
void RESTAPI_entity_list_handler::DoGet() {
if(!QB_.Select.empty()) {
return ReturnRecordList<decltype(DB_),
ProvObjects::Entity>("entities",DB_,*this );
} else if(QB_.CountOnly) {
auto C = DB_.Count();
return ReturnCountOnly(C);
} else if (GetBoolParameter("getTree",false)) {
Poco::JSON::Object FullTree;
DB_.BuildTree(FullTree);
return ReturnObject(FullTree);
} else {
EntityDB::RecordVec Entities;
DB_.GetRecords(QB_.Offset, QB_.Limit,Entities);
return MakeJSONObjectArray("entities", Entities, *this);
}
}
void RESTAPI_entity_list_handler::DoGet() {
if (!QB_.Select.empty()) {
return ReturnRecordList<decltype(DB_), ProvObjects::Entity>("entities", DB_, *this);
} else if (QB_.CountOnly) {
auto C = DB_.Count();
return ReturnCountOnly(C);
} else if (GetBoolParameter("getTree", false)) {
Poco::JSON::Object FullTree;
DB_.BuildTree(FullTree);
return ReturnObject(FullTree);
} else {
EntityDB::RecordVec Entities;
DB_.GetRecords(QB_.Offset, QB_.Limit, Entities);
return MakeJSONObjectArray("entities", Entities, *this);
}
}
void RESTAPI_entity_list_handler::DoPost() {
if (GetBoolParameter("setTree",false)) {
const auto & FullTree = ParsedBody_;
DB_.ImportTree(FullTree);
return OK();
}
BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
}
void RESTAPI_entity_list_handler::DoPost() {
if (GetBoolParameter("setTree", false)) {
const auto &FullTree = ParsedBody_;
DB_.ImportTree(FullTree);
return OK();
}
BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
} // namespace OpenWifi