- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
[feat] 활동 연혁 CRUD 기능 구현 및 테스트 #95
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
Conversation
38e795b    to
    181ed4e      
    Compare
  
            
          
                src/main/resources/application.yml
              
                Outdated
          
        
      | @@ -1,8 +1,10 @@ | |||
| server: | |||
| port: 8080 | |||
| port: 8081 | |||
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.
포트번호 8080로 원복해주세요
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.
네 확인헀습니다
        
          
                src/main/resources/application.yml
              
                Outdated
          
        
      | profiles: | ||
| active: credentials # 추가 (제외시키면 application-credentials.yml 못 찾음) | 
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.
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.
네 확인했습니다
| private String section; | ||
| private String title; | ||
| private String award; | 
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.
ActivityHistoryRequestDto에 필드 크기 제약조건을 설정했다면 그를 저장하는 속성의 크기도 그에 맞게 설정해주세요.
length 설정이 없으면 기본적으로 길이가 255로 설정되기 때문에 의도치 않게 길이가 긴 항목도 저장될 수 있습니다.
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.
네 확인했습니다 수정하겠습니다
| @Getter @Builder | ||
| @Schema(name = "SectionItemDto", description = "섹션별 활동 목록") | ||
| public static class SectionItemDto { | ||
| 
               | 
          ||
| @Schema(description = "활동 섹션", example = "교내 경진대회") | ||
| private final String section; | ||
| 
               | 
          ||
| @Schema(description = "활동 목록") | ||
| private final List<ActivityItemDto> activities; | ||
| } | 
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.
이너 클래스 대신 외부로 분리해주세요
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.
네 확인했습니다 수정하겠습니다
| @Getter @Builder | ||
| @Schema(name = "ActivityItemDto", description = "개별 활동 목록") | ||
| public static class ActivityItemDto { | ||
| 
               | 
          ||
| @Schema(description = "활동 연혁 고유 ID", example = "1") | ||
| private final Long id; | ||
| 
               | 
          ||
| @Schema(description = "활동 제목", example = "컴퓨터 공학부 경진대회") | ||
| private final String title; | ||
| 
               | 
          ||
| @Schema(description = "수상 내역", example = "최우수상") | ||
| private final String award; | ||
| 
               | 
          ||
| public static ActivityItemDto toDto(ActivityHistory history) { | ||
| return ActivityItemDto.builder() | ||
| .id(history.getId()).title(history.getTitle()) | ||
| .award(history.getAward()) | ||
| .build(); | ||
| } | ||
| } | 
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.
이너 클래스 대신 외부로 분리해주세요
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.
네 확인했습니다 수정하겠습니다
| List<ActivityHistory> histories = historyRepository.findAll(); | ||
| return GroupedActivityHistoryDto.groupedActivityHistoryDto(histories); | 
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.
조회와 반환을 한 줄로 합쳐서 정리해주세요
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.
네 확인했습니다 수정하겠습니다
| } | ||
| 
               | 
          ||
| @Override | ||
| public ActivityHistoryResponseDto createHistory(ActivityHistoryRequestDto requestDto) { | 
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.
생성 메소드에서 반환값이 필수가 아니라면 리턴 타입을 void 로 설정해도 무방할 것 같습니다
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.
네 수정하겠습니다
| } | ||
| 
               | 
          ||
| @Override | ||
| public ActivityHistoryResponseDto updateHistory(Long id, ActivityHistoryRequestDto requestDto) { | 
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.
갱신 메소드에서 반환값이 필수가 아니라면 리턴 타입을 void 로 설정해도 무방할 것 같습니다
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.
네 수정하겠습니다
| ActivityHistory history = requestDto.toEntity(); | ||
| ActivityHistory savedHistory = historyRepository.save(history); | 
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.
dto 파싱과 저장을 한 줄로 합쳐서 정리해주세요
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.
네 수정하겠습니다
| public ActivityHistory toEntity() { | ||
| return ActivityHistory.builder() | ||
| .year(this.year) | ||
| .section(this.section) | ||
| .title(this.title) | ||
| .award(this.award) | ||
| .build(); | ||
| } | 
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.
ActivieyHistory의 팩토리 메소드를 ActivieyHistory 클래스 내부로 옮기고 Service 계층에서 Dto -> Entity 로 변환할 때 ActivieyHistory.create() 를 호출해서 객체 인스턴스를 생성/초기화 하도록 구성해주세요
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.
네 수정하겠습니다
| 
           작업 고생하셨습니다~ 추가적인 피드백 드리겠습니다! 
  | 
    
| 
           상세한 피드백 감사합니다! 빠르게 고쳐서 다시 올리겠습니다!  | 
    
c4ea801    to
    a3827a0      
    Compare
  
    a3827a0    to
    87a1187      
    Compare
  
    | 
           수정 완료했습니다 확인 부탁드리겠습니다!  | 
    
| 
           확인했습니다 @jucheonsu  | 
    
| 
           네 감사합니다  | 
    

Issue 📌
🏛️ Entity
ActivityHistory→ActivitySection🔗Repository
ActivityHistoryRepository→ActivityRepositorySectionRepository📄 DTO
ActivityHistoryRequestDto→ActivityRequestDtoActivityHistoryResponseDto→ActivityResponseDtoGroupedActivityHistoryDto→ActivityItemDtoSectionItemDto🧠 Service
ActivityHistoryService→ActivityServiceActivityHistoryServiceImpl→ActivityServiceImpl🌐 Controller
AdminActivityHistoryController→AdminActivityControllerActivityHistoryController→ActivityController✅ Test
ActivityHistoryServiceTest→ActivityServiceTest🔨 Setting
application.yml⚙️ 주요 변경 사항
날짜 필드 추가
activityDate활동 목록 정렬 (오름차순)
연도 → 섹션 ID → 활동 날짜엔티티 분리
Activity→ActivitySection📷 Image
Postman
IntelliJ