From 6da64ee837f9fc2d2383a7c38eb923e2f36eee41 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Tue, 17 Aug 2021 10:54:16 -0700 Subject: [PATCH] Adding some fields and venues for entities. --- openapi/ow_prov.yaml | 10 +++++++++- src/RESTAPI_ProvObjects.cpp | 2 ++ src/RESTAPI_ProvObjects.h | 1 + src/storage_entity.cpp | 5 ++++- src/storage_entity.h | 1 + src/storage_inventory.cpp | 5 ++++- src/storage_inventory.h | 1 + 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/openapi/ow_prov.yaml b/openapi/ow_prov.yaml index 5589f3f..fe0c4fb 100644 --- a/openapi/ow_prov.yaml +++ b/openapi/ow_prov.yaml @@ -148,6 +148,12 @@ components: items: type: string format: uuid + venues: + description: The list of UUID of the venues for this entity + type: array + items: + type: string + format: uuid contacts: description: The list of UUID of the contacts for the entity type: array @@ -360,6 +366,8 @@ components: subVenue: type: string format: uuid + qrCode: + type: string InventoryTagList: type: object @@ -506,7 +514,7 @@ paths: schema: type: string format: uuid - example: When creating the root entity, the uuid 0000-0000-0000 must be entered. + example: When creating the root entity, the uuid 0000-0000-0000 must be entered. When creating a non-root entity, uuid must be 1 required: true requestBody: description: Information used to create the new entity diff --git a/src/RESTAPI_ProvObjects.cpp b/src/RESTAPI_ProvObjects.cpp index 9c05404..648e6b9 100644 --- a/src/RESTAPI_ProvObjects.cpp +++ b/src/RESTAPI_ProvObjects.cpp @@ -265,6 +265,7 @@ namespace OpenWifi::ProvObjects { uCentral::RESTAPI_utils::field_to_json(Obj, "subVenue", subVenue); uCentral::RESTAPI_utils::field_to_json(Obj, "subscriber", subscriber); uCentral::RESTAPI_utils::field_to_json(Obj, "deviceType", deviceType); + uCentral::RESTAPI_utils::field_to_json(Obj, "qrCode", qrCode); } bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) { @@ -277,6 +278,7 @@ namespace OpenWifi::ProvObjects { uCentral::RESTAPI_utils::field_from_json( Obj,"subVenue",subVenue); uCentral::RESTAPI_utils::field_from_json( Obj,"subscriber",subscriber); uCentral::RESTAPI_utils::field_from_json( Obj,"deviceType",deviceType); + uCentral::RESTAPI_utils::field_from_json( Obj,"qrCode",qrCode); return true; } catch(...) { diff --git a/src/RESTAPI_ProvObjects.h b/src/RESTAPI_ProvObjects.h index ab5d4fe..657f767 100644 --- a/src/RESTAPI_ProvObjects.h +++ b/src/RESTAPI_ProvObjects.h @@ -233,6 +233,7 @@ namespace OpenWifi::ProvObjects { std::string subVenue; std::string subscriber; std::string deviceType; + std::string qrCode; void to_json(Poco::JSON::Object &Obj) const; bool from_json(const Poco::JSON::Object::Ptr &Obj); diff --git a/src/storage_entity.cpp b/src/storage_entity.cpp index 9382bf5..11cb745 100644 --- a/src/storage_entity.cpp +++ b/src/storage_entity.cpp @@ -23,7 +23,8 @@ namespace OpenWifi { ORM::Field{"managers",ORM::FieldType::FT_TEXT}, ORM::Field{"contacts",ORM::FieldType::FT_TEXT}, ORM::Field{"locations",ORM::FieldType::FT_TEXT}, - ORM::Field{"managementPolicy",ORM::FieldType::FT_TEXT} + ORM::Field{"managementPolicy",ORM::FieldType::FT_TEXT}, + ORM::Field{"venues",ORM::FieldType::FT_TEXT}, }; static ORM::IndexVec EntityDB_Indexes{ @@ -51,6 +52,7 @@ template<> void ORM::DB< OpenWifi::EntityDBRecordType, OpenWifi::ProvObjects: uCentral::Types::from_string(In.get<9>(), Out.contacts); uCentral::Types::from_string(In.get<10>(), Out.locations); Out.managementPolicy = In.get<11>(); + uCentral::Types::from_string(In.get<12>(), Out.venues); } template<> void ORM::DB< OpenWifi::EntityDBRecordType, OpenWifi::ProvObjects::Entity>::Convert(OpenWifi::ProvObjects::Entity &In, OpenWifi::EntityDBRecordType &Out) { @@ -66,4 +68,5 @@ template<> void ORM::DB< OpenWifi::EntityDBRecordType, OpenWifi::ProvObjects: Out.set<9>(uCentral::Types::to_string(In.contacts)); Out.set<10>(uCentral::Types::to_string(In.locations)); Out.set<11>(In.managementPolicy); + Out.set<12>(uCentral::Types::to_string(In.venues)); } diff --git a/src/storage_entity.h b/src/storage_entity.h index 4cc049f..606029e 100644 --- a/src/storage_entity.h +++ b/src/storage_entity.h @@ -36,6 +36,7 @@ namespace OpenWifi { std::string, std::string, std::string, + std::string, std::string > EntityDBRecordType; diff --git a/src/storage_inventory.cpp b/src/storage_inventory.cpp index 641a3d9..33ca9ed 100644 --- a/src/storage_inventory.cpp +++ b/src/storage_inventory.cpp @@ -23,7 +23,8 @@ namespace OpenWifi { ORM::Field{"entity",ORM::FieldType::FT_TEXT}, ORM::Field{"subEntity",ORM::FieldType::FT_TEXT}, ORM::Field{"subVenue",ORM::FieldType::FT_TEXT}, - ORM::Field{"deviceType",ORM::FieldType::FT_TEXT} + ORM::Field{"deviceType",ORM::FieldType::FT_TEXT}, + ORM::Field{"qrcode",ORM::FieldType::FT_TEXT} }; static ORM::IndexVec InventoryDB_Indexes{ @@ -55,6 +56,7 @@ template<> void ORM::DB< OpenWifi::InventoryDBRecordType, OpenWifi::ProvObjec Out.subEntity = In.get<9>(); Out.subVenue = In.get<10>(); Out.deviceType = In.get<11>(); + Out.qrCode = In.get<11>(); } template<> void ORM::DB< OpenWifi::InventoryDBRecordType, OpenWifi::ProvObjects::InventoryTag>::Convert(OpenWifi::ProvObjects::InventoryTag &In, OpenWifi::InventoryDBRecordType &Out) { @@ -70,4 +72,5 @@ template<> void ORM::DB< OpenWifi::InventoryDBRecordType, OpenWifi::ProvObjec Out.set<9>(In.subEntity); Out.set<10>(In.subVenue); Out.set<11>(In.deviceType); + Out.set<11>(In.qrCode); } diff --git a/src/storage_inventory.h b/src/storage_inventory.h index 5dae291..44b2fb3 100644 --- a/src/storage_inventory.h +++ b/src/storage_inventory.h @@ -21,6 +21,7 @@ namespace OpenWifi { std::string, std::string, std::string, + std::string, std::string > InventoryDBRecordType;