From fcd033169e9dcd1d80fcc07048b1525b8a66790d Mon Sep 17 00:00:00 2001 From: u-genuine Date: Fri, 19 Jan 2024 00:57:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:sparkles:=20Member,=20NangmanLetter=20Repo?= =?UTF-8?q?sitory=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umcproject/repository/MemberRepository.java | 7 +++++++ .../umcproject/repository/NangmanLetterRepository.java | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 src/main/java/aromanticcat/umcproject/repository/MemberRepository.java create mode 100644 src/main/java/aromanticcat/umcproject/repository/NangmanLetterRepository.java diff --git a/src/main/java/aromanticcat/umcproject/repository/MemberRepository.java b/src/main/java/aromanticcat/umcproject/repository/MemberRepository.java new file mode 100644 index 0000000..a3a099e --- /dev/null +++ b/src/main/java/aromanticcat/umcproject/repository/MemberRepository.java @@ -0,0 +1,7 @@ +package aromanticcat.umcproject.repository; + +import aromanticcat.umcproject.entity.Member; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface MemberRepository extends JpaRepository { +} diff --git a/src/main/java/aromanticcat/umcproject/repository/NangmanLetterRepository.java b/src/main/java/aromanticcat/umcproject/repository/NangmanLetterRepository.java new file mode 100644 index 0000000..79a52e5 --- /dev/null +++ b/src/main/java/aromanticcat/umcproject/repository/NangmanLetterRepository.java @@ -0,0 +1,7 @@ +package aromanticcat.umcproject.repository; + +import aromanticcat.umcproject.entity.NangmanLetter; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface NangmanLetterRepository extends JpaRepository { +} From 55273bf3374d1c377d834e24376dbe5018d1ceb8 Mon Sep 17 00:00:00 2001 From: u-genuine Date: Fri, 19 Jan 2024 00:58:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?:sparkles:=20NangmanLetterTests=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/NangmanLetterTests.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/java/aromanticcat/umcproject/repository/NangmanLetterTests.java diff --git a/src/test/java/aromanticcat/umcproject/repository/NangmanLetterTests.java b/src/test/java/aromanticcat/umcproject/repository/NangmanLetterTests.java new file mode 100644 index 0000000..414e229 --- /dev/null +++ b/src/test/java/aromanticcat/umcproject/repository/NangmanLetterTests.java @@ -0,0 +1,39 @@ +package aromanticcat.umcproject.repository; + +import aromanticcat.umcproject.entity.Member; +import aromanticcat.umcproject.entity.NangmanLetter; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class NangmanLetterTests { + + @Autowired + private NangmanLetterRepository nangmanLetterRepository; + + @Autowired + private MemberRepository memberRepository; + + + @Test + public void testInsertNangmanLetter(){ + + Member member1 = Member.builder() + .email("test@email.com") + .nickname("member1") + .coin(0) + .build(); + memberRepository.save(member1); + + NangmanLetter nangmanLetter = NangmanLetter.builder() + .is_public(false) + .sender_nickname("낭만적인 고양이") + .content("제 고민을 들어주세요") + .member(member1) + .build(); + NangmanLetter result = nangmanLetterRepository.save(nangmanLetter); + + System.out.println(result); + } +}