update backend

Signed-off-by: Peter Siegmund <peter@rdkr.com>
This commit is contained in:
Peter Siegmund
2024-05-31 11:36:21 +02:00
parent 4ef60ec997
commit 535ff6cb4b
2 changed files with 15 additions and 8 deletions

View File

@@ -22,15 +22,22 @@ public class Firmware {
private String eTag;
private int flashSize;
private String espIdf;
private String compiled;
private OffsetDateTime lastModified;
private FirmwareMeta meta;
public String getVersion() {
return String.format("%d.%d.%d", major, minor, patch);
}
@Getter
@AllArgsConstructor
public static class FirmwareMeta {
private int flashSize;
private String espIdf;
private String compiled;
}
}

View File

@@ -48,9 +48,9 @@ public class StorageServiceImpl implements StorageService {
int major = Integer.parseInt(version[0]);
int minor = Integer.parseInt(version[1]);
int patch = Integer.parseInt(version[2]);
val meta = new Firmware.FirmwareMeta(flashSize, espIdf, compiled);
result.add(
new Firmware(major, minor, patch, "/files/" + major + "." + minor + "." + patch + "/firmware.bin",
file.getEtag(), flashSize, espIdf, compiled, file.getUpdateTimeOffsetDateTime()));
new Firmware(major, minor, patch, "/files/" + major + "." + minor + "." + patch + "/firmware.bin", file.getEtag(), file.getUpdateTimeOffsetDateTime(), meta));
}
}
}