Skip to content

Commit

Permalink
refactor: 클래스 명 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
5uhwann committed Sep 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent a2181d7 commit 2841d3d
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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<MajorLecture> findMajor(User user) {
return majorRepository.findAllByMajor(user.getMajor()).stream()
return majorLectureRepository.findAllByMajor(user.getMajor()).stream()
.map(mapper::mapToMajorLectureModel)
.collect(Collectors.toSet());
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

import com.plzgraduate.myongjigraduatebe.lecture.adapter.out.persistence.entity.MajorLectureJpaEntity;

public interface MajorRepository extends JpaRepository<MajorLectureJpaEntity, Long> {
public interface MajorLectureRepository extends JpaRepository<MajorLectureJpaEntity, Long> {

@Query("select m from MajorLectureJpaEntity m join fetch m.lectureJpaEntity where m.major = :major")
List<MajorLectureJpaEntity> findAllByMajor(@Param("major") String major);
Original file line number Diff line number Diff line change
@@ -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<MajorLectureJpaEntity> majorLectures = majorRepository.findAllByMajor(major);
List<MajorLectureJpaEntity> majorLectures = majorLectureRepository.findAllByMajor(major);

//then
assertThat(majorLectures).hasSize(1)

0 comments on commit 2841d3d

Please sign in to comment.