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