mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 17:52:28 +00:00
Framework update.
This commit is contained in:
@@ -2071,6 +2071,13 @@ paths:
|
||||
type: string
|
||||
example: serialNumber:a,created:d
|
||||
required: false
|
||||
- in: query
|
||||
description: return extended information
|
||||
name: orderSpec
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
required: false
|
||||
- in: query
|
||||
description: return the list of devices under RRM
|
||||
name: rrmOnly
|
||||
@@ -2095,6 +2102,7 @@ paths:
|
||||
- $ref: '#/components/schemas/SerialNumberList'
|
||||
- $ref: '#/components/schemas/InventoryTagList'
|
||||
- $ref: '#/components/schemas/CountAnswer'
|
||||
- $ref: '#/components/schemas/StringList'
|
||||
400:
|
||||
$ref: '#/components/responses/BadRequest'
|
||||
403:
|
||||
|
||||
@@ -662,4 +662,11 @@ namespace OpenWifi {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename DBType> void ReturnFieldList(DBType & DB, RESTAPIHandler &H) {
|
||||
Types::StringVec Fields;
|
||||
DB.GetFieldNames(Fields);
|
||||
Poco::JSON::Object Answer;
|
||||
RESTAPI_utils::field_to_json(Answer,"list",Fields);
|
||||
return H.ReturnObject(Answer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,16 @@ namespace OpenWifi{
|
||||
}
|
||||
|
||||
void RESTAPI_inventory_list_handler::DoGet() {
|
||||
std::string UUID;
|
||||
std::string Arg,Arg2;
|
||||
|
||||
if(GetBoolParameter("orderSpec")) {
|
||||
return ReturnFieldList(DB_,*this);
|
||||
}
|
||||
|
||||
bool SerialOnly=GetBoolParameter("serialOnly");
|
||||
|
||||
std::string UUID;
|
||||
std::string Arg,Arg2;
|
||||
|
||||
std::string OrderBy{" ORDER BY serialNumber ASC "};
|
||||
if(HasParameter("orderBy",Arg)) {
|
||||
if(!DB_.PrepareOrderBy(Arg,OrderBy)) {
|
||||
|
||||
@@ -688,7 +688,7 @@ namespace ORM {
|
||||
}
|
||||
if(!ItemList.empty())
|
||||
ItemList += " , ";
|
||||
auto hint = FieldNames_.find(T[0]);
|
||||
auto hint = FieldNames_.find(Poco::toLower(T[0]));
|
||||
if(hint==FieldNames_.end()) {
|
||||
return false;
|
||||
}
|
||||
@@ -898,12 +898,17 @@ namespace ORM {
|
||||
|
||||
Poco::Logger & Logger() { return Logger_; }
|
||||
|
||||
bool DeleteRecordsFromCache(const char *FieldName, const std::string &Value ) {
|
||||
inline bool DeleteRecordsFromCache(const char *FieldName, const std::string &Value ) {
|
||||
if(Cache_)
|
||||
Cache_->Delete(FieldName, Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void GetFieldNames( OpenWifi::Types::StringVec & F) {
|
||||
for(const auto &[field,_]:FieldNames_)
|
||||
F.push_back(field);
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string TableName_;
|
||||
OpenWifi::DBType Type_;
|
||||
|
||||
Reference in New Issue
Block a user