Interface PostRepositoryAdapter

All Known Implementing Classes:
PostRepositoryAdapterImpl

public interface PostRepositoryAdapter
Adapter for post repository operations with exception handling.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deleteById(Long postId)
    Deletes a post by its ID with exception translation.
    boolean
    existsById(long postId)
    Checks if a post exists by its ID.
    boolean
    existsByIdAndAuthorId(long postId, long authorId)
    Checks if a post exists by its ID and author ID.
    findByAuthorId(long userId)
    Retrieves all posts authored by the specified user with exception translation.
    findById(long postId)
    Retrieves a post by its ID with exception translation.
    Retrieves a post by its unique slug identifier with exception translation.
    save(PostEntity postEntity)
    Saves a new post entity with exception translation.
    update(PostEntity postEntity)
    Updates a post entity with exception translation.
  • Method Details

    • findByAuthorId

      List<PostEntity> findByAuthorId(long userId)
      Retrieves all posts authored by the specified user with exception translation.
      Parameters:
      userId - the ID of the author
      Returns:
      list of posts by the author
      Throws:
      FailedToFindPostsByAuthorIdException - if the repository operation fails
    • deleteById

      void deleteById(Long postId)
      Deletes a post by its ID with exception translation.
      Parameters:
      postId - the ID of the post to delete
      Throws:
      PostNotFoundException - if the post does not exist
      FailedToDeletePostException - if the repository operation fails
    • findBySlug

      PostEntity findBySlug(String slug)
      Retrieves a post by its unique slug identifier with exception translation.
      Parameters:
      slug - the unique slug of the post
      Returns:
      the post entity
      Throws:
      PostNotFoundException - if the post does not exist
    • existsById

      boolean existsById(long postId)
      Checks if a post exists by its ID.
      Parameters:
      postId - the ID of the post
      Returns:
      true if the post exists, false otherwise
    • existsByIdAndAuthorId

      boolean existsByIdAndAuthorId(long postId, long authorId)
      Checks if a post exists by its ID and author ID.
      Parameters:
      postId - the ID of the author
      authorId - the ID of the author
      Returns:
      true if the post exists and belongs to the author, false otherwise
    • findById

      PostEntity findById(long postId)
      Retrieves a post by its ID with exception translation.
      Parameters:
      postId - the ID of the post
      Returns:
      the post entity
      Throws:
      PostNotFoundException - if the post does not exist
      FailedToFindPostByIdException - if the repository operation fails
    • update

      PostEntity update(PostEntity postEntity)
      Updates a post entity with exception translation.
      Parameters:
      postEntity - the post entity to update
      Returns:
      the updated post entity
      Throws:
      FailedToUpdatePostException - if the repository operation fails
    • save

      PostEntity save(PostEntity postEntity)
      Saves a new post entity with exception translation.
      Parameters:
      postEntity - the post entity to save
      Returns:
      the saved post entity with generated ID
      Throws:
      FailedToSavePostException - if the repository operation fails