diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/apply/dto/data/RequestApplyData.java b/src/main/java/kr/co/studyhubinu/studyhubserver/apply/dto/data/RequestApplyData.java new file mode 100644 index 00000000..5129d871 --- /dev/null +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/apply/dto/data/RequestApplyData.java @@ -0,0 +1,20 @@ +package kr.co.studyhubinu.studyhubserver.apply.dto.data; + +import kr.co.studyhubinu.studyhubserver.apply.enums.Inspection; +import lombok.Getter; + +@Getter +public class RequestApplyData { + + private final Long studyId; + private final String studyTitle; + private final Inspection inspection; + private final String introduce; + + public RequestApplyData(Long studyId, String studyTitle, Inspection inspection, String introduce) { + this.studyId = studyId; + this.studyTitle = studyTitle; + this.inspection = inspection; + this.introduce = introduce; + } +} diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/apply/dto/response/FindMyRequestApplyResponse.java b/src/main/java/kr/co/studyhubinu/studyhubserver/apply/dto/response/FindMyRequestApplyResponse.java new file mode 100644 index 00000000..52ed48a7 --- /dev/null +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/apply/dto/response/FindMyRequestApplyResponse.java @@ -0,0 +1,18 @@ +package kr.co.studyhubinu.studyhubserver.apply.dto.response; + +import kr.co.studyhubinu.studyhubserver.apply.dto.data.ParticipateApplyData; +import kr.co.studyhubinu.studyhubserver.apply.dto.data.RequestApplyData; +import lombok.Getter; +import org.springframework.data.domain.Slice; + +@Getter +public class FindMyRequestApplyResponse { + + private Long totalCount; + Slice requestStudyData; + + public FindMyRequestApplyResponse(Long totalCount, Slice requestStudyData) { + this.totalCount = totalCount; + this.requestStudyData = requestStudyData; + } +} diff --git a/src/test/java/kr/co/studyhubinu/studyhubserver/apply/service/ApplyServiceIntegrationTest.java b/src/test/java/kr/co/studyhubinu/studyhubserver/apply/service/ApplyServiceIntegrationTest.java new file mode 100644 index 00000000..a81b03ee --- /dev/null +++ b/src/test/java/kr/co/studyhubinu/studyhubserver/apply/service/ApplyServiceIntegrationTest.java @@ -0,0 +1,56 @@ +package kr.co.studyhubinu.studyhubserver.apply.service; + +import kr.co.studyhubinu.studyhubserver.apply.domain.ApplyEntity; +import kr.co.studyhubinu.studyhubserver.apply.dto.data.RequestApplyData; +import kr.co.studyhubinu.studyhubserver.apply.dto.response.FindMyRequestApplyResponse; +import kr.co.studyhubinu.studyhubserver.apply.enums.Inspection; +import kr.co.studyhubinu.studyhubserver.apply.repository.ApplyRepository; +import kr.co.studyhubinu.studyhubserver.study.domain.StudyEntity; +import kr.co.studyhubinu.studyhubserver.study.repository.StudyRepository; +import kr.co.studyhubinu.studyhubserver.support.fixture.StudyEntityFixture; +import kr.co.studyhubinu.studyhubserver.support.fixture.UserEntityFixture; +import kr.co.studyhubinu.studyhubserver.user.domain.UserEntity; +import kr.co.studyhubinu.studyhubserver.user.dto.data.UserId; +import kr.co.studyhubinu.studyhubserver.user.repository.UserRepository; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest +public class ApplyServiceIntegrationTest { + + @Autowired + ApplyService applyService; + + @Autowired + UserRepository userRepository; + + @Autowired + ApplyRepository applyRepository; + + @Autowired + StudyRepository studyRepository; + + @Test + void 내가_신청한_스터디목록_조회() { + UserEntity user = UserEntityFixture.YEONGJAE.UserEntity_생성(); + StudyEntity study = studyRepository.save(StudyEntityFixture.INU.studyEntity_생성()); + userRepository.save(user); + applyRepository.save(ApplyEntity.builder() + .userId(user.getId()).introduce("안녕") + .studyId(study.getId()) + .inspection(Inspection.ACCEPT) + .build()); + + + FindMyRequestApplyResponse applyResponse = applyService.getMyRequestApply(new UserId(user.getId()), 0, 3); + RequestApplyData applyData = applyResponse.getRequestStudyData().getContent().get(0); + + assertThat(applyData.getInspection()).isEqualTo(Inspection.ACCEPT); + assertThat(applyData.getIntroduce()).isEqualTo("안녕"); + + } +} diff --git a/src/test/java/kr/co/studyhubinu/studyhubserver/support/fixture/StudyEntityFixture.java b/src/test/java/kr/co/studyhubinu/studyhubserver/support/fixture/StudyEntityFixture.java index f1474a79..f936643d 100644 --- a/src/test/java/kr/co/studyhubinu/studyhubserver/support/fixture/StudyEntityFixture.java +++ b/src/test/java/kr/co/studyhubinu/studyhubserver/support/fixture/StudyEntityFixture.java @@ -7,7 +7,7 @@ public enum StudyEntityFixture { - INU("인천대학교 스터디", "반가워요 잘해봐요", LocalDate.of(2024, 1, 3), LocalDate.of(2024, 1, 5), "asdadsa", 1L, MajorType.COMPUTER_SCIENCE_ENGINEERING); + INU("인천대학교 스터디", "반가워요 잘해봐요", LocalDate.of(2025, 1, 3), LocalDate.of(2025, 1, 5), "asdadsa", 1L, MajorType.COMPUTER_SCIENCE_ENGINEERING); private String title; private String content;