-
Notifications
You must be signed in to change notification settings - Fork 8
feat: 모의지원 최대 지망 수를 동적으로 관리하도록 #746
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
whqtker
wants to merge
22
commits into
develop
Choose a base branch
from
feat/733-dynamic-choice-count
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
22 commits
Select commit
Hold shift + click to select a range
313002b
chore: application_choice 테이블 추가 및 지망 수 컬럼 추가하는 스크립트 작성
whqtker e88da76
feat: ApplicationChoice 클래스 추가, 최대 지망 수 필드 추가
whqtker 4a1d292
chore: n지망 컬럼 제약 조건 변경
whqtker 011d40b
feat: DTO 및 검증 로직 변경
whqtker f6ac86c
feat: JPQL 쿼리 변경
whqtker fd83a34
feat: 서비스 메서드 변경
whqtker 7fc96b2
feat: 어드민 국내 대학 삽입 시 최대 지망 수 관련 DTO에 제약조건 추가
whqtker 27b148e
feat: 대학 검색 응답 필드 변경
whqtker 2575ea2
feat: 최대 지망 수 포함하도록 서비스 메서드 변경
whqtker 2e954aa
feat: QueryDSL 조인 -> 동적 선택으로 변경
whqtker fcd574e
test: 테스트 픽스처 및 테스트 변경
whqtker 19a190a
refactor: 컨벤션에 맞게 로직 변경
whqtker fcfa59b
refactor: 지망 리스트에서 null인 경우 검증 추가
whqtker b69a41f
refactor: 초기 상태에서도 maxChoiceCount만큼의 리스트 크기가 생성되도록
whqtker fec195f
refactor: 불필요한 검증 제거
whqtker 074b540
refactor: BatchSize로 N+1 문제 해결
whqtker 608deb7
test: 불필요한 Nested 제거
whqtker 5a59f2e
chore: mock데이터 수정
whqtker d9ad303
refactor: 유효한 id 검증을 서비스에 추가
whqtker e15525d
chore: CHECK 제약조건 추가
whqtker 7a438e2
chore: FK, 인덱스 추가
whqtker bf5cbfa
test: containsExactlyInAnyOrder로 변경
whqtker 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
8 changes: 3 additions & 5 deletions
8
src/main/java/com/example/solidconnection/admin/dto/UnivApplyInfoResponse.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 |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| package com.example.solidconnection.admin.dto; | ||
|
|
||
| public record UnivApplyInfoResponse( | ||
| String firstChoiceUnivName, | ||
| String secondChoiceUnivName, | ||
| String thirdChoiceUnivName | ||
| ) { | ||
| import java.util.List; | ||
|
|
||
| public record UnivApplyInfoResponse(List<String> choices) { | ||
|
|
||
| } |
6 changes: 5 additions & 1 deletion
6
...va/com/example/solidconnection/admin/university/dto/AdminHomeUniversityCreateRequest.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 |
|---|---|---|
| @@ -1,12 +1,16 @@ | ||
| package com.example.solidconnection.admin.university.dto; | ||
|
|
||
| import jakarta.validation.constraints.Min; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| public record AdminHomeUniversityCreateRequest( | ||
| @NotBlank(message = "협정 대학명은 필수입니다") | ||
| @Size(max = 100, message = "협정 대학명은 100자 이하여야 합니다") | ||
| String name | ||
| String name, | ||
|
|
||
| @Min(value = 1, message = "최대 지망 수는 1 이상이어야 합니다") | ||
| int maxChoiceCount | ||
| ) { | ||
|
|
||
| } |
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
6 changes: 5 additions & 1 deletion
6
...va/com/example/solidconnection/admin/university/dto/AdminHomeUniversityUpdateRequest.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 |
|---|---|---|
| @@ -1,12 +1,16 @@ | ||
| package com.example.solidconnection.admin.university.dto; | ||
|
|
||
| import jakarta.validation.constraints.Min; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| public record AdminHomeUniversityUpdateRequest( | ||
| @NotBlank(message = "협정 대학명은 필수입니다") | ||
| @Size(max = 100, message = "협정 대학명은 100자 이하여야 합니다") | ||
| String name | ||
| String name, | ||
|
|
||
| @Min(value = 1, message = "최대 지망 수는 1 이상이어야 합니다") | ||
| int maxChoiceCount | ||
| ) { | ||
|
|
||
| } |
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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/example/solidconnection/application/domain/ApplicationChoice.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,24 @@ | ||
| package com.example.solidconnection.application.domain; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Embeddable; | ||
| import lombok.Getter; | ||
|
|
||
| @Embeddable | ||
| @Getter | ||
| public class ApplicationChoice { | ||
|
|
||
| @Column(name = "choice_order", nullable = false) | ||
| private int choiceOrder; | ||
|
|
||
| @Column(name = "univ_apply_info_id", nullable = false) | ||
| private long univApplyInfoId; | ||
|
|
||
| protected ApplicationChoice() { | ||
| } | ||
|
|
||
| public ApplicationChoice(int choiceOrder, long univApplyInfoId) { | ||
| this.choiceOrder = choiceOrder; | ||
| this.univApplyInfoId = univApplyInfoId; | ||
| } | ||
| } |
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
39 changes: 11 additions & 28 deletions
39
src/main/java/com/example/solidconnection/application/dto/UnivApplyInfoResponse.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 |
|---|---|---|
| @@ -1,41 +1,24 @@ | ||
| package com.example.solidconnection.application.dto; | ||
|
|
||
| import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
|
||
| import com.example.solidconnection.application.domain.Application; | ||
| import com.example.solidconnection.application.domain.ApplicationChoice; | ||
| import com.example.solidconnection.university.domain.UnivApplyInfo; | ||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import java.util.Comparator; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public record UnivApplyInfoResponse( | ||
|
|
||
| @JsonProperty("firstChoiceUniversity") | ||
| String firstChoiceUnivApplyInfo, | ||
|
|
||
| @JsonProperty("secondChoiceUniversity") | ||
| @JsonInclude(NON_NULL) | ||
| String secondChoiceUnivApplyInfo, | ||
|
|
||
| @JsonProperty("thirdChoiceUniversity") | ||
| @JsonInclude(NON_NULL) | ||
| String thirdChoiceUnivApplyInfo) { | ||
| public record UnivApplyInfoResponse(List<String> choices) { | ||
|
|
||
| public static UnivApplyInfoResponse of(Application application, List<UnivApplyInfo> univApplyInfos) { | ||
| Map<Long, String> univApplyInfoMap = univApplyInfos.stream() | ||
| .collect(Collectors.toMap( | ||
| UnivApplyInfo::getId, | ||
| UnivApplyInfo::getKoreanName | ||
| )); | ||
| Map<Long, String> nameById = univApplyInfos.stream() | ||
| .collect(Collectors.toMap(UnivApplyInfo::getId, UnivApplyInfo::getKoreanName)); | ||
|
|
||
| List<String> choiceNames = application.getChoices().stream() | ||
| .sorted(Comparator.comparingInt(ApplicationChoice::getChoiceOrder)) | ||
| .map(choice -> nameById.get(choice.getUnivApplyInfoId())) | ||
| .toList(); | ||
|
|
||
| return new UnivApplyInfoResponse( | ||
| univApplyInfoMap.get(application.getFirstChoiceUnivApplyInfoId()), | ||
| application.getSecondChoiceUnivApplyInfoId() != null | ||
| ? univApplyInfoMap.get(application.getSecondChoiceUnivApplyInfoId()) : null, | ||
| application.getThirdChoiceUnivApplyInfoId() != null | ||
| ? univApplyInfoMap.get(application.getThirdChoiceUnivApplyInfoId()) : null | ||
| ); | ||
| return new UnivApplyInfoResponse(choiceNames); | ||
| } | ||
| } | ||
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.
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.
Uh oh!
There was an error while loading. Please reload this page.