-
Notifications
You must be signed in to change notification settings - Fork 8
feat: 유저의 멘토 지원서 신청 이력 조회 기능 추가 #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sukangpunch
wants to merge
3
commits into
solid-connection:develop
Choose a base branch
from
sukangpunch:feat/600-admin-mentor-application-history
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/com/example/solidconnection/admin/dto/MentorApplicationHistoryResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.mentor.domain.MentorApplicationStatus; | ||
| import java.time.ZonedDateTime; | ||
|
|
||
| public record MentorApplicationHistoryResponse( | ||
| long id, | ||
| MentorApplicationStatus mentorApplicationStatus, | ||
| String rejectedReason, | ||
| ZonedDateTime createdAt, | ||
| int applicationOrder | ||
| ) { | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule secret
updated
from 29524e to 8300cd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,11 +5,13 @@ | |
| import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_OTHER_STATUS; | ||
| import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED; | ||
| import static com.example.solidconnection.common.exception.ErrorCode.UNIVERSITY_NOT_FOUND; | ||
| import static com.example.solidconnection.common.exception.ErrorCode.USER_NOT_FOUND; | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode; | ||
| import static org.junit.jupiter.api.Assertions.assertAll; | ||
|
|
||
| import com.example.solidconnection.admin.dto.MentorApplicationCountResponse; | ||
| import com.example.solidconnection.admin.dto.MentorApplicationHistoryResponse; | ||
| import com.example.solidconnection.admin.dto.MentorApplicationRejectRequest; | ||
| import com.example.solidconnection.admin.dto.MentorApplicationSearchCondition; | ||
| import com.example.solidconnection.admin.dto.MentorApplicationSearchResponse; | ||
|
|
@@ -509,4 +511,106 @@ class 멘토_지원서에_대학_매핑 { | |
| .hasMessage(UNIVERSITY_NOT_FOUND.getMessage()); | ||
| } | ||
| } | ||
|
|
||
| @Nested | ||
| class 멘토_지원서_이력_조회 { | ||
|
|
||
| @Test | ||
| void 사용자의_멘토_지원서_이력을_최신_생성_내림차순으로_조회한다() { | ||
| // given | ||
| SiteUser user = siteUserFixture.사용자(); | ||
| University university = universityFixture.메이지_대학(); | ||
| MentorApplication app1 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app2 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app3 = mentorApplicationFixture.승인된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
|
|
||
| // when | ||
| List<MentorApplicationHistoryResponse> response = adminMentorApplicationService.findMentorApplicationHistory(user.getId()); | ||
|
|
||
| // then | ||
| assertAll( | ||
| () -> assertThat(response).hasSize(3), | ||
| () -> assertThat(response) | ||
| .extracting(MentorApplicationHistoryResponse::id) | ||
| .containsExactly(app3.getId(), app2.getId(), app1.getId()), | ||
| () -> assertThat(response) | ||
| .extracting(MentorApplicationHistoryResponse::applicationOrder) | ||
| .containsExactly(3,2,1) | ||
| ); | ||
| } | ||
|
|
||
| @Test | ||
| void 지원서가_5개를_초과하면_최신_5개만_최신_생성_내림차순으로_조회한다() { | ||
| // given | ||
| SiteUser user = siteUserFixture.사용자(); | ||
| University university = universityFixture.메이지_대학(); | ||
| MentorApplication app1 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app2 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app3 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app4 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app5 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app6 = mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| MentorApplication app7 = mentorApplicationFixture.승인된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
|
|
||
| // when | ||
| List<MentorApplicationHistoryResponse> response = adminMentorApplicationService.findMentorApplicationHistory(user.getId()); | ||
|
|
||
| // then | ||
| assertAll( | ||
| () -> assertThat(response).hasSize(5), | ||
| () -> assertThat(response) | ||
| .extracting(MentorApplicationHistoryResponse::id) | ||
| .containsExactly(app7.getId(), app6.getId(), app5.getId(), app4.getId(), app3.getId()), | ||
| () -> assertThat(response) | ||
| .extracting(MentorApplicationHistoryResponse::applicationOrder) | ||
| .containsExactly(7,6,5,4,3) | ||
| ); | ||
| } | ||
|
|
||
| @Test | ||
| void 지원서_이력이_없으면_빈_목록을_반환한다() { | ||
| // given | ||
| SiteUser user = siteUserFixture.사용자(); | ||
|
|
||
| // when | ||
| List<MentorApplicationHistoryResponse> response = adminMentorApplicationService.findMentorApplicationHistory(user.getId()); | ||
|
|
||
| // then | ||
| assertThat(response).isEmpty(); | ||
| } | ||
|
|
||
| @Test | ||
| void 응답에_지원서_상태와_거절_사유가_포함된다() { | ||
| // given | ||
| SiteUser user = siteUserFixture.사용자(); | ||
| University university = universityFixture.메이지_대학(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 현재 사용자, 메이지 대학 생성이 중복되고 있는데 |
||
| mentorApplicationFixture.거절된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
| mentorApplicationFixture.승인된_멘토신청(user.getId(), UniversitySelectType.CATALOG, university.getId()); | ||
|
|
||
| // when | ||
| List<MentorApplicationHistoryResponse> response = adminMentorApplicationService.findMentorApplicationHistory(user.getId()); | ||
|
|
||
| // then | ||
| assertAll( | ||
| () -> assertThat(response).hasSize(2), | ||
| () -> assertThat(response.get(0).mentorApplicationStatus()).isEqualTo(MentorApplicationStatus.APPROVED), | ||
| () -> assertThat(response.get(0).rejectedReason()).isNull(), | ||
| () -> assertThat(response.get(0).applicationOrder()).isEqualTo(2), | ||
| () -> assertThat(response.get(1).mentorApplicationStatus()).isEqualTo(MentorApplicationStatus.REJECTED), | ||
| () -> assertThat(response.get(1).rejectedReason()).isNotNull(), | ||
| () -> assertThat(response.get(1).applicationOrder()).isEqualTo(1) | ||
| ); | ||
| } | ||
|
|
||
| @Test | ||
| void 존재하지_않는_사용자_이력을_조회하면_예외_응답을_반환한다() { | ||
| // given | ||
| long nonExistentUserId = 99999L; | ||
|
|
||
| // when & then | ||
| assertThatCode(() -> adminMentorApplicationService.findMentorApplicationHistory(nonExistentUserId)) | ||
| .isInstanceOf(CustomException.class) | ||
| .hasMessage(USER_NOT_FOUND.getMessage()); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엔드포인트 이름이 조금 긴 것 같습니다 ! 어차피 prefix가
/admin/mentor-applications이므로mentor-application-history대신history를 사용하면 어떨까요 ?