Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

@Slf4j
@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class ArticleService {

Expand All @@ -39,6 +38,7 @@ public void saveArticleBatch(UUID userId, String fromName, String fromDomain,
batchProducer.addToBatch(article);
}

@Transactional(readOnly = true)
public ArticleListResponse getMonthlyArticleList(UUID userId, int year, int month) {
List<ArticleWithImageProjection> articleListAtYearAndMonth = articleRepository.getMonthlyArticleWithImage(
userId, year, month);
Expand All @@ -54,7 +54,6 @@ public ArticleListResponse getMonthlyArticleList(UUID userId, int year, int mont
return ArticleListResponse.from(getDailyArticleList(articleList));
}

@Transactional
public Article getArticle(UUID articleId) {
Article article = articleRepository.getById(articleId).toDomain();
if (article.checkIsUnRead()) { // isRead가 false이면 읽기 처리 수행
Expand All @@ -64,6 +63,7 @@ public Article getArticle(UUID articleId) {
return article;
}

@Transactional(readOnly = true)
public ArticleLikeListResponse getArticleLikeList(UUID userId) {
List<ArticleDetailResponse> articleList = articleRepository.findLikeArticleWithImage(userId)
.stream()
Expand Down Expand Up @@ -106,12 +106,14 @@ public Article addArticle(UUID userId, String name, String domain, String title,
return articleRepository.save(article);
}

@Transactional
public Article shareArticle(UUID articleId) {
Article article = articleRepository.getById(articleId).toDomain();
Article sharedArticle = article.share();
return articleRepository.save(sharedArticle);
}

@Transactional(readOnly = true)
public String getSharedUrl(UUID articleId) {
return String.format("%s/%s", ARTICLE_SHARE_PREFIX, articleId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public ArticleContentResponse getSharedArticle(UUID articleId) {
sharedArticle.isLike());
}

@Transactional
public ArticleContentResponse getArticle(UUID articleId) {
Article article = articleService.getArticle(articleId);
String content = s3Service.getContentAsString(article.getContentUrl());
Expand Down
Loading