-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/13 gRPC #18
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
Feature/13 gRPC #18
Conversation
WalkthroughgRPC 서버 구현을 위한 새로운 클래스와 내부 응답 DTO, 그리고 도메인과 gRPC 메시지 간 변환을 담당하는 매퍼가 추가되었습니다. 이 변경으로 일정 타입별 조회 gRPC 서비스가 구현되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ScheduleGrpcService
participant QueryScheduleByTypeUseCase
participant ScheduleGrpcMapper
Client->>ScheduleGrpcService: getScheduleByType(TypeRequest)
ScheduleGrpcService->>QueryScheduleByTypeUseCase: invoke(type)
QueryScheduleByTypeUseCase-->>ScheduleGrpcService: InternalScheduleResponse
ScheduleGrpcService->>ScheduleGrpcMapper: toGetScheduleByTypeResponse(InternalScheduleResponse)
ScheduleGrpcMapper-->>ScheduleGrpcService: GetScheduleResponse
ScheduleGrpcService-->>Client: GetScheduleResponse
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| * @param request 빈 요청 메시지 (Empty) | ||
| * @return ScheduleProto.SchedulesResponse 조회된 스케줄 목록이 포함된 응답 | ||
| */ | ||
| @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.
이거 try catch로 싸매야 하지 않나요? @coehgns
...le/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/ScheduleGrpcService.kt
Outdated
Show resolved
Hide resolved
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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: 1
♻️ Duplicate comments (1)
casper-schedule/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/ScheduleGrpcService.kt (1)
30-37: 예외 처리 필요 (이전 리뷰 의견 반영)이전 리뷰에서 언급된 대로 try-catch 블록으로 예외 처리를 해야 합니다. 또한
request.type.toString()로 타입 변환하는 방식이 적절한지 검토가 필요합니다.override suspend fun getScheduleByType(request: ScheduleServiceProto.TypeRequest): ScheduleServiceProto.GetScheduleResponse { - val schedule = queryScheduleByTypeUseCase.execute(request.type.toString()) - val internalScheduleResponse = InternalScheduleResponse( - type = schedule.type, - date = schedule.date.toString() - ) - return scheduleGrpcMapper.toGetScheduleByTypeResponse(internalScheduleResponse) + return try { + val schedule = queryScheduleByTypeUseCase.execute(request.type.name) + val internalScheduleResponse = InternalScheduleResponse( + type = schedule.type, + date = schedule.date.toString() + ) + scheduleGrpcMapper.toGetScheduleByTypeResponse(internalScheduleResponse) + } catch (e: Exception) { + throw Status.NOT_FOUND + .withDescription("해당 타입의 스케줄을 찾을 수 없습니다: ${request.type}") + .withCause(e) + .asRuntimeException() + }추가로 gRPC Status import가 필요합니다:
import io.grpc.Status
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (3)
casper-schedule/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/ScheduleGrpcService.kt(1 hunks)casper-schedule/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/dto/response/InternalScheduleResponse.kt(1 hunks)casper-schedule/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/mapper/ScheduleGrpcMapper.kt(1 hunks)
🔇 Additional comments (5)
casper-schedule/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/dto/response/InternalScheduleResponse.kt (2)
1-1: 패키지 경로 불일치 확인 필요AI 요약에서는 이 파일이
hs.kr.entrydsm.schedule.infrastructure.grpc.server.dto.response패키지에 있다고 했지만, 실제 코드에서는hs.kr.entrydsm.schedule.infrastructure.grpc.dto.response패키지로 선언되어 있습니다. 올바른 패키지 구조를 확인해 주세요.Likely an incorrect or invalid review comment.
5-15: 깔끔한 DTO 구현입니다.한국어 문서화와 함께 명확한 데이터 클래스 구조를 가지고 있습니다. 도메인과 인프라 계층 간의 데이터 전달 목적이 잘 드러납니다.
casper-schedule/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/mapper/ScheduleGrpcMapper.kt (2)
5-5: Import 경로 불일치Import문에서
hs.kr.entrydsm.schedule.infrastructure.grpc.dto.response.InternalScheduleResponse를 참조하고 있지만, 실제 파일에서는hs.kr.entrydsm.schedule.infrastructure.grpc.server.dto.response패키지 구조가 언급되었습니다. 일관된 패키지 구조를 확인해 주세요.Likely an incorrect or invalid review comment.
19-26: 타입 매핑 구현이 깔끔합니다.도메인 타입과 gRPC 프로토 타입 간의 매핑이 명확하고 유지보수하기 쉽게 구현되어 있습니다.
casper-schedule/src/main/kotlin/hs/kr/entrydsm/schedule/infrastructure/grpc/server/ScheduleGrpcService.kt (1)
17-21: 의존성 주입과 클래스 구조가 잘 설계되었습니다.gRPC 서비스 어노테이션과 함께 필요한 의존성들이 명확하게 주입되어 있고, 상속 구조도 적절합니다.
Summary by CodeRabbit