-
Notifications
You must be signed in to change notification settings - Fork 2
[refactor] 동아리 수정 API 명세 변경 #961
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
lepitaaar
merged 13 commits into
develop/be
from
refactor/#960-recruitment-api-update-MOA-452
Dec 23, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f91d085
refactor: 추천 동아리 응답 삭제
lepitaaar 13c2822
refactor: 추천 동아리 응답 삭제
lepitaaar b166e76
refactor: faq, description 필드 수정 위치 변경
lepitaaar 400bece
refactor: faq, description 업데이트 필드 추가
lepitaaar d026c77
feature: 기존 description 문자 형에서 객체로 변경
lepitaaar 129e1c9
refactor: faqs 필드 위치 ClubDescription 안으로 이동
lepitaaar 8ee92df
refactor: faqs 필드 변경에 따른 컴파일 오류 수정
lepitaaar 6037308
fix: ClubDescription NPE 에러
lepitaaar 8f43ad0
fix: ClubDescription NPE 에러 수정
lepitaaar 052430c
refactor: clubDescription dto 추가 및 길이 제한 추가
lepitaaar df505cb
refactor: clubDescription dto와 엔티티간 의존성을 분리하였습니다
lepitaaar a9b2716
refactor: faqs 위치 description에 통합
lepitaaar 61872ed
Merge pull request #963 from Moadong/feature/#962-addclubdescriptiond…
lepitaaar 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package moadong.club.entity; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class ClubAward { | ||
|
|
||
| private String semester; | ||
|
|
||
| private List<String> achievements; | ||
| } |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/moadong/club/entity/ClubDescription.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,27 @@ | ||
| package moadong.club.entity; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class ClubDescription { | ||
|
|
||
| private String introDescription; | ||
|
|
||
| private String activityDescription; | ||
|
|
||
| private List<ClubAward> awards; | ||
|
|
||
| private ClubIdealCandidate idealCandidate; | ||
|
|
||
| private String benefits; | ||
|
|
||
| private List<Faq> faqs; | ||
| } | ||
|
Comment on lines
+10
to
+27
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. null 안전성과 불변성을 강화해주세요. ClubDescription 엔티티의 모든 필드가 nullable이며, List 필드들에 대한 방어적 복사가 없습니다. 이는 다음과 같은 문제를 야기할 수 있습니다:
다음 위치에서 null 처리를 확인해주세요: #!/bin/bash
# ClubDescription을 사용하는 코드에서 null 체크 확인
rg -A 5 'clubDescription\.(get|awards|faqs|idealCandidate)' --type java🔎 방어적 복사 및 null 안전성 강화 제안+import java.util.ArrayList;
+import java.util.Collections;
+
@Getter
-@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ClubDescription {
private String introDescription;
private String activityDescription;
private List<ClubAward> awards;
private ClubIdealCandidate idealCandidate;
private String benefits;
private List<Faq> faqs;
+
+ @Builder
+ public ClubDescription(
+ String introDescription,
+ String activityDescription,
+ List<ClubAward> awards,
+ ClubIdealCandidate idealCandidate,
+ String benefits,
+ List<Faq> faqs) {
+ this.introDescription = introDescription;
+ this.activityDescription = activityDescription;
+ this.awards = awards != null ? new ArrayList<>(awards) : new ArrayList<>();
+ this.idealCandidate = idealCandidate;
+ this.benefits = benefits;
+ this.faqs = faqs != null ? new ArrayList<>(faqs) : new ArrayList<>();
+ }
+
+ public List<ClubAward> getAwards() {
+ return awards != null ? Collections.unmodifiableList(awards) : Collections.emptyList();
+ }
+
+ public List<Faq> getFaqs() {
+ return faqs != null ? Collections.unmodifiableList(faqs) : Collections.emptyList();
+ }
}🤖 Prompt for AI Agents |
||
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/moadong/club/entity/ClubIdealCandidate.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,19 @@ | ||
| package moadong.club.entity; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class ClubIdealCandidate { | ||
|
|
||
| private List<String> tags; | ||
|
|
||
| private String content; | ||
| } |
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
25 changes: 25 additions & 0 deletions
25
backend/src/main/java/moadong/club/payload/dto/ClubAwardDto.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,25 @@ | ||
| package moadong.club.payload.dto; | ||
|
|
||
| import jakarta.validation.constraints.Size; | ||
| import moadong.club.entity.ClubAward; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ClubAwardDto( | ||
| @Size(max = 50) | ||
| String semester, | ||
|
|
||
| List<@Size(max = 100) String> achievements | ||
| ) { | ||
| public static ClubAwardDto from(ClubAward clubAward) { | ||
| if (clubAward == null) return null; | ||
| return new ClubAwardDto(clubAward.getSemester(), clubAward.getAchievements()); | ||
| } | ||
|
|
||
| public ClubAward toEntity() { | ||
| return ClubAward.builder() | ||
| .semester(semester) | ||
| .achievements(achievements) | ||
| .build(); | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
backend/src/main/java/moadong/club/payload/dto/ClubDescriptionDto.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,50 @@ | ||
| package moadong.club.payload.dto; | ||
|
|
||
| import jakarta.validation.Valid; | ||
| import jakarta.validation.constraints.Size; | ||
| import moadong.club.entity.ClubDescription; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ClubDescriptionDto( | ||
| @Size(max = 500) | ||
| String introDescription, | ||
|
|
||
| @Size(max = 1000) | ||
| String activityDescription, | ||
|
|
||
| @Valid | ||
| List<ClubAwardDto> awards, | ||
|
|
||
| @Valid | ||
| ClubIdealCandidateDto idealCandidate, | ||
|
|
||
| @Size(max = 1000) | ||
| String benefits, | ||
|
|
||
| @Valid | ||
| List<FaqDto> faqs | ||
| ) { | ||
| public static ClubDescriptionDto from(ClubDescription description) { | ||
| if (description == null) return null; | ||
| return new ClubDescriptionDto( | ||
| description.getIntroDescription(), | ||
| description.getActivityDescription(), | ||
| description.getAwards() == null ? null : description.getAwards().stream().map(ClubAwardDto::from).toList(), | ||
| ClubIdealCandidateDto.from(description.getIdealCandidate()), | ||
| description.getBenefits(), | ||
| description.getFaqs() == null ? null : description.getFaqs().stream().map(FaqDto::from).toList() | ||
| ); | ||
| } | ||
|
|
||
| public ClubDescription toEntity() { | ||
| return ClubDescription.builder() | ||
| .introDescription(introDescription) | ||
| .activityDescription(activityDescription) | ||
| .awards(awards == null ? null : awards.stream().map(ClubAwardDto::toEntity).toList()) | ||
| .idealCandidate(idealCandidate == null ? null : idealCandidate.toEntity()) | ||
| .benefits(benefits) | ||
| .faqs(faqs == null ? null : faqs.stream().map(FaqDto::toEntity).toList()) | ||
| .build(); | ||
| } | ||
| } |
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
25 changes: 25 additions & 0 deletions
25
backend/src/main/java/moadong/club/payload/dto/ClubIdealCandidateDto.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,25 @@ | ||
| package moadong.club.payload.dto; | ||
|
|
||
| import jakarta.validation.constraints.Size; | ||
| import moadong.club.entity.ClubIdealCandidate; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ClubIdealCandidateDto( | ||
| List<@Size(max = 10) String> tags, | ||
|
|
||
| @Size(max = 700) | ||
| String content | ||
| ) { | ||
| public static ClubIdealCandidateDto from(ClubIdealCandidate candidate) { | ||
| if (candidate == null) return null; | ||
| return new ClubIdealCandidateDto(candidate.getTags(), candidate.getContent()); | ||
| } | ||
|
|
||
| public ClubIdealCandidate toEntity() { | ||
| return ClubIdealCandidate.builder() | ||
| .tags(tags) | ||
| .content(content) | ||
| .build(); | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
backend/src/main/java/moadong/club/payload/dto/FaqDto.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,21 @@ | ||
| package moadong.club.payload.dto; | ||
|
|
||
| import jakarta.validation.constraints.Size; | ||
| import moadong.club.entity.Faq; | ||
|
|
||
| public record FaqDto( | ||
| @Size(max = 100) | ||
| String question, | ||
|
|
||
| @Size(max = 500) | ||
| String answer | ||
| ) { | ||
| public static FaqDto from(Faq faq) { | ||
| if (faq == null) return null; | ||
| return new FaqDto(faq.getQuestion(), faq.getAnswer()); | ||
| } | ||
|
|
||
| public Faq toEntity() { | ||
| return new Faq(question, answer); | ||
| } | ||
| } |
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.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: Moadong/moadong
Length of output: 130
🏁 Script executed:
# Check if the file exists and read it cat backend/src/main/java/moadong/club/payload/request/ClubInfoRequest.javaRepository: Moadong/moadong
Length of output: 689
🏁 Script executed:
Repository: Moadong/moadong
Length of output: 820
🏁 Script executed:
Repository: Moadong/moadong
Length of output: 1951
null 안전성 검증 필요 - 논증이 타당합니다.
ClubInfoRequest의description필드에는 검증 애노테이션이 없어 null이 될 수 있습니다. 현재 코드에서request.description().toEntity()를 직접 호출하면 null인 경우 NPE가 발생합니다.@NotNull애노테이션을 추가하거나, 호출 전에 null 체크를 추가해야 합니다.🤖 Prompt for AI Agents