From 7010eb67f7169808e0ec9073189c85c8fb10a572 Mon Sep 17 00:00:00 2001 From: sungHeeLee <70899677+hee9841@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:48:10 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EB=9F=AC=EB=8B=9D=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=A0=80=EC=9E=A5=20=EC=8B=9C,=20=EC=B1=8C?= =?UTF-8?q?=EB=A6=B0=EC=A7=80=20=EB=AA=A8=EB=93=9C=EC=9D=BC=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0,=20=ED=95=B4=EB=8B=B9=20=EC=B1=8C=EB=A6=B0=EC=A7=80?= =?UTF-8?q?=EA=B0=80=20=EC=A1=B4=EC=9E=AC=ED=95=98=EB=8A=94=EC=A7=80=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=ED=95=98=EB=8A=94=20=ED=99=95=EC=9D=B8?= =?UTF-8?q?=ED=95=A0=20=EC=88=98=20=EC=9E=88=EA=B2=8C=20findById=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=8C=EC=A7=80=ED=86=A0=EB=A6=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#322)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dnd/runus/domain/challenge/ChallengeRepository.java | 2 ++ .../domain/challenge/ChallengeRepositoryImpl.java | 9 +++++++++ .../jpa/challenge/JpaChallengeRepository.java | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100644 src/main/java/com/dnd/runus/infrastructure/persistence/jpa/challenge/JpaChallengeRepository.java diff --git a/src/main/java/com/dnd/runus/domain/challenge/ChallengeRepository.java b/src/main/java/com/dnd/runus/domain/challenge/ChallengeRepository.java index fe090d30..07f870db 100644 --- a/src/main/java/com/dnd/runus/domain/challenge/ChallengeRepository.java +++ b/src/main/java/com/dnd/runus/domain/challenge/ChallengeRepository.java @@ -7,4 +7,6 @@ public interface ChallengeRepository { List findAllActiveChallengesWithConditions(); Optional findChallengeWithConditionsByChallengeId(long challengeId); + + Optional findById(long challengeId); } diff --git a/src/main/java/com/dnd/runus/infrastructure/persistence/domain/challenge/ChallengeRepositoryImpl.java b/src/main/java/com/dnd/runus/infrastructure/persistence/domain/challenge/ChallengeRepositoryImpl.java index 9d5880b4..bb8b0045 100644 --- a/src/main/java/com/dnd/runus/infrastructure/persistence/domain/challenge/ChallengeRepositoryImpl.java +++ b/src/main/java/com/dnd/runus/infrastructure/persistence/domain/challenge/ChallengeRepositoryImpl.java @@ -1,8 +1,11 @@ package com.dnd.runus.infrastructure.persistence.domain.challenge; +import com.dnd.runus.domain.challenge.Challenge; import com.dnd.runus.domain.challenge.ChallengeRepository; import com.dnd.runus.domain.challenge.ChallengeWithCondition; import com.dnd.runus.infrastructure.persistence.jooq.challenge.JooqChallengeRepository; +import com.dnd.runus.infrastructure.persistence.jpa.challenge.JpaChallengeRepository; +import com.dnd.runus.infrastructure.persistence.jpa.challenge.entity.ChallengeEntity; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; @@ -14,6 +17,7 @@ public class ChallengeRepositoryImpl implements ChallengeRepository { private final JooqChallengeRepository jooqChallengeRepository; + private final JpaChallengeRepository jpaChallengeRepository; @Override public List findAllActiveChallengesWithConditions() { @@ -24,4 +28,9 @@ public List findAllActiveChallengesWithConditions() { public Optional findChallengeWithConditionsByChallengeId(long challengeId) { return Optional.ofNullable(jooqChallengeRepository.findChallengeWithConditionsBy(challengeId)); } + + @Override + public Optional findById(long challengeId) { + return jpaChallengeRepository.findById(challengeId).map(ChallengeEntity::toDomain); + } } diff --git a/src/main/java/com/dnd/runus/infrastructure/persistence/jpa/challenge/JpaChallengeRepository.java b/src/main/java/com/dnd/runus/infrastructure/persistence/jpa/challenge/JpaChallengeRepository.java new file mode 100644 index 00000000..736c2acf --- /dev/null +++ b/src/main/java/com/dnd/runus/infrastructure/persistence/jpa/challenge/JpaChallengeRepository.java @@ -0,0 +1,6 @@ +package com.dnd.runus.infrastructure.persistence.jpa.challenge; + +import com.dnd.runus.infrastructure.persistence.jpa.challenge.entity.ChallengeEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface JpaChallengeRepository extends JpaRepository {}