package com.guams.review.service; import com.guams.review.model.CommentRepository; import com.guams.review.model.dao.Comment; import com.guams.review.model.dao.CommentIds; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; import java.util.UUID; @Service @RequiredArgsConstructor public class CommentService { private final CommentRepository commentRepository; public Optional findById(Long id) { return commentRepository.findById(id); } public List list() { return commentRepository.findAll(); } public List getCommentsByCommentId(Long commentId) { return commentRepository.getCommentsByCommentId(commentId); } public void associateCommentToPostAndAuthor(UUID authorId, Long postId, Long commentId) { commentRepository.associateCommentToUserAndPost(authorId, postId, commentId); } public Optional getCommentIdsByCommentId(Long id) { return commentRepository.getCommentIdsByCommentId(id); } public Comment insert(Comment comment) { return commentRepository.save(comment); } }