Skip to content

Commit

Permalink
Merge pull request #39 from UdL-EPS-SoftArch/search-cats-dogs
Browse files Browse the repository at this point in the history
Added missing functions to search cats and dogs by name and chip
  • Loading branch information
rogargon authored May 19, 2024
2 parents 656be6d + 068bfd3 commit b6a740e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
import cat.udl.eps.softarch.demo.domain.Cat;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.List;

@RepositoryRestResource
public interface CatRepository extends CrudRepository<Cat, Long>, PagingAndSortingRepository<Cat, Long> {

List<Cat> findByName(@Param("name") String name);
List<Cat> findByChip(@Param("chip") String chip);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
import cat.udl.eps.softarch.demo.domain.Dog;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.List;

@RepositoryRestResource
public interface DogRepository extends CrudRepository<Dog, Long>, PagingAndSortingRepository<Dog, Long> {

List<Dog> findByName(@Param("name") String name);
List<Dog> findByChip(@Param("chip") String chip);

}

0 comments on commit b6a740e

Please sign in to comment.