diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java index 4f2d28be..4d2f08f5 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java @@ -24,6 +24,7 @@ public class Pet extends UriEntity { @ManyToOne public Shelter isIn; + @ManyToMany public User[] favouritedBy; } diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java index 12af9121..f14f319f 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java @@ -1,7 +1,5 @@ package cat.udl.eps.softarch.demo.repository; - import cat.udl.eps.softarch.demo.domain.Pet; -import cat.udl.eps.softarch.demo.domain.User; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; @@ -9,7 +7,8 @@ import java.util.List; public interface PetRepository extends CrudRepository, PagingAndSortingRepository { - List findBySize(@Param("size") String size); - //List findByShelter(@Param("Shelter") Shelter shelter); + List findBySize(@Param("size") String size); + List findByName(@Param("name") String name); + //Pet findByShelter(@Param("id") Long shelterId); }