From 91340330f4feb17e6f0ce296688b71b6d6c360de Mon Sep 17 00:00:00 2001 From: Sebastian Jitaru Date: Tue, 5 Mar 2024 16:20:57 +0100 Subject: [PATCH 1/3] Find by location and name --- .../udl/eps/softarch/demo/repository/ShelterRepository.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java index 556b18b0..5d65018a 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java @@ -12,6 +12,5 @@ @RepositoryRestResource public interface ShelterRepository extends CrudRepository, PagingAndSortingRepository { - List findByLocatedAt(@Param("location") Location locatedAt); - + List findByLocatedAtAndName(@Param("location") Location locatedAt, @Param("name") String name); } \ No newline at end of file From 322bd7d56016ad1a841f20f2f1146cdc6205e079 Mon Sep 17 00:00:00 2001 From: Sebastian Jitaru Date: Wed, 6 Mar 2024 18:34:57 +0100 Subject: [PATCH 2/3] Shelter value name made unique --- src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java | 1 + .../cat/udl/eps/softarch/demo/repository/ShelterRepository.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java index b6673c73..786ea081 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java @@ -24,6 +24,7 @@ public class Shelter extends UriEntity { private Long id; @NotBlank + @Column(unique = true) private String name; @NotBlank diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java index 5d65018a..631219ae 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java @@ -12,5 +12,5 @@ @RepositoryRestResource public interface ShelterRepository extends CrudRepository, PagingAndSortingRepository { - List findByLocatedAtAndName(@Param("location") Location locatedAt, @Param("name") String name); + List findByName(@Param("name") String name); } \ No newline at end of file From a0bd115f45a7541fa99264ceafe6c28ad2fbdd8e Mon Sep 17 00:00:00 2001 From: Sebastian Jitaru Date: Wed, 6 Mar 2024 18:37:17 +0100 Subject: [PATCH 3/3] Creation date and updated date made auto --- src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java index 786ea081..7fdaaf46 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java @@ -37,10 +37,12 @@ public class Shelter extends UriEntity { private String mobile; @PastOrPresent + @GeneratedValue(strategy = GenerationType.AUTO) @NotNull private ZonedDateTime createdAt; @PastOrPresent + @GeneratedValue(strategy = GenerationType.AUTO) private ZonedDateTime updatedAt; @NotNull