-
Notifications
You must be signed in to change notification settings - Fork 2
[feature] 동아리 소개 필드 추가 #963
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 all commits
d026c77
129e1c9
8ee92df
6037308
8f43ad0
052430c
df505cb
a9b2716
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,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; | ||
| } |
| 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; | ||
| } |
| 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; | ||
| } |
| 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(); | ||
| } | ||
| } |
| 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(); | ||
| } | ||
| } |
| 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(); | ||
| } | ||
| } |
| 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 | ||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+12
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. 🛠️ Refactor suggestion | 🟠 Major 필수 필드 검증 추가를 권장합니다. FAQ의 질문과 답변은 사용자에게 표시되는 중요한 콘텐츠이므로, 🔎 제안하는 수정사항+import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import moadong.club.entity.Faq;
public record FaqDto(
+ @NotBlank
@Size(max = 100)
String question,
+ @NotBlank
@Size(max = 500)
String answer
) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| 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); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+18
to
+20
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. 🧩 Analysis chain🏁 Script executed: fd -e java -t f "Faq.java" | head -5Repository: Moadong/moadong Length of output: 109 🏁 Script executed: cat -n backend/src/main/java/moadong/club/entity/Faq.javaRepository: Moadong/moadong Length of output: 377 🏁 Script executed: cat -n backend/src/main/java/moadong/club/payload/dto/FaqDto.javaRepository: Moadong/moadong Length of output: 656 🏁 Script executed: # 검증을 위해 FaqDto 컨텍스트 재확인
cd backend && find . -name "*.java" -type f | xargs rg "FaqDto" | head -20Repository: Moadong/moadong Length of output: 1015 FaqDto의 question과 answer 필드에 null 체크 추가
question과 answer가 null이 될 수 없다면, FaqDto 필드에 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
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.
NullPointerException 위험: description null 체크 필요
request.description()이 null인 경우toEntity()호출 시 NPE가 발생합니다. 방어적 null 체크를 추가하세요.🔎 NPE 방지를 위한 수정 제안
📝 Committable suggestion
🤖 Prompt for AI Agents