Skip to content

Commit

Permalink
feat: added java doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kz44 committed Apr 23, 2024
1 parent aa9c346 commit 63a6f1b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,35 @@ public ResponseEntity<?> updateInfo(
}
}

/**
* These endpoint return with the newly uploaded profile image ID.
*
* @param file the profile image file to upload.
* @return with the newly uploaded profile image ID
* @throws IOException if an I/O error occurs while reading the file.
*/
@PostMapping("/image")
public ResponseEntity<Long> uploadProfileImage(@RequestParam("image") MultipartFile file) throws IOException {
return ResponseEntity.status(HttpStatus.CREATED).body(userService.uploadProfileImage(file));
}


/**
* These endpoint where logged-in user can delete their profile image.
*
* @param id ID unique identifier for profile image.
*/
@DeleteMapping("/image/{id}")
public void deleteProfileImage(@PathVariable Long id) {
userService.deleteProfileImage(id);
}

/**
* There endpoint where logged-in user can download profile picture by the given id.
*
* @param id ID unique identifier for profile image.
* @return the profile picture by the given id.
*/
@GetMapping("/image/{id}")
public ResponseEntity<ByteArrayResource> downloadProfileImage(@PathVariable Long id) {
Image image = userService.downloadProfileImage(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ImageService {
*
* @param file image file to upload.
* @return ID of the uploaded image.
* @throws IOException if an I/O error occurs while reading the file
* @throws IOException if an I/O error occurs while reading the file.
*/
public Long uploadImage(MultipartFile file) throws IOException {
Image newImage = Image.builder()
Expand Down

0 comments on commit 63a6f1b

Please sign in to comment.