-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [refac] apply code review * [refac] apply code review * [refac] apply code review
- Loading branch information
Showing
18 changed files
with
191 additions
and
119 deletions.
There are no files selected for viewing
Submodule server-yml
updated
from a7d6b4 to 45868e
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
37 changes: 37 additions & 0 deletions
37
src/main/java/org/hankki/hankkiserver/api/auth/service/UserFinder.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.hankki.hankkiserver.api.auth.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.common.code.ErrorCode; | ||
import org.hankki.hankkiserver.common.exception.EntityNotFoundException; | ||
import org.hankki.hankkiserver.domain.user.model.Platform; | ||
import org.hankki.hankkiserver.domain.user.model.User; | ||
import org.hankki.hankkiserver.domain.user.repository.UserRepository; | ||
import org.hankki.hankkiserver.external.openfeign.dto.SocialInfoDto; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Optional; | ||
|
||
import static org.hankki.hankkiserver.domain.user.model.MemberStatus.ACTIVE; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class UserFinder { | ||
|
||
private final UserRepository userRepository; | ||
|
||
public User getUser(final long userId) { | ||
return userRepository.findById(userId) | ||
.orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_NOT_FOUND)); | ||
} | ||
|
||
public boolean isRegisteredUser(final Platform platform, final SocialInfoDto socialInfo) { | ||
return userRepository.existsByPlatformAndSerialIdAndMemberStatus( | ||
platform, | ||
socialInfo.serialId(), | ||
ACTIVE); | ||
} | ||
|
||
public Optional<User> findUserByPlatFormAndSeralId(final Platform platform, final String serialId) { | ||
return userRepository.findByPlatformAndSerialId(platform, serialId); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoDeleter.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.hankki.hankkiserver.api.auth.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.domain.user.repository.UserInfoRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class UserInfoDeleter { | ||
|
||
private final UserInfoRepository userInfoRepository; | ||
|
||
public void softDelete(final long userId) { | ||
userInfoRepository.softDeleteByUserId(userId); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoFinder.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.hankki.hankkiserver.api.auth.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.common.code.ErrorCode; | ||
import org.hankki.hankkiserver.common.exception.EntityNotFoundException; | ||
import org.hankki.hankkiserver.domain.user.model.UserInfo; | ||
import org.hankki.hankkiserver.domain.user.repository.UserInfoRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class UserInfoFinder { | ||
|
||
private final UserInfoRepository userInfoRepository; | ||
|
||
public UserInfo getUserInfo(final long userId) { | ||
return userInfoRepository.findByUserId(userId) | ||
.orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_INFO_NOT_FOUND)); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoSaver.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.hankki.hankkiserver.api.auth.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.domain.user.model.UserInfo; | ||
import org.hankki.hankkiserver.domain.user.repository.UserInfoRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class UserInfoSaver { | ||
|
||
private final UserInfoRepository userInfoRepository; | ||
|
||
public void saveUserInfo(final UserInfo userInfo) { | ||
userInfoRepository.save(userInfo); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/hankki/hankkiserver/api/auth/service/UserSaver.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.hankki.hankkiserver.api.auth.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.domain.user.model.User; | ||
import org.hankki.hankkiserver.domain.user.repository.UserRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class UserSaver { | ||
|
||
private final UserRepository userRepository; | ||
|
||
public void saveUser(final User user) { | ||
userRepository.save(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
Oops, something went wrong.