remove unused size field on File model
This commit is contained in:
@@ -46,8 +46,7 @@ public class DownloadController {
|
||||
File file = available.file();
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"name", file.getName(),
|
||||
"chunkCount", file.getChunkCount(),
|
||||
"size", file.getSize() == null ? 0 : file.getSize()));
|
||||
"chunkCount", file.getChunkCount()));
|
||||
}
|
||||
|
||||
@GetMapping("/download/{id}/chunk/{index}")
|
||||
|
||||
@@ -49,10 +49,9 @@ public class UploadController {
|
||||
@RequestParam("hash") String hash,
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("chunkCount") Integer chunkCount,
|
||||
@RequestParam("size") Long size,
|
||||
@RequestParam(required = false) Integer expiryDays,
|
||||
@RequestParam(required = false) Integer downloadLimit) {
|
||||
if (!isValidId(hash) || chunkCount == null || chunkCount < 1 || size == null || size < 0) {
|
||||
if (!isValidId(hash) || chunkCount == null || chunkCount < 1) {
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid upload metadata");
|
||||
}
|
||||
|
||||
@@ -61,7 +60,6 @@ public class UploadController {
|
||||
|
||||
File f = new File(hash, hash, name, LocalDateTime.now().plusDays(days));
|
||||
f.setChunkCount(chunkCount);
|
||||
f.setSize(size);
|
||||
f.setDownloadLimit(limit);
|
||||
fileRepository.save(f);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ public class File {
|
||||
private String path;
|
||||
private String name;
|
||||
private Integer chunkCount;
|
||||
private Long size;
|
||||
private LocalDateTime expireyDateTime;
|
||||
private Integer downloadLimit;
|
||||
@Column(columnDefinition = "integer default 0")
|
||||
@@ -49,12 +48,6 @@ public class File {
|
||||
public void setChunkCount(Integer chunkCount) {
|
||||
this.chunkCount = chunkCount;
|
||||
}
|
||||
public Long getSize() {
|
||||
return size;
|
||||
}
|
||||
public void setSize(Long size) {
|
||||
this.size = size;
|
||||
}
|
||||
public Integer getDownloadLimit() {
|
||||
return downloadLimit;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ async function encryptFile(file, chunkSize = DEFAULT_CHUNK_SIZE) {
|
||||
hash,
|
||||
base64urlKey,
|
||||
chunkCount,
|
||||
size: file.size,
|
||||
chunks: encryptedChunks(file, key, chunkCount, chunkSize)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ async function startUpload() {
|
||||
metadata.append('hash', encryptedFile.hash);
|
||||
metadata.append('name', selectedFile.name);
|
||||
metadata.append('chunkCount', encryptedFile.chunkCount);
|
||||
metadata.append('size', encryptedFile.size);
|
||||
if (expiryDays) metadata.append('expiryDays', expiryDays);
|
||||
if (downloadLimit) metadata.append('downloadLimit', downloadLimit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user