Skip to content

Commit

Permalink
feat: add transactional to member
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jul 24, 2024
1 parent 8b32eed commit 820fd84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import kr.mafoo.user.util.NicknameGenerator;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

Expand All @@ -41,6 +42,7 @@ public class AuthService {
private final ObjectMapper objectMapper;


@Transactional
public Mono<AuthToken> loginWithKakao(String code) {
return getKakaoTokenWithCode(code)
.flatMap(this::getUserInfoWithKakaoToken)
Expand All @@ -52,6 +54,7 @@ public Mono<AuthToken> loginWithKakao(String code) {
));
}

@Transactional
public Mono<AuthToken> loginWithApple(String identityToken) {
return getApplePublicKeys()
.flatMap(keyObj -> getUserInfoWithAppleAccessToken(keyObj.keys(), identityToken))
Expand All @@ -63,6 +66,7 @@ public Mono<AuthToken> loginWithApple(String identityToken) {
));
}

@Transactional
public Mono<AuthToken> loginWithRefreshToken(String refreshToken){
return Mono
.fromCallable(() -> jwtTokenService.extractUserIdFromRefreshToken(refreshToken))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import kr.mafoo.user.util.IdGenerator;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import reactor.core.publisher.Mono;

@RequiredArgsConstructor
Expand All @@ -23,6 +24,7 @@ public Mono<MemberEntity> getMemberByMemberId(String memberId) {
.switchIfEmpty(Mono.error(new MemberNotFoundException()));
}

@Transactional
public Mono<MemberEntity> createNewMember(String username, String profileImageUrl) {
MemberEntity memberEntity = MemberEntity.newMember(IdGenerator.generate(), username, profileImageUrl);
return memberRepository.save(memberEntity);
Expand Down

0 comments on commit 820fd84

Please sign in to comment.