Skip to content

Commit

Permalink
Merge pull request #49 from YAPP-Github/hotfix/#48
Browse files Browse the repository at this point in the history
hotfix: ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์— @transactional ์–ด๋…ธํ…Œ์ด์…˜ ๋‹ฌ๊ธฐ
  • Loading branch information
gmkim20713 authored Jul 24, 2024
2 parents 8b32eed + af85ae5 commit 5ea42f5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import kr.mafoo.photo.util.IdGenerator;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

Expand All @@ -15,6 +16,7 @@
public class AlbumService {
private final AlbumRepository albumRepository;

@Transactional
public Mono<AlbumEntity> createNewAlbum(String ownerMemberId, String albumName, AlbumType albumType) {
AlbumEntity albumEntity = AlbumEntity.newAlbum(IdGenerator.generate(), albumName, albumType, ownerMemberId);
return albumRepository.save(albumEntity);
Expand All @@ -38,6 +40,7 @@ public Mono<AlbumEntity> findByAlbumId(String albumId, String requestMemberId) {
});
}

@Transactional
public Mono<Void> deleteAlbumById(String albumId, String requestMemberId) {
return albumRepository
.findById(albumId)
Expand All @@ -52,6 +55,7 @@ public Mono<Void> deleteAlbumById(String albumId, String requestMemberId) {
});
}

@Transactional
public Mono<AlbumEntity> updateAlbumName(String albumId, String albumName, String requestMemberId) {
return albumRepository
.findById(albumId)
Expand All @@ -66,6 +70,7 @@ public Mono<AlbumEntity> updateAlbumName(String albumId, String albumName, Strin
});
}

@Transactional
public Mono<AlbumEntity> updateAlbumType(String albumId, AlbumType albumType, String requestMemberId) {
return albumRepository
.findById(albumId)
Expand All @@ -80,6 +85,7 @@ public Mono<AlbumEntity> updateAlbumType(String albumId, AlbumType albumType, St
});
}

@Transactional
public Mono<Void> increaseAlbumPhotoCount(String albumId, String requestMemberId) {
return albumRepository
.findById(albumId)
Expand All @@ -94,6 +100,7 @@ public Mono<Void> increaseAlbumPhotoCount(String albumId, String requestMemberId
});
}

@Transactional
public Mono<Void> decreaseAlbumPhotoCount(String albumId, String requestMemberId) {

if (albumId == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import kr.mafoo.photo.util.IdGenerator;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

Expand All @@ -21,6 +22,7 @@ public class PhotoService {
private final QrService qrService;
private final ObjectStorageService objectStorageService;

@Transactional
public Mono<PhotoEntity> createNewPhoto(String qrUrl, String requestMemberId) {
return qrService
.getFileFromQrUrl(qrUrl)
Expand All @@ -46,6 +48,7 @@ public Flux<PhotoEntity> findAllByAlbumId(String albumId, String requestMemberId
});
}

@Transactional
public Mono<Void> deletePhotoById(String photoId, String requestMemberId) {
return photoRepository
.findById(photoId)
Expand All @@ -61,6 +64,7 @@ public Mono<Void> deletePhotoById(String photoId, String requestMemberId) {
});
}

@Transactional
public Mono<PhotoEntity> updatePhotoAlbumId(String photoId, String albumId, String requestMemberId) {
return photoRepository
.findById(photoId)
Expand Down
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 5ea42f5

Please sign in to comment.