Fixing list handlers

This commit is contained in:
stephb9959
2022-02-25 22:26:08 -08:00
parent 63484acb63
commit 6a9d0cee55
17 changed files with 177 additions and 122 deletions

View File

@@ -9,23 +9,16 @@
namespace OpenWifi{
void RESTAPI_map_list_handler::DoGet() {
const char *BlockName{"list"};
if(GetBoolParameter("myMaps",false)) {
auto where = DB_.OP("creator",ORM::EQ,UserInfo_.userinfo.id);
std::vector<ProvObjects::Map> Maps;
MapDB::RecordVec Maps;
DB_.GetRecords(QB_.Offset,QB_.Limit,Maps,where);
return MakeJSONObjectArray("list", Maps, *this);
return MakeJSONObjectArray(BlockName, Maps, *this);
} else if(GetBoolParameter("sharedWithMe",false)) {
} else if(!QB_.Select.empty()) {
return ReturnRecordList<decltype(DB_),ProvObjects::Map>("list",DB_,*this );
} else if(QB_.CountOnly) {
Poco::JSON::Object Answer;
auto C = DB_.Count();
return ReturnCountOnly(C);
} else {
MapDB::RecordVec Maps;
DB_.GetRecords(QB_.Offset,QB_.Limit,Maps);
return MakeJSONObjectArray("list", Maps, *this);
return ListHandler<MapDB>(BlockName, DB_, *this);
}
}
}