22 lines
666 B
Java
22 lines
666 B
Java
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("해당 게시글이 존재하지 않습니다.")
|
|
);
|
|
}
|
|
}
|