-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Step3-kakao-tech-campus/weekly-refactor
유저, 포트폴리오 리팩토링 작업
- Loading branch information
Showing
52 changed files
with
583 additions
and
509 deletions.
There are no files selected for viewing
Binary file removed
BIN
-1.27 MB
...ing/gallery/10a0d398-cdfc-4f8e-b4a9-a7af271a894c_Crossfit_Training_GYM_16^9.jpg
Binary file not shown.
Binary file removed
BIN
-1.35 MB
...g/gallery/1ba0b185-f0c2-4f7c-a69e-313a454639cd_Crossfit_Training_GYM_margin.jpg
Binary file not shown.
Binary file removed
BIN
-1.27 MB
...ing/gallery/1fb60d99-d2c3-4f35-8a3f-17334779370d_Crossfit_Training_GYM_16^9.jpg
Binary file not shown.
Binary file removed
BIN
-1.55 MB
...-wedding/gallery/5b37fbe3-3083-4cbd-94f6-e0a595a4cf4d_Crossfit_Training_GYM.jpg
Binary file not shown.
Binary file removed
BIN
-1.35 MB
...g/gallery/77acbbe7-1dff-4613-b98f-9ef460c1a5aa_Crossfit_Training_GYM_margin.jpg
Binary file not shown.
Binary file removed
BIN
-1.55 MB
...-wedding/gallery/993db779-7c7d-4584-a0a4-f79db1ccfe91_Crossfit_Training_GYM.jpg
Binary file not shown.
Binary file removed
BIN
-1.55 MB
...-wedding/gallery/a1573eaf-699f-48db-baaa-a60601021372_Crossfit_Training_GYM.jpg
Binary file not shown.
Binary file removed
BIN
-1.35 MB
...g/gallery/d5f906c2-2f67-4de9-ad08-d0b14df87084_Crossfit_Training_GYM_margin.jpg
Binary file not shown.
Binary file removed
BIN
-1.27 MB
...ing/gallery/fcc7c177-20cb-47a9-b999-006374754723_Crossfit_Training_GYM_16^9.jpg
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
sunsu-wedding/src/main/java/com/kakao/sunsuwedding/_core/errors/GlobalValidationHandler.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 7 additions & 19 deletions
26
...wedding/src/main/java/com/kakao/sunsuwedding/_core/security/CustomUserDetailsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,26 @@ | ||
package com.kakao.sunsuwedding._core.security; | ||
|
||
import com.kakao.sunsuwedding._core.errors.BaseException; | ||
import com.kakao.sunsuwedding._core.errors.exception.Exception400; | ||
import com.kakao.sunsuwedding.user.couple.Couple; | ||
import com.kakao.sunsuwedding.user.couple.CoupleJPARepository; | ||
import com.kakao.sunsuwedding.user.planner.Planner; | ||
import com.kakao.sunsuwedding.user.planner.PlannerJPARepository; | ||
import com.kakao.sunsuwedding.user.base_user.User; | ||
import com.kakao.sunsuwedding.user.base_user.UserJPARepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.security.core.userdetails.UserDetailsService; | ||
import org.springframework.security.core.userdetails.UsernameNotFoundException; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Optional; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class CustomUserDetailsService implements UserDetailsService { | ||
|
||
private final PlannerJPARepository plannerJPARepository; | ||
private final CoupleJPARepository coupleJPARepository; | ||
private final UserJPARepository userJPARepository; | ||
|
||
@Override | ||
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { | ||
Optional<Planner> plannerOP = plannerJPARepository.findByEmail(email); | ||
Optional<Couple> coupleOP = coupleJPARepository.findByEmail(email); | ||
|
||
Planner plannerPS = plannerOP.orElse(null); | ||
Couple couplePS = coupleOP.orElse(null); | ||
|
||
// 잘못된 email (플래너도 아니고, 예비 부부도 아님) | ||
if (plannerPS == null && couplePS == null) | ||
throw new Exception400(BaseException.USER_NOT_FOUND.getMessage()); | ||
User user = userJPARepository.findByEmailNative(email).orElseThrow( | ||
() -> new UsernameNotFoundException(BaseException.USER_EMAIL_NOT_FOUND.getMessage()) | ||
); | ||
|
||
return new CustomUserDetails(plannerPS, couplePS); | ||
return new CustomUserDetails(user); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.