Removing entity types.

This commit is contained in:
stephb9959
2022-04-06 12:02:42 -07:00
parent ce5250598c
commit 3f6108bfd9
6 changed files with 283 additions and 178 deletions

View File

@@ -14,16 +14,11 @@
namespace OpenWifi{
void RESTAPI_entity_list_handler::DoGet() {
auto type = GetParameter("type","normal");
if(!ValidEntityType(type)) {
return BadRequest(RESTAPI::Errors::InvalidEntityType);
}
if(!QB_.Select.empty()) {
return ReturnRecordList<decltype(DB_),
ProvObjects::Entity>("entities",DB_,*this );
} else if(QB_.CountOnly) {
auto C = DB_.Count(fmt::format(" where type='{}'", type));
auto C = DB_.Count();
return ReturnCountOnly(C);
} else if (GetBoolParameter("getTree",false)) {
Poco::JSON::Object FullTree;
@@ -31,8 +26,7 @@ namespace OpenWifi{
return ReturnObject(FullTree);
} else {
EntityDB::RecordVec Entities;
DB_.GetRecords(QB_.Offset, QB_.Limit,Entities,fmt::format(" where type='{}'", type));
DB_.GetRecords(QB_.Offset, QB_.Limit,Entities);
return MakeJSONObjectArray("entities", Entities, *this);
}
}