dev add code respone for download files
Test Workflow / test (push) Successful in 4s

This commit is contained in:
vladp
2026-02-16 10:43:20 +07:00
parent f15a24acc2
commit 7a02b94bd0
2 changed files with 6 additions and 6 deletions
@@ -300,12 +300,10 @@ public class ApiController {
if (tokenHeader == null) { if (tokenHeader == null) {
Map<String, Object> errorData = new HashMap<>(); Map<String, Object> errorData = new HashMap<>();
errorData.put("token", tokenHeader); errorData.put("token", tokenHeader);
errorData.put("fileId", fileId);
errorData.put("version", version);
return ResponseEntity.ok().body(new BaseResponse(20004, return ResponseEntity.ok().body(new BaseResponse(20004,
MessageCode.FILE_DOWNLOAD_ERROR_NOT_CORRECT_FIELD.getCode(), MessageCode.TOKEN_IS_NULL.getCode(),
MessageCode.FILE_DOWNLOAD_ERROR_NOT_CORRECT_FIELD.getDescription(), MessageCode.TOKEN_IS_NULL.getDescription(),
errorData)); errorData));
} }
@@ -317,8 +315,8 @@ public class ApiController {
errorData.put("token", tokenHeader); errorData.put("token", tokenHeader);
return ResponseEntity.ok().body(new BaseResponse(20004, return ResponseEntity.ok().body(new BaseResponse(20004,
MessageCode.FILE_DOWNLOAD_ERROR.getCode(), MessageCode.USER_NOT_HAD_PERMISSION.getCode(),
MessageCode.FILE_DOWNLOAD_ERROR.getDescription(), MessageCode.USER_NOT_HAD_PERMISSION.getDescription(),
errorData)); errorData));
} }
@@ -12,10 +12,12 @@ public enum MessageCode {
FILE_UPLOAD_ERROR(2, "File upload error"), FILE_UPLOAD_ERROR(2, "File upload error"),
DUPLICATE_FILE_UPLOAD(2, "Duplicate file upload"), DUPLICATE_FILE_UPLOAD(2, "Duplicate file upload"),
FILE_DOWNLOAD_ERROR(2, "File download error"), FILE_DOWNLOAD_ERROR(2, "File download error"),
USER_NOT_HAD_PERMISSION(2, "User not have permission for file"),
USER_NOT_VERIFIED(2, "User not verified"), USER_NOT_VERIFIED(2, "User not verified"),
PERMISSION_NOT_FOUND(2, "Permission not found"), PERMISSION_NOT_FOUND(2, "Permission not found"),
USER_NOT_FOUND(2, "User not found"), USER_NOT_FOUND(2, "User not found"),
FILE_DOWNLOAD_ERROR_NOT_CORRECT_FIELD(2, "Not correct field"), FILE_DOWNLOAD_ERROR_NOT_CORRECT_FIELD(2, "Not correct field"),
TOKEN_IS_NULL(2, "Token field is null"),
IMAGE_FOUND_ERROR(2, "Image found error"), IMAGE_FOUND_ERROR(2, "Image found error"),
INVALID_JSON_BODY(2, "Invalid fields in JSON object"), INVALID_JSON_BODY(2, "Invalid fields in JSON object"),
INCOMPLETE_UPLOAD(2, "Not load all chunks"), INCOMPLETE_UPLOAD(2, "Not load all chunks"),