Conversation
| @@ -26,14 +27,18 @@ public ProductResponse setProductSize(int id, String size) { | |||
| } | |||
|
|
|||
| public ProductResponse setProductImage(int id, MultipartFile file) { | |||
There was a problem hiding this comment.
what happens if the file is null? No exception handling exist in this method.
| new TypeReference<Map<String, Object>>() {})); | ||
| } | ||
| } catch (Exception e) { | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
why is logging better than throwing exception error ?
| logger.warning("Bucket connection skipped: " + e.getMessage()); | ||
| } | ||
|
|
||
| return "https://s3.eu-central-003.backblazeb2.com/file/" + bucket + "/" + key; |
There was a problem hiding this comment.
https://s3.eu-central-003.backblazeb2.com/file/ can be a constant.
There was a problem hiding this comment.
Extracting that URL into a constant (e.g. BASE_STORAGE_URL) helps because:
Single source of truth — if the bucket or region changes, you update one place, not hunt through 15 files
Readability — BASE_STORAGE_URL + path is clearer than a raw URL blob
Typo prevention — one misspelled character in a pasted URL is hard to spot; a misspelled constant name throws an error immediately
There was a problem hiding this comment.
oh ! good to know that, thank you so much 🙏
Description
I have finished all three tasks for this assignment. The app runs smoothly, the endpoints work in Postman.
Changes
📝 Task 1: Setup
pom.xmlfile.🎨 Task 2: JSONB and Product Queries
detailsfield to the Product code so it shows up in requests.📁 Task 3: Image Upload & Delete
FileServiceto handle uploading and deleting images.S6242).ProductControllerto accept file uploads properly.null).Everything compiles and runs perfectly.
I fixed the PR issue by rebasing onto the correct repository. The code is all ready for review now!