mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralfms.git
synced 2025-11-03 12:18:00 +00:00
Reword with microservice arch.
This commit is contained in:
@@ -31,29 +31,39 @@ namespace uCentral {
|
||||
|
||||
// special cases: if latestOnly and deviceType
|
||||
if(HasParameter("latestOnly") && HasParameter("deviceType")) {
|
||||
bool LatestOnly = GetParameter("LatestOnly",false);
|
||||
std::cout << __LINE__ << std::endl;
|
||||
bool LatestOnly = GetParameter("latestOnly",false);
|
||||
std::cout << __LINE__ << std::endl;
|
||||
|
||||
// Let's find the ID of the latest
|
||||
if(LatestOnly) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
auto FirmwareId = LatestFirmwareCache()->FindLatestFirmware(DeviceType);
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if(FirmwareId.empty()) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
NotFound(Request, Response);
|
||||
return;
|
||||
}
|
||||
|
||||
FMSObjects::Firmware F;
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if(Storage()->GetFirmware(FirmwareId,F)) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
Poco::JSON::Object Answer;
|
||||
F.to_json(Answer);
|
||||
ReturnObject(Request, Answer, Response);
|
||||
return;
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
NotFound(Request, Response);
|
||||
return;
|
||||
} else {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
std::vector<FMSObjects::Firmware> List;
|
||||
if (uCentral::Storage()->GetFirmwares(QB_.Offset, QB_.Limit, DeviceType, List)) {
|
||||
if (Storage()->GetFirmwares(QB_.Offset, QB_.Limit, DeviceType, List)) {
|
||||
Poco::JSON::Array ObjectArray;
|
||||
std::cout << __LINE__ << std::endl;
|
||||
for (const auto &i:List) {
|
||||
Poco::JSON::Object Obj;
|
||||
i.to_json(Obj);
|
||||
|
||||
Reference in New Issue
Block a user