Interface CommentService

All Known Implementing Classes:
CommentServiceImpl

public interface CommentService
Service for comment-related business operations.
  • Method Details

    • getCommentsByPostId

      List<CommentEntity> getCommentsByPostId(Long postId)
      Retrieves all comments associated with a specific post.
      Parameters:
      postId - the ID of the post
      Returns:
      list of comments for the post
    • createComment

      CommentDTO createComment(Long postId, Long userId, CommentWriteRequestDTO requestDTO)
      Creates a new comment on a specific post. Validates post and user existence, saves the comment, and returns the created comment.
      Parameters:
      postId - the ID of the post to comment on
      userId - the ID of the user creating the comment
      requestDTO - request containing the comment content
      Returns:
      newly created comment as DTO
    • deleteCommentById

      void deleteCommentById(Long commentId)
      Deletes a comment by its ID. Removes the comment from the database.
      Parameters:
      commentId - the ID of the comment to delete
    • updateCommentById

      CommentDTO updateCommentById(Long commentId, CommentWriteRequestDTO requestDTO)
      Updates a comment by its ID with new content. Marks the comment as edited and persists the changes.
      Parameters:
      commentId - the ID of the comment to update
      requestDTO - request containing the updated comment content
      Returns:
      updated comment as DTO