Class ApprovedPostService

java.lang.Object
io.github.yvasyliev.telegramforwarderbot.service.ApprovedPostService

@Service public class ApprovedPostService extends Object
Service for managing approved posts. Provides methods to save, poll, and delete approved posts.
  • Constructor Details

    • ApprovedPostService

      public ApprovedPostService()
  • Method Details

    • save

      @Transactional public ApprovedPost save(List<Integer> messageIds, boolean removeCaption)
      Saves an approved post with the given message IDs and caption removal flag.
      Parameters:
      messageIds - the list of message IDs to associate with the approved post.
      removeCaption - flag indicating whether to remove the caption from the post.
      Returns:
      the saved ApprovedPost entity.
    • poll

      @Transactional public Optional<ApprovedPost> poll()
      Polls the first approved post ordered by the approval timestamp. If an approved post is found, it is deleted from the repository.
      Returns:
      an Optional containing the polled approved post, or empty if none found.
    • delete

      @Transactional public List<ApprovedPost> delete(List<Integer> messageIds)
      Deletes approved posts that contain any of the specified message IDs.
      Parameters:
      messageIds - a list of message IDs to search for.
      Returns:
      a list of ApprovedPost entities that were deleted.