diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ApplicantController.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ApplicantController.java index d0a85f67..183fb686 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ApplicantController.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/controller/ApplicantController.java @@ -52,4 +52,11 @@ public Member getMyDetails(Long id){ return service.getDetails(authenticatedUser.getId()); } + + @PutMapping("/update/{newProfilePicture}") + public Member updateProfileAvatar(@PathVariable String newProfilePicture){ + var applicant = CurrentUserUtil.getCurrentUser(); + return service.updateAvatar(applicant.getId(), newProfilePicture); + + } } diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ApplicantService.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ApplicantService.java index 6d1ca054..34115d1f 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ApplicantService.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/ApplicantService.java @@ -14,4 +14,6 @@ public interface ApplicantService { ApplyForMeResponse getApplicationList(int pageNo, int pageSize, String sortBy, String sortDir); Member getDetails(Long id); + Member updateAvatar(Long applicantId, String newProfilePicture); + } diff --git a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ApplicantServiceImpl.java b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ApplicantServiceImpl.java index 5dfc246e..73b2bfc0 100644 --- a/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ApplicantServiceImpl.java +++ b/Apply-For-Me-Api/src/main/java/com/hydraulic/applyforme/service/impl/ApplicantServiceImpl.java @@ -111,4 +111,12 @@ public Member getDetails(Long id) { return repository.getMyDetailsById(id); } + @Override + public Member updateAvatar(Long applicantId, String newProfilePicture) { + Member applicant = repository.getMyDetailsById(applicantId); + applicant.setAvatar(newProfilePicture); + + return applicant; + } + }