Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: auth 200 OK로 수정 #44

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ public enum ExceptionCode {
INVALID_OPTION_COUNT(400, "Invalid option count."),
INVALID_OPTION(400, "Invalid option."),
OPTION_NOT_FOUND(404, "Option does not exists."),
CART_ITEM_NOT_FOUND(404, "Cart item does not exists."),
CART_ITEM_NOT_FOUND(200, "Cart item does not exists."),
CART_NOT_FOUND(404, "Cart does not exists."),
ITEM_NOT_SAME_STORE(400, "Item is not same store."),
TOSS_PAYMENT_SUCCESS_FAIL(400, "Toss payment success fail."),
ORDER_NOT_FOUND(400, "Order does not exists."),
TOSS_PAYMENT_AMOUNT_NOT_MATCH(400, "Toss payment amount not match."),
ORDER_NOT_CURRENT(400, "Order is not current.");


private int status;
private String message;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public String jwtTest() {
*/
@GetMapping("/auth")
public UserAuthRes userAuth(@AuthenticationPrincipal CustomUserDetails userDetails) {
// 서비스 계층을 호출하여 사용자 정보를 조회합니다.
return userServiceImpl.getUserAuthByCustomUserDetails(userDetails);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ public class UserServiceImpl implements UserService {

@Override
public UserAuthRes getUserAuthByCustomUserDetails(CustomUserDetails userDetails) {

verifyUserDetails(userDetails);
return userMapper.userInfoToUserAuthRes(userDetails);

}

private void verifyUserDetails(CustomUserDetails userDetails) {
if (userDetails == null) {
throw new BusinessLogicException(ExceptionCode.USER_NOT_FOUND);
}
}

@Override
public UserInfoRes getUserInfoById(Long id) {
UserInfo userInfo = getUserInfo(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
public class UserAuthRes {
private Long id;
private String email;
private boolean isAuth;
private boolean isAdmin;
}

3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
spring.datasource.url=jdbc:mysql://localhost:3306/readyvery
#spring.datasource.url=jdbc:mysql://test.readyvery.com:33306/readyvery
spring.datasource.username=root
#spring.datasource.username=ready
spring.datasource.password=12345678
#spring.datasource.password=readyverytestuser23!
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
Expand Down