From 2841d3d96f2ade46d14d13bf7fa605b959f037c3 Mon Sep 17 00:00:00 2001 From: 5uhwann <5uhwann27@gmail.com> Date: Sun, 17 Sep 2023 17:53:34 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../out/persistence/FindMajorPersistenceAdapter.java | 6 +++--- ...ajorRepository.java => MajorLectureRepository.java} | 2 +- ...sitoryTest.java => MajorLectureRepositoryTest.java} | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) rename src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/repository/{MajorRepository.java => MajorLectureRepository.java} (85%) rename src/test/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/{MajorRepositoryTest.java => MajorLectureRepositoryTest.java} (81%) diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/FindMajorPersistenceAdapter.java b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/FindMajorPersistenceAdapter.java index b55e8147..ff5eecba 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/FindMajorPersistenceAdapter.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/FindMajorPersistenceAdapter.java @@ -4,7 +4,7 @@ import java.util.stream.Collectors; import com.plzgraduate.myongjigraduatebe.core.meta.PersistenceAdapter; -import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.MajorRepository; +import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.MajorLectureRepository; import com.plzgraduate.myongjigraduatebe.lecture.application.port.out.FindMajorPort; import com.plzgraduate.myongjigraduatebe.lecture.domain.model.MajorLecture; import com.plzgraduate.myongjigraduatebe.user.domain.model.User; @@ -15,12 +15,12 @@ @RequiredArgsConstructor class FindMajorPersistenceAdapter implements FindMajorPort { - private final MajorRepository majorRepository; + private final MajorLectureRepository majorLectureRepository; private final LectureMapper mapper; @Override public Set findMajor(User user) { - return majorRepository.findAllByMajor(user.getMajor()).stream() + return majorLectureRepository.findAllByMajor(user.getMajor()).stream() .map(mapper::mapToMajorLectureModel) .collect(Collectors.toSet()); } diff --git a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/repository/MajorRepository.java b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/repository/MajorLectureRepository.java similarity index 85% rename from src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/repository/MajorRepository.java rename to src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/repository/MajorLectureRepository.java index ccc067c6..2df093b0 100644 --- a/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/repository/MajorRepository.java +++ b/src/main/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/repository/MajorLectureRepository.java @@ -8,7 +8,7 @@ import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.MajorLectureJpaEntity; -public interface MajorRepository extends JpaRepository { +public interface MajorLectureRepository extends JpaRepository { @Query("select m from MajorLectureJpaEntity m join fetch m.lectureJpaEntity where m.major = :major") List findAllByMajor(@Param("major") String major); diff --git a/src/test/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/MajorRepositoryTest.java b/src/test/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/MajorLectureRepositoryTest.java similarity index 81% rename from src/test/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/MajorRepositoryTest.java rename to src/test/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/MajorLectureRepositoryTest.java index f7c002ee..52da8e03 100644 --- a/src/test/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/MajorRepositoryTest.java +++ b/src/test/java/com/plzgraduate/myongjigraduatebe/lecture/adapter/out/persistence/MajorLectureRepositoryTest.java @@ -11,15 +11,15 @@ import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.LectureJpaEntity; import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.MajorLectureJpaEntity; import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.LectureRepository; -import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.MajorRepository; +import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.repository.MajorLectureRepository; import com.plzgraduate.myongjigraduatebe.support.PersistenceTestSupport; -class MajorRepositoryTest extends PersistenceTestSupport { +class MajorLectureRepositoryTest extends PersistenceTestSupport { @Autowired private LectureRepository lectureRepository; @Autowired - private MajorRepository majorRepository; + private MajorLectureRepository majorLectureRepository; @DisplayName("유저의 전공에 해당하는 전공 과목을 조회한다.") @@ -37,12 +37,12 @@ void findAllByMajor() { MajorLectureJpaEntity majorLectureJpaEntityB = MajorLectureJpaEntity.builder() .lectureJpaEntity(lectureJpaEntity) .major("데이터테크놀로지").build(); - majorRepository.saveAll(List.of(majorLectureJpaEntityA, majorLectureJpaEntityB)); + majorLectureRepository.saveAll(List.of(majorLectureJpaEntityA, majorLectureJpaEntityB)); String major = "응용소프트웨어"; //when - List majorLectures = majorRepository.findAllByMajor(major); + List majorLectures = majorLectureRepository.findAllByMajor(major); //then assertThat(majorLectures).hasSize(1)