From f9fa2c535d2b899e0b1fbcf3c19daa3438b42b6a Mon Sep 17 00:00:00 2001 From: Codinab Date: Thu, 29 Feb 2024 15:54:10 +0100 Subject: [PATCH 1/3] Added relations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Mario Fernandez -Àlex Codina --- .../cat/udl/eps/softarch/demo/domain/Adoption.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java index 3ba3a166..ea011d1c 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java @@ -1,11 +1,7 @@ package cat.udl.eps.softarch.demo.domain; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import jakarta.persistence.*; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; @@ -23,7 +19,7 @@ public class Adoption extends UriEntity { @NotBlank private String type; - @NotNull + @NotBlank private Boolean confirmed; @NotBlank @@ -31,4 +27,10 @@ public class Adoption extends UriEntity { private ZonedDateTime endDate; + + @ManyToOne + private User user; //Adopter + + @ManyToOne + private Pet pet; } From dd7656cbd51cb1e88bfee933dd8e0cbba16a42c2 Mon Sep 17 00:00:00 2001 From: Codinab Date: Thu, 7 Mar 2024 15:23:22 +0100 Subject: [PATCH 2/3] Boolean not null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Mario Fernandez -Àlex Codina --- src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java index ea011d1c..835d08f8 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java @@ -2,6 +2,7 @@ import jakarta.persistence.*; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; @@ -19,7 +20,7 @@ public class Adoption extends UriEntity { @NotBlank private String type; - @NotBlank + @NotNull private Boolean confirmed; @NotBlank From bef1ce2a5b6e0e6c03fe73fb68a6b99d858f03fe Mon Sep 17 00:00:00 2001 From: Codinab Date: Thu, 7 Mar 2024 15:27:10 +0100 Subject: [PATCH 3/3] ZonedDateTime NotNull MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Mario Fernandez -Àlex Codina --- src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java index 835d08f8..ff6f357e 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoption.java @@ -23,7 +23,7 @@ public class Adoption extends UriEntity { @NotNull private Boolean confirmed; - @NotBlank + @NotNull private ZonedDateTime startDate;