mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-30 18:18:03 +00:00
Finishing DB refactor.
This commit is contained in:
@@ -12,23 +12,8 @@
|
||||
namespace OpenWifi{
|
||||
void RESTAPI_managementPolicy_list_handler::DoGet() {
|
||||
if(!QB_.Select.empty()) {
|
||||
auto DevUUIDS = Utils::Split(QB_.Select);
|
||||
Poco::JSON::Array ObjArr;
|
||||
for(const auto &i:DevUUIDS) {
|
||||
ProvObjects::ManagementPolicy E;
|
||||
if(StorageService()->PolicyDB().GetRecord("id",i,E)) {
|
||||
Poco::JSON::Object Obj;
|
||||
E.to_json(Obj);
|
||||
if(QB_.AdditionalInfo)
|
||||
AddManagementPolicyExtendedInfo(E, Obj);
|
||||
ObjArr.add(Obj);
|
||||
} else {
|
||||
return BadRequest(RESTAPI::Errors::UnknownId + "(" + i + ")");
|
||||
}
|
||||
}
|
||||
Poco::JSON::Object Answer;
|
||||
Answer.set("managementPolicies", ObjArr);
|
||||
return ReturnObject(Answer);
|
||||
return ReturnRecordList<decltype(StorageService()->PolicyDB()),
|
||||
ProvObjects::ManagementPolicy>("managementPolicies",StorageService()->PolicyDB(),*this );
|
||||
} else if(QB_.CountOnly) {
|
||||
Poco::JSON::Object Answer;
|
||||
auto C = StorageService()->ContactDB().Count();
|
||||
@@ -36,7 +21,7 @@ namespace OpenWifi{
|
||||
} else {
|
||||
ProvObjects::ManagementPolicyVec Policies;
|
||||
StorageService()->PolicyDB().GetRecords(QB_.Offset,QB_.Limit,Policies);
|
||||
return ReturnObject("managementPolicies", Policies);
|
||||
return MakeJSONObjectArray("managementPolicies", Policies, *this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user