Framework update.

This commit is contained in:
stephb9959
2022-05-19 16:09:28 -07:00
parent 428639c879
commit 4abec884bf
5 changed files with 30 additions and 5 deletions

2
build
View File

@@ -1 +1 @@
124
125

View File

@@ -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:

View File

@@ -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);
}
}

View File

@@ -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)) {

View File

@@ -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_;