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)