-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] #197: 신규 멤버 모집 관련 관리자 페이지 api 구현 #204
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
66a75a3
feat(#197/recruit): 기존 신규 멤버 가입 로직에 학기 추가
kaswhy 5991936
feat(#197/recruit): 특정 멤버 입금 상태 변경 api 구현
kaswhy dd74a7e
chore(#197/recruit): 필요 없는 거 삭제
kaswhy dac2759
chore(#197/recruit): 멤버 전체 조회 api 구현
kaswhy 3da088d
refactor(#197/recruit): recruit 도메인 예외 던지는 것으로 변경
kaswhy 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
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
7 changes: 7 additions & 0 deletions
7
src/main/java/inha/gdgoc/domain/recruit/dto/request/PaymentUpdateRequest.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,7 @@ | ||
| package inha.gdgoc.domain.recruit.dto.request; | ||
|
|
||
| public record PaymentUpdateRequest( | ||
| boolean isPayed | ||
| ) { | ||
|
|
||
| } |
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
32 changes: 32 additions & 0 deletions
32
src/main/java/inha/gdgoc/domain/recruit/dto/response/RecruitMemberSummaryResponse.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,32 @@ | ||
| package inha.gdgoc.domain.recruit.dto.response; | ||
|
|
||
| import inha.gdgoc.domain.recruit.entity.RecruitMember; | ||
|
|
||
| public record RecruitMemberSummaryResponse( | ||
| Long id, | ||
| String name, | ||
| String phoneNumber, | ||
| String major, | ||
| String studentId, | ||
| String admissionSemester, | ||
| Boolean isPayed | ||
| ) { | ||
|
|
||
| public static RecruitMemberSummaryResponse from(RecruitMember recruitMember) { | ||
| String semester = null; | ||
| if (recruitMember.getAdmissionSemester() != null) { | ||
| String enumName = recruitMember.getAdmissionSemester().name(); | ||
| semester = enumName.substring(1).replace('_', '-'); | ||
| } | ||
|
|
||
| return new RecruitMemberSummaryResponse( | ||
| recruitMember.getId(), | ||
| recruitMember.getName(), | ||
| recruitMember.getPhoneNumber(), | ||
| recruitMember.getMajor(), | ||
| recruitMember.getStudentId(), | ||
| semester, | ||
| recruitMember.getIsPayed() | ||
| ); | ||
| } | ||
| } |
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
5 changes: 5 additions & 0 deletions
5
src/main/java/inha/gdgoc/domain/recruit/enums/AdmissionSemester.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,5 @@ | ||
| package inha.gdgoc.domain.recruit.enums; | ||
|
|
||
| public enum AdmissionSemester { | ||
| Y25_1, Y25_2, Y26_1, Y26_2 | ||
| } |
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: 39 additions & 0 deletions
39
src/main/java/inha/gdgoc/global/dto/response/PageMeta.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,39 @@ | ||
| package inha.gdgoc.global.dto.response; | ||
|
|
||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Sort; | ||
|
|
||
| public record PageMeta( | ||
| int page, | ||
| int size, | ||
| long totalElements, | ||
| int totalPages, | ||
| boolean hasNext, | ||
| boolean hasPrevious, | ||
| String sort, | ||
| String direction | ||
| ) { | ||
|
|
||
| public static PageMeta of(Page<?> page) { | ||
| String sortProps = page.getSort().stream() | ||
| .map(Sort.Order::getProperty) | ||
| .reduce((a, b) -> a + "," + b) | ||
| .orElse("createdAt"); | ||
|
|
||
| String dir = page.getSort().stream() | ||
| .findFirst() | ||
| .map(o -> o.getDirection().name()) | ||
| .orElse("DESC"); | ||
|
|
||
| return new PageMeta( | ||
| page.getNumber(), | ||
| page.getSize(), | ||
| page.getTotalElements(), | ||
| page.getTotalPages(), | ||
| page.hasNext(), | ||
| page.hasPrevious(), | ||
| sortProps, | ||
| dir | ||
| ); | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
src/main/java/inha/gdgoc/global/util/SemesterCalculator.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,45 @@ | ||
| package inha.gdgoc.global.util; | ||
|
|
||
| import inha.gdgoc.domain.recruit.enums.AdmissionSemester; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.time.ZoneId; | ||
|
|
||
| public final class SemesterCalculator { | ||
| private static final ZoneId KST = ZoneId.of("Asia/Seoul"); | ||
|
|
||
| private SemesterCalculator() {} | ||
|
|
||
| public static AdmissionSemester currentSemester() { | ||
| return of(LocalDate.now(KST)); | ||
| } | ||
|
|
||
| public static AdmissionSemester of(LocalDate date) { | ||
| int year = date.getYear(); | ||
| int month = date.getMonthValue(); | ||
|
|
||
| int yy; | ||
| int term; | ||
|
|
||
| if (month == 1) { | ||
| yy = (year - 1) % 100; | ||
| term = 2; | ||
| } else if (month <= 7) { | ||
| yy = year % 100; | ||
| term = 1; | ||
| } else { | ||
| yy = year % 100; | ||
| term = 2; | ||
| } | ||
|
|
||
| String enumName = String.format("Y%02d_%d", yy, term); | ||
| try { | ||
| return AdmissionSemester.valueOf(enumName); | ||
| } catch (Exception ex) { | ||
| throw new RuntimeException( | ||
| "AdmissionSemester enum에 상수 " + enumName + " 이(가) 정의되어 있지 않습니다. " + | ||
| "해당 연도/학기 상수를 추가하세요.", ex | ||
| ); | ||
| } | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/main/resources/db/migration/V20250826__admission_semester_add_backfill_enforce.sql
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 @@ | ||
| -- 1) 컬럼 추가 (처음엔 NULL 허용) | ||
| ALTER TABLE recruit_member | ||
| ADD COLUMN admission_semester VARCHAR(10); | ||
|
|
||
| -- 2) 기존 데이터 백필 | ||
| -- 학기 규칙: 2~7월 = YYY_1, 8~12월 = YYY_2, 1월 = (전년도) YYY_2 | ||
| UPDATE recruit_member | ||
| SET admission_semester = CASE | ||
| WHEN EXTRACT(MONTH FROM created_at) BETWEEN 8 AND 12 | ||
| THEN 'Y' || to_char(created_at, 'YY') || '_2' | ||
| WHEN EXTRACT(MONTH FROM created_at) BETWEEN 2 AND 7 | ||
| THEN 'Y' || to_char(created_at, 'YY') || '_1' | ||
| WHEN EXTRACT(MONTH FROM created_at) = 1 | ||
| THEN 'Y' || to_char(created_at - INTERVAL '1 year', 'YY') || '_2' | ||
| END | ||
| WHERE admission_semester IS NULL; | ||
|
|
||
| -- 3) NOT NULL 전환 (형식 제약은 생략 가능) | ||
| ALTER TABLE recruit_member | ||
| ALTER COLUMN admission_semester SET NOT NULL; | ||
|
|
||
| -- (선택) 인덱스 | ||
| CREATE INDEX idx_recruit_member_admission_semester | ||
| ON recruit_member (admission_semester); |
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.
🛠️ Refactor suggestion
목록 조회 API: 파라미터 검증 추가와 정렬 컬럼 화이트리스트 권장
PageRequest.of가 예외를 던지면 500으로 번질 수 있습니다. Bean Validation으로 400을 반환하도록 하는 것이 안전합니다.sort값은 스프링 데이터에서PropertyReferenceException을 유발할 수 있습니다. 허용 컬럼을 제한하세요.검증 추가(diff):
정렬 컬럼 화이트리스트(예시)(diff):
추가 import:
운영 수위 제안:
question = question == null ? null : question.trim();으로 공백만 있는 입력을 일찍 정규화할 수 있습니다.