Uh oh!
There was an error while loading. Please reload this page.
- 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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
0994bb98895ee19e43bc3c9ff45f1d44b1e814e4daf22a424File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,23 @@ | ||
| package com.example.solidconnection.admin.service; | ||
| import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_NOT_FOUND; | ||
| import static com.example.solidconnection.common.exception.ErrorCode.USER_NOT_FOUND; | ||
| 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; | ||
| import com.example.solidconnection.common.exception.CustomException; | ||
| import com.example.solidconnection.mentor.domain.MentorApplication; | ||
| import com.example.solidconnection.mentor.domain.MentorApplicationStatus; | ||
| import com.example.solidconnection.mentor.repository.MentorApplicationRepository; | ||
| import com.example.solidconnection.siteuser.domain.SiteUser; | ||
| import com.example.solidconnection.siteuser.repository.SiteUserRepository; | ||
| import com.example.solidconnection.university.domain.University; | ||
| import com.example.solidconnection.university.repository.UniversityRepository; | ||
| import java.util.List; | ||
| import java.util.stream.IntStream; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Pageable; | ||
| @@ -24,6 +30,7 @@ public class AdminMentorApplicationService { | ||
| private final MentorApplicationRepository mentorApplicationRepository; | ||
| private final UniversityRepository universityRepository; | ||
| private final SiteUserRepository siteUserRepository; | ||
| @Transactional(readOnly = true) | ||
| public Page<MentorApplicationSearchResponse> searchMentorApplications( | ||
| @@ -43,7 +50,7 @@ public void approveMentorApplication(Long mentorApplicationId) { | ||
| @Transactional | ||
| public void rejectMentorApplication( | ||
| long mentorApplicationId, | ||
| Long mentorApplicationId, | ||
| MentorApplicationRejectRequest request | ||
| ) { | ||
| MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) | ||
| @@ -79,4 +86,25 @@ public void assignUniversity( | ||
| mentorApplication.assignUniversity(university.getId()); | ||
| } | ||
| @Transactional(readOnly = true) | ||
| public List<MentorApplicationHistoryResponse> findMentorApplicationHistory(Long siteUserId) { | ||
| SiteUser siteUser = siteUserRepository.findById(siteUserId) | ||
| .orElseThrow(() -> new CustomException(USER_NOT_FOUND)); | ||
| long totalCount = mentorApplicationRepository.countBySiteUserId(siteUser.getId()); | ||
| List<MentorApplication> mentorApplications = mentorApplicationRepository.findTop5BySiteUserIdOrderByCreatedAtDesc(siteUser.getId()); | ||
| return IntStream.range(0, mentorApplications.size()) | ||
| .mapToObj(index -> { | ||
| MentorApplication app = mentorApplications.get(index); | ||
| return new MentorApplicationHistoryResponse( | ||
| app.getId(), | ||
| app.getMentorApplicationStatus(), | ||
| app.getRejectedReason(), | ||
| app.getCreatedAt(), | ||
| (int) totalCount - index | ||
| ); | ||
| }).toList(); | ||
| } | ||
| } | ||
Contributor 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. 여기 pr과 관련없지만 보여가지고 ㅎㅎ.. 개행 하나만 지워주실 수 있나요
| ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.