Skip to content

Commit

Permalink
[refac] use transaction annotation on method
Browse files Browse the repository at this point in the history
  • Loading branch information
kgy1008 committed Jan 12, 2025
1 parent 942052a commit 04b6559
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
@RequiredArgsConstructor
public class AuthService {

Expand All @@ -38,6 +37,7 @@ public class AuthService {
private final OAuthProviderFactory oAuthProviderFactory;
private final EventPublisher eventPublisher;

@Transactional
public UserLoginResponse login(final String token, final UserLoginRequest request) {
Platform platform = Platform.getEnumPlatformFromStringPlatform(request.platform());
SocialInfoDto socialInfo = getSocialInfo(token, platform, request.name());
Expand All @@ -48,11 +48,13 @@ public UserLoginResponse login(final String token, final UserLoginRequest reques
return UserLoginResponse.of(issuedToken, isRegistered);
}

@Transactional
public void logout(final long userId) {
UserInfo findUserInfo = userInfoFinder.getUserInfo(userId);
findUserInfo.updateRefreshToken(null);
}

@Transactional
public void withdraw(final long userId, final String code) {
User user = userFinder.getUser(userId);
Platform platform = user.getPlatform();
Expand All @@ -62,6 +64,7 @@ public void withdraw(final long userId, final String code) {
userInfoFinder.getUserInfo(userId).softDelete();
}

@Transactional
public UserReissueResponse reissue(final String refreshToken) {
Long userId = jwtProvider.getSubject(refreshToken.substring(BEARER.length()));
validateRefreshToken(refreshToken, userId);
Expand Down

0 comments on commit 04b6559

Please sign in to comment.