From a5e61a476e88b961df7e425dce7b9ce82b705fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pol=20Escol=C3=A0=20Curc=C3=B3?= Date: Thu, 22 Feb 2024 15:48:42 +0100 Subject: [PATCH 1/3] Added relation --- .../udl/eps/softarch/demo/domain/SocialNetworks.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java b/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java index 73f21077..32281604 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java @@ -1,9 +1,5 @@ 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 lombok.Data; import lombok.EqualsAndHashCode; @@ -16,4 +12,8 @@ public class SocialNetworks extends UriEntity { Long id; String instagram; String twitter; + + @ManyToOne + Shelter belongsTo; + } From 8b50bde940955d4dd2cfa9632a3408e9e6f9dfaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pol=20Escol=C3=A0=20Curc=C3=B3?= Date: Thu, 22 Feb 2024 15:55:31 +0100 Subject: [PATCH 2/3] Merged main into --- .../cat/udl/eps/softarch/demo/domain/SocialNetworks.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java b/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java index 32281604..0247239d 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/SocialNetworks.java @@ -9,11 +9,11 @@ public class SocialNetworks extends UriEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) - Long id; - String instagram; - String twitter; + private Long id; + private String instagram; + private String twitter; @ManyToOne - Shelter belongsTo; + public Shelter belongsTo; } From 63340ec49f514971c802821beef4a9f34b71af5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pol=20Escol=C3=A0=20Curc=C3=B3?= Date: Thu, 22 Feb 2024 16:08:32 +0100 Subject: [PATCH 3/3] repository created --- .../demo/repository/SocialNetworksRepository.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/main/java/cat/udl/eps/softarch/demo/repository/SocialNetworksRepository.java diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/SocialNetworksRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/SocialNetworksRepository.java new file mode 100644 index 00000000..1eef3cda --- /dev/null +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/SocialNetworksRepository.java @@ -0,0 +1,10 @@ +package cat.udl.eps.softarch.demo.repository; + +import cat.udl.eps.softarch.demo.domain.SocialNetworks; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource +public interface SocialNetworksRepository extends CrudRepository { + +}