Adding MAP API.

This commit is contained in:
stephb9959
2021-11-09 22:10:12 -08:00
parent bcfb28c287
commit afd26394e4
14 changed files with 861 additions and 211 deletions

View File

@@ -0,0 +1,25 @@
//
// Created by stephane bourque on 2021-11-09.
//
#include "RESTAPI_map_list_handler.h"
#include "RESTObjects/RESTAPI_ProvObjects.h"
#include "StorageService.h"
#include "RESTAPI/RESTAPI_db_helpers.h"
namespace OpenWifi{
void RESTAPI_map_list_handler::DoGet() {
if(!QB_.Select.empty()) {
return ReturnRecordList<decltype(StorageService()->MapDB()),
ProvObjects::Map>("list",StorageService()->MapDB(),*this );
} else if(QB_.CountOnly) {
Poco::JSON::Object Answer;
auto C = StorageService()->MapDB().Count();
return ReturnCountOnly(C);
} else {
std::vector<ProvObjects::Map> Maps;
StorageService()->MapDB().GetRecords(QB_.Offset,QB_.Limit,Maps);
return MakeJSONObjectArray("list", Maps, *this);
}
}
}