Skip to content

Commit

Permalink
Merge pull request #12 from nickchoi10/main
Browse files Browse the repository at this point in the history
fixed squeaksByUser
  • Loading branch information
nickchoi10 authored Sep 7, 2022
2 parents 63d3722 + 0b04e96 commit 1af9da0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface SqueakRepository extends JpaRepository<Squeak, Long> {
List<Squeak> findAllBySqueakerOrderById(Squeaker squeaker);
List<Squeak> findAllBySqueakerOrderByIdDesc(Optional<Squeaker> squeaker);

Squeak findSqueakById(Long id);
List<Squeak> findAllByOrderByIdDesc();
List<Squeak> findSqueaksByOrderByIdDesc();
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public List<Squeak> findSqueaksByUsername(String username) {
throw new SqueakerNotFoundException(String.format("Squeaker not found for username %s", username));
}

return squeakRepository.findSqueaksByOrderByIdDesc();
return squeakRepository.findAllBySqueakerOrderByIdDesc(maybeSqueaker);
}

public Squeak saveSqueak(Squeak squeak) {
Expand Down

0 comments on commit 1af9da0

Please sign in to comment.