-
Notifications
You must be signed in to change notification settings - Fork 8
feat: 멘토 지원서 대학교 매핑 기능, 대학 선택 상태 페이징 조건 추가 #583
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
Changes from 6 commits
58623df
05d474b
bb75aa8
536c4c6
d6862f7
7858e26
56808c2
4d23a49
7df44a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record MentorApplicationAssignUniversityRequest( | ||
| @NotNull(message = "대학 ID 는 필수입니다.") | ||
| Long universityId | ||
| ) { | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| import com.example.solidconnection.mentor.domain.MentorApplicationStatus; | ||
| import com.example.solidconnection.mentor.domain.UniversitySelectType; | ||
| import java.time.LocalDate; | ||
|
|
||
| public record MentorApplicationSearchCondition( | ||
| MentorApplicationStatus mentorApplicationStatus, | ||
| String keyword, | ||
| LocalDate createdAt | ||
| LocalDate createdAt, | ||
| UniversitySelectType universitySelectType | ||
| ) { | ||
|
|
||
| } | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| 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.MENTOR_APPLICATION_NOT_OTHER_STATUS; | ||
| import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_APPLICATION_UNIVERSITY_NOT_SELECTED; | ||
|
|
||
| import com.example.solidconnection.admin.dto.MentorApplicationCountResponse; | ||
|
|
@@ -10,7 +11,10 @@ | |
| 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.domain.UniversitySelectType; | ||
| import com.example.solidconnection.mentor.repository.MentorApplicationRepository; | ||
| import com.example.solidconnection.university.domain.University; | ||
| import com.example.solidconnection.university.repository.UniversityRepository; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Pageable; | ||
|
|
@@ -22,6 +26,7 @@ | |
| public class AdminMentorApplicationService { | ||
|
|
||
| private final MentorApplicationRepository mentorApplicationRepository; | ||
| private final UniversityRepository universityRepository; | ||
|
|
||
| @Transactional(readOnly = true) | ||
| public Page<MentorApplicationSearchResponse> searchMentorApplications( | ||
|
|
@@ -44,7 +49,10 @@ public void approveMentorApplication(Long mentorApplicationId) { | |
| } | ||
|
|
||
| @Transactional | ||
| public void rejectMentorApplication(long mentorApplicationId, MentorApplicationRejectRequest request) { | ||
| public void rejectMentorApplication( | ||
| long mentorApplicationId, | ||
| MentorApplicationRejectRequest request | ||
| ) { | ||
| MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) | ||
| .orElseThrow(() -> new CustomException(MENTOR_APPLICATION_NOT_FOUND)); | ||
|
|
||
|
|
@@ -63,4 +71,21 @@ public MentorApplicationCountResponse getMentorApplicationCount() { | |
| rejectedCount | ||
| ); | ||
| } | ||
|
|
||
| @Transactional | ||
| public void assignUniversity( | ||
| Long mentorApplicationId, | ||
| Long universityId | ||
| ) { | ||
| MentorApplication mentorApplication = mentorApplicationRepository.findById(mentorApplicationId) | ||
| .orElseThrow(() -> new CustomException(MENTOR_APPLICATION_NOT_FOUND)); | ||
|
|
||
| if(mentorApplication.getUniversitySelectType() != UniversitySelectType.OTHER){ | ||
|
||
| throw new CustomException(MENTOR_APPLICATION_NOT_OTHER_STATUS); | ||
| } | ||
|
|
||
| University university = universityRepository.getUniversityById(universityId); | ||
|
|
||
| mentorApplication.assignUniversity(university.getId()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,4 +136,9 @@ public void reject(String rejectedReason){ | |
| this.mentorApplicationStatus = MentorApplicationStatus.REJECTED; | ||
| this.rejectedReason = rejectedReason; | ||
| } | ||
|
|
||
| public void assignUniversity(long universityId) { | ||
| this.universityId = universityId; | ||
| this.universitySelectType = UniversitySelectType.CATALOG; | ||
| } | ||
|
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. 도메인 메서드와 이를 사용하는 서비스 메서드 모두
Contributor
Author
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. @whqtker 말씀 하신 내용 적용 하였습니다! |
||
| } | ||
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.
mentorApplicationId가 아닌 mentor-application-id 로 해주실 수 있을까요?
이 controller의 다른 곳도 다 카멜케이스로 되어있는데 제가 예전 Pr에서 놓쳤다봅니다 😭