mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-02 11:37:54 +00:00
Merge pull request #96 from kinarasystems/wifi_13523_fix_resource_request_link_in_post
WIFI-13523: Fix: Support linking of resources and configs through POST request. (#5)
This commit is contained in:
@@ -140,7 +140,22 @@ namespace OpenWifi {
|
||||
return BadRequest(RESTAPI::Errors::ConfigBlockInvalid);
|
||||
}
|
||||
|
||||
Types::UUIDvec_t ToVariables;
|
||||
if (RawObject->has("variables")) {
|
||||
for (const auto &i : NewObject.variables) {
|
||||
if (!i.empty() && !StorageService()->VariablesDB().Exists("id", i)) {
|
||||
return BadRequest(RESTAPI::Errors::VariableMustExist);
|
||||
}
|
||||
}
|
||||
for (const auto &i : NewObject.variables)
|
||||
ToVariables.emplace_back(i);
|
||||
|
||||
ToVariables = NewObject.variables;
|
||||
}
|
||||
|
||||
if (DB_.CreateRecord(NewObject)) {
|
||||
AddMembership(StorageService()->VariablesDB(),
|
||||
&ProvObjects::VariableBlock::configurations, ToVariables, NewObject.info.id);
|
||||
MoveUsage(StorageService()->PolicyDB(), DB_, "", NewObject.managementPolicy,
|
||||
NewObject.info.id);
|
||||
AddMembership(StorageService()->VenueDB(), &ProvObjects::Venue::configurations,
|
||||
|
||||
Reference in New Issue
Block a user