-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 스터디 기본 정보 조회 API #608
Conversation
Walkthrough이번 변경 사항은 스터디 정보를 조회하는 RESTful API를 제공하는 Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant CommonStudyController
participant CommonStudyService
participant StudyRepository
Client->>CommonStudyController: GET /common/studies/{studyId}
CommonStudyController->>CommonStudyService: getStudyInformation(studyId)
CommonStudyService->>StudyRepository: findById(studyId)
StudyRepository-->>CommonStudyService: Study entity
CommonStudyService-->>CommonStudyController: CommonStudyResponse
CommonStudyController-->>Client: 200 OK with CommonStudyResponse
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/main/java/com/gdschongik/gdsc/domain/study/api/CommonStudyController.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/application/CommonStudyService.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyResponse.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/global/util/formatter/StudyFormatter.java (1 hunks)
Additional context used
Learnings (1)
src/main/java/com/gdschongik/gdsc/domain/study/application/CommonStudyService.java (1)
Learnt from: Sangwook02 PR: GDSC-Hongik/gdsc-server#431 File: src/main/java/com/gdschongik/gdsc/domain/study/application/StudyService.java:50-57 Timestamp: 2024-07-07T15:32:34.451Z Learning: Consider using Stream API for creating lists in a more concise and potentially performant manner compared to traditional for-loops.
Additional comments not posted (9)
src/main/java/com/gdschongik/gdsc/domain/study/application/CommonStudyService.java (1)
17-26
: 서비스 클래스의 설계가 적절합니다.
CommonStudyService
는 스터디 정보를 조회하는 역할을 잘 수행하고 있습니다.@Transactional(readOnly = true)
를 사용하여 읽기 전용 트랜잭션을 설정한 점이 좋습니다. 예외 처리도 적절하게 구현되어 있습니다.src/main/java/com/gdschongik/gdsc/domain/study/api/CommonStudyController.java (1)
14-27
: RESTful API 설계가 잘 되어 있습니다.
CommonStudyController
는 스터디 정보를 조회하는 API 엔드포인트를 잘 정의하고 있습니다.@GetMapping
과@PathVariable
을 적절히 사용하여 RESTful한 설계를 따르고 있습니다. API 설명을 위한 Swagger 주석도 잘 추가되어 있습니다.src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyResponse.java (1)
Line range hint
3-28
:
포맷팅 로직이 개선되었습니다.
StudyResponse
에서 스케줄 포맷팅을StudyFormatter
의getHalfSchedule
메서드를 사용하여 간결하게 처리한 점이 좋습니다. 불필요한 메서드를 제거하여 코드가 더 깔끔해졌습니다. 이러한 변경은 유지보수성을 높이는 데 기여합니다.src/main/java/com/gdschongik/gdsc/global/util/formatter/StudyFormatter.java (4)
13-15
: 날짜 형식 검토 필요
getPeriod
메서드는 "MM.dd" 형식을 사용하고 있습니다. 이 형식이 모든 사용자의 로케일에 적합한지 확인이 필요합니다.
18-21
: 스케줄 포맷팅 적절
getSchedule
메서드는 요일과 시간을 적절히 포맷팅하고 있습니다.
23-25
: 부분 스케줄 포맷팅 적절
getHalfSchedule
메서드는 시작 시간만 포함하여 부분 스케줄을 적절히 포맷팅하고 있습니다.
27-38
: 요일 변환 적절
getKoreanDayOfWeek
메서드는DayOfWeek
를 한국어 요일 이름으로 적절히 변환하고 있습니다.src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java (2)
9-19
: 레코드 정의 및 문서화 적절
CommonStudyResponse
레코드는 불변 데이터 구조에 적합하며, Swagger 주석을 통해 API 문서화가 잘 되어 있습니다.
20-32
:from
메서드 구현 적절
from
메서드는Study
객체를CommonStudyResponse
로 변환하는 데 있어 적절하게 유틸리티 메서드를 사용하고 있습니다.
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.
lgtm
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class StudyFormatter { | ||
|
||
public static String getPeriod(Period period) { |
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.
다른 Formatter 네이밍 컨벤션 체크해주세요
study.getIntroduction(), | ||
study.getMentor().getName(), | ||
getSchedule(study.getDayOfWeek(), study.getStartTime(), study.getEndTime()), | ||
study.getTotalWeek().toString() + "주 코스", |
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.
이런 것도 전부 추출해주세요
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class StudyFormatter { |
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.
lgtm
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) |
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.
@Transactional(readOnly = true) |
메서드 레벨에 사용하면 클래스 레벨에는 없어도 될 것 같습니다
public class StudyFormatter { | ||
|
||
public static String getPeriod(Period period) { | ||
return period.getStartDate().format(DateTimeFormatter.ofPattern("MM.dd")) + "-" |
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.
return period.getStartDate().format(DateTimeFormatter.ofPattern("MM.dd")) + "-" | |
return period.getStartDate().format(DateTimeFormatter.ofPattern("MM.dd")) + " - " |
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- src/main/java/com/gdschongik/gdsc/domain/study/application/CommonStudyService.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/AssignmentResponse.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyResponse.java (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/main/java/com/gdschongik/gdsc/domain/study/application/CommonStudyService.java
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java
Additional comments not posted (4)
src/main/java/com/gdschongik/gdsc/domain/study/dto/response/AssignmentResponse.java (2)
12-12
: 마감 기한 필드의 타입 변경
deadline
필드가String
에서LocalDateTime
으로 변경되었습니다. 이 변경은 타입 안전성을 높이고, 날짜 및 시간 값을 보다 정확하게 처리할 수 있게 합니다.
20-20
:from
메서드의 타입 변경 확인
from
메서드에서assignment.getDeadline()
을 직접 반환하여LocalDateTime
타입을 유지합니다. 이로 인해 코드가 간결해지고, 데이터 타입의 일관성이 유지됩니다.src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyResponse.java (2)
16-19
: 생성자 필드 타입 변경
StudyResponse
생성자의 필드 타입이DayOfWeek
,LocalTime
,LocalDateTime
으로 변경되었습니다. 이는 데이터의 타입 안전성을 높이고 명확성을 개선합니다.
29-32
:from
메서드의 필드 사용 변경
from
메서드에서study.getDayOfWeek()
,study.getStartTime()
,study.getTotalWeek()
,study.getPeriod().getStartDate()
를 직접 사용하여 데이터의 구조적 표현을 강화합니다.
🌱 관련 이슈
📌 작업 내용 및 특이사항
📝 참고사항
📚 기타
Summary by CodeRabbit
신규 기능
CommonStudyResponse
클래스 도입.LocalDateTime
으로 변경하여 타입 안전성 향상.버그 수정
StudyResponse
의 스케줄 포맷팅 로직 개선 및 불필요한 메서드 제거.