Undocumented class found JAVA-D1000
Documentation
Minor
5 months ago2 years old
Consider adding a doc comment for AdminService
 7import lombok.RequiredArgsConstructor;
 8import org.springframework.stereotype.Service;
 9
10@Service11@RequiredArgsConstructor12public class AdminService {13  private final UserRepository userRepository;14  private final PostRepository postRepository;15  public final CommentRepository commentRepository;1617  /**18   * Deletes a user and all of its posts and comments.19   *20   * @param id the UUID of the user to be deleted21   */22  public void recursiveUserDelete(UUID id) {23    userRepository24        .findById(id)25        .ifPresent(26            user -> {27              postRepository28                  .findAllByUser(user)29                  .forEach(30                      post -> {31                        commentRepository.deleteAll(commentRepository.findAllByPost(post));32                        postRepository.delete(post);33                      });34              commentRepository.deleteAll(commentRepository.findAllByUser(user));35              userRepository.delete(user);36            });37  }3839  /**40   * Deletes a post and all of its comments.41   *42   * @param id the UUID of the post to be deleted43   */44  public void recursivePostDelete(UUID id) {45    postRepository46        .findById(id)47        .ifPresent(48            post -> {49              commentRepository.deleteAll(commentRepository.findAllByPost(post));50              postRepository.delete(post);51            });52  }5354  /**55   * Deletes a comment.56   *57   * @param id the UUID of the comment to be deleted58   */59  public void deleteComment(UUID id) {60    commentRepository.deleteById(id);61  }62}