mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-02 03:27:51 +00:00
Adding locations for venue.
This commit is contained in:
@@ -35,11 +35,9 @@ namespace OpenWifi{
|
||||
|
||||
void RESTAPI_inventory_list_handler::DoGet() {
|
||||
std::string UUID;
|
||||
std::string Arg;
|
||||
std::string Arg,Arg2;
|
||||
|
||||
bool SerialOnly=false;
|
||||
if(HasParameter("serialOnly",Arg) && Arg=="true")
|
||||
SerialOnly=true;
|
||||
bool SerialOnly=GetBoolParameter("serialOnly");
|
||||
|
||||
std::string OrderBy{" ORDER BY serialNumber ASC "};
|
||||
if(HasParameter("orderBy",Arg)) {
|
||||
@@ -66,11 +64,15 @@ namespace OpenWifi{
|
||||
ProvObjects::InventoryTagVec Tags;
|
||||
DB_.GetRecords(QB_.Offset, QB_.Limit, Tags, DB_.OP("venue",ORM::EQ,UUID), OrderBy);
|
||||
return SendList( Tags, SerialOnly);
|
||||
} else if((HasParameter("subscribersOnly",Arg) && Arg=="true")) {
|
||||
} else if(GetBoolParameter("subscribersOnly") && GetBoolParameter("unassigned")) {
|
||||
ProvObjects::InventoryTagVec Tags;
|
||||
DB_.GetRecords(QB_.Offset, QB_.Limit, Tags, " devClass='subscriber' ", OrderBy);
|
||||
DB_.GetRecords(QB_.Offset, QB_.Limit, Tags, " devClass='subscriber' and subscriber='' ", OrderBy);
|
||||
return SendList(Tags, SerialOnly);
|
||||
} else if(HasParameter("unassigned",Arg) && Arg=="true") {
|
||||
} else if(GetBoolParameter("subscribersOnly")) {
|
||||
ProvObjects::InventoryTagVec Tags;
|
||||
DB_.GetRecords(QB_.Offset, QB_.Limit, Tags, " devClass='subscriber' and subscriber!='' ", OrderBy);
|
||||
return SendList(Tags, SerialOnly);
|
||||
} else if(GetBoolParameter("unassigned")) {
|
||||
if(QB_.CountOnly) {
|
||||
std::string Empty;
|
||||
auto C = DB_.Count( InventoryDB::OP( DB_.OP("venue",ORM::EQ,Empty),
|
||||
@@ -96,7 +98,7 @@ namespace OpenWifi{
|
||||
} else if (QB_.CountOnly) {
|
||||
auto C = DB_.Count();
|
||||
return ReturnCountOnly(C);
|
||||
} else if (GetBoolParameter("rrmOnly",false)) {
|
||||
} else if (GetBoolParameter("rrmOnly")) {
|
||||
Types::UUIDvec_t DeviceList;
|
||||
DB_.GetRRMDeviceList(DeviceList);
|
||||
if(QB_.CountOnly)
|
||||
|
||||
@@ -1809,14 +1809,14 @@ namespace OpenWifi {
|
||||
return std::stoull(Hint->second);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool GetBoolParameter(const std::string &Name, bool Default) {
|
||||
[[nodiscard]] inline bool GetBoolParameter(const std::string &Name, bool Default=false) {
|
||||
auto Hint = std::find_if(begin(Parameters_),end(Parameters_),[Name](const std::pair<std::string,std::string> &S){ return S.first==Name; });
|
||||
if(Hint==end(Parameters_) || !is_bool(Hint->second))
|
||||
return Default;
|
||||
return Hint->second=="true";
|
||||
}
|
||||
|
||||
[[nodiscard]] inline std::string GetParameter(const std::string &Name, const std::string &Default) {
|
||||
[[nodiscard]] inline std::string GetParameter(const std::string &Name, const std::string &Default="") {
|
||||
auto Hint = std::find_if(begin(Parameters_),end(Parameters_),[Name](const std::pair<std::string,std::string> &S){ return S.first==Name; });
|
||||
if(Hint==end(Parameters_))
|
||||
return Default;
|
||||
|
||||
Reference in New Issue
Block a user