Reword with microservice arch.

This commit is contained in:
stephb9959
2021-07-13 23:14:23 -07:00
parent 93b018b1a8
commit a724f96d24

View File

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