diff --git a/photo-service/src/main/java/kr/mafoo/photo/service/AlbumService.java b/photo-service/src/main/java/kr/mafoo/photo/service/AlbumService.java index a681ab1..87fb4cc 100644 --- a/photo-service/src/main/java/kr/mafoo/photo/service/AlbumService.java +++ b/photo-service/src/main/java/kr/mafoo/photo/service/AlbumService.java @@ -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; @@ -15,6 +16,7 @@ public class AlbumService { private final AlbumRepository albumRepository; + @Transactional public Mono createNewAlbum(String ownerMemberId, String albumName, AlbumType albumType) { AlbumEntity albumEntity = AlbumEntity.newAlbum(IdGenerator.generate(), albumName, albumType, ownerMemberId); return albumRepository.save(albumEntity); @@ -38,6 +40,7 @@ public Mono findByAlbumId(String albumId, String requestMemberId) { }); } + @Transactional public Mono deleteAlbumById(String albumId, String requestMemberId) { return albumRepository .findById(albumId) @@ -52,6 +55,7 @@ public Mono deleteAlbumById(String albumId, String requestMemberId) { }); } + @Transactional public Mono updateAlbumName(String albumId, String albumName, String requestMemberId) { return albumRepository .findById(albumId) @@ -66,6 +70,7 @@ public Mono updateAlbumName(String albumId, String albumName, Strin }); } + @Transactional public Mono updateAlbumType(String albumId, AlbumType albumType, String requestMemberId) { return albumRepository .findById(albumId) @@ -80,6 +85,7 @@ public Mono updateAlbumType(String albumId, AlbumType albumType, St }); } + @Transactional public Mono increaseAlbumPhotoCount(String albumId, String requestMemberId) { return albumRepository .findById(albumId) @@ -94,6 +100,7 @@ public Mono increaseAlbumPhotoCount(String albumId, String requestMemberId }); } + @Transactional public Mono decreaseAlbumPhotoCount(String albumId, String requestMemberId) { if (albumId == null) { diff --git a/photo-service/src/main/java/kr/mafoo/photo/service/PhotoService.java b/photo-service/src/main/java/kr/mafoo/photo/service/PhotoService.java index 39fcdb0..efb2c5a 100644 --- a/photo-service/src/main/java/kr/mafoo/photo/service/PhotoService.java +++ b/photo-service/src/main/java/kr/mafoo/photo/service/PhotoService.java @@ -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; @@ -21,6 +22,7 @@ public class PhotoService { private final QrService qrService; private final ObjectStorageService objectStorageService; + @Transactional public Mono createNewPhoto(String qrUrl, String requestMemberId) { return qrService .getFileFromQrUrl(qrUrl) @@ -46,6 +48,7 @@ public Flux findAllByAlbumId(String albumId, String requestMemberId }); } + @Transactional public Mono deletePhotoById(String photoId, String requestMemberId) { return photoRepository .findById(photoId) @@ -61,6 +64,7 @@ public Mono deletePhotoById(String photoId, String requestMemberId) { }); } + @Transactional public Mono updatePhotoAlbumId(String photoId, String albumId, String requestMemberId) { return photoRepository .findById(photoId)