2424
2525@ Slf4j
2626@ Service
27- @ Transactional (readOnly = true )
2827@ RequiredArgsConstructor
2928public class ArticleService {
3029
@@ -39,6 +38,7 @@ public void saveArticleBatch(UUID userId, String fromName, String fromDomain,
3938 batchProducer .addToBatch (article );
4039 }
4140
41+ @ Transactional (readOnly = true )
4242 public ArticleListResponse getMonthlyArticleList (UUID userId , int year , int month ) {
4343 List <ArticleWithImageProjection > articleListAtYearAndMonth = articleRepository .getMonthlyArticleWithImage (
4444 userId , year , month );
@@ -54,7 +54,6 @@ public ArticleListResponse getMonthlyArticleList(UUID userId, int year, int mont
5454 return ArticleListResponse .from (getDailyArticleList (articleList ));
5555 }
5656
57- @ Transactional
5857 public Article getArticle (UUID articleId ) {
5958 Article article = articleRepository .getById (articleId ).toDomain ();
6059 if (article .checkIsUnRead ()) { // isRead가 false이면 읽기 처리 수행
@@ -64,6 +63,7 @@ public Article getArticle(UUID articleId) {
6463 return article ;
6564 }
6665
66+ @ Transactional (readOnly = true )
6767 public ArticleLikeListResponse getArticleLikeList (UUID userId ) {
6868 List <ArticleDetailResponse > articleList = articleRepository .findLikeArticleWithImage (userId )
6969 .stream ()
@@ -106,12 +106,14 @@ public Article addArticle(UUID userId, String name, String domain, String title,
106106 return articleRepository .save (article );
107107 }
108108
109+ @ Transactional
109110 public Article shareArticle (UUID articleId ) {
110111 Article article = articleRepository .getById (articleId ).toDomain ();
111112 Article sharedArticle = article .share ();
112113 return articleRepository .save (sharedArticle );
113114 }
114115
116+ @ Transactional (readOnly = true )
115117 public String getSharedUrl (UUID articleId ) {
116118 return String .format ("%s/%s" , ARTICLE_SHARE_PREFIX , articleId );
117119 }
0 commit comments