feat: content query 추가
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.example.contentquery.service;
|
||||
|
||||
import com.example.contentquery.repository.Content;
|
||||
import com.example.contentquery.repository.ContentQueryRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ContentQueryService {
|
||||
|
||||
private final ContentQueryRepository contentQueryRepository;
|
||||
|
||||
public Content findByPostId(Long contentId) {
|
||||
return contentQueryRepository.findByContentId(contentId).orElseThrow(
|
||||
() -> new RuntimeException("해당 게시글이 존재하지 않습니다.")
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user