-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] 화면공유 DTO 변경 #243
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
base: develop
Are you sure you want to change the base?
[FEAT] 화면공유 DTO 변경 #243
Changes from all commits
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,16 @@ | ||
| package com.debatetimer.domain.sharing; | ||
|
|
||
| import com.debatetimer.domain.customize.CustomizeBoxType; | ||
| import com.debatetimer.domain.customize.Stance; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public class TimerEventInfo { | ||
|
|
||
| private final CustomizeBoxType timerType; | ||
| private final int sequence; | ||
| private final Stance currentTeam; | ||
| private final long remainingTime; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.debatetimer.domain.sharing; | ||
|
|
||
| public enum TimerEventType { | ||
|
|
||
| NEXT, | ||
| BEFORE, | ||
| STOP, | ||
| PLAY, | ||
| RESET, | ||
| TEAM_SWITCH, | ||
| FINISHED | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,18 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| package com.debatetimer.dto.sharing.request; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import com.debatetimer.domain.sharing.TimerEventInfo; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import com.debatetimer.domain.sharing.TimerEventType; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.validation.Valid; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| public record SharingRequest( | ||||||||||||||||||||||||||||||||||||||||||||||||
| LocalDateTime time | ||||||||||||||||||||||||||||||||||||||||||||||||
| TimerEventType eventType, | ||||||||||||||||||||||||||||||||||||||||||||||||
| @Valid TimerEventInfoRequest data | ||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| public TimerEventInfo toTimerEventInfo() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (data == null) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| return data.toTimerEventInfo(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+17
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: #!/bin/bash
# Description: SharingResponse 생성자에서 null 처리 여부 확인
ast-grep --pattern $'public record SharingResponse($$$) {
$$$
}'
# 또는 파일 내용 직접 확인
fd -t f "SharingResponse.java" --exec cat {}Repository: debate-timer/debate-timer-be Length of output: 1822 🏁 Script executed: fd -t f "TimerEventInfoResponse.java" --exec cat {}Repository: debate-timer/debate-timer-be Length of output: 821
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
7
to
18
Member
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.
Suggested change
Member
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package com.debatetimer.dto.sharing.request; | ||
|
|
||
| import com.debatetimer.domain.customize.CustomizeBoxType; | ||
| import com.debatetimer.domain.customize.Stance; | ||
| import com.debatetimer.domain.sharing.TimerEventInfo; | ||
| import jakarta.annotation.Nullable; | ||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record TimerEventInfoRequest( | ||
| @NotNull CustomizeBoxType timerType, | ||
| int sequence, | ||
| @Nullable Stance currentTeam, | ||
| long time | ||
|
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.
Member
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. (제안) 이것도 반영해 보는 것이 좋지 않을까요? 꽤 합리적이라고 생각합니다. |
||
| ) { | ||
|
|
||
| public TimerEventInfo toTimerEventInfo() { | ||
| return new TimerEventInfo( | ||
| timerType, | ||
| sequence, | ||
| currentTeam, | ||
| time | ||
|
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. |
||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,18 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| package com.debatetimer.dto.sharing.response; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.debatetimer.domain.sharing.TimerEventInfo; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.debatetimer.domain.sharing.TimerEventType; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| public record SharingResponse( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| LocalDateTime time | ||||||||||||||||||||||||||||||||||||||||||||||||||
| TimerEventType eventType, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| TimerEventInfoResponse data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| public SharingResponse(TimerEventType eventType, TimerEventInfo timerEventInfo) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| eventType, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| new TimerEventInfoResponse(timerEventInfo) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+16
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.
Suggested change
References
Member
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이 될 수 있는지 확인해주시고, null일 수 있다면
Comment on lines
+11
to
+16
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: #!/bin/bash
# Description: TimerEventInfoResponse 생성자 구현 확인
# TimerEventInfoResponse 클래스 찾기 및 내용 확인
fd "TimerEventInfoResponse.java" --exec cat {}Repository: debate-timer/debate-timer-be Length of output: 821 🏁 Script executed: # Find where SharingResponse constructor is called
fd ".*\.java" --exec grep -l "SharingResponse" {} \;Repository: debate-timer/debate-timer-be Length of output: 297 🏁 Script executed: # Search for calls to SharingResponse constructor with two parameters
rg "new SharingResponse\s*\(" -A 2 -B 2Repository: debate-timer/debate-timer-be Length of output: 583 🏁 Script executed: # Find SharingRequest class and toTimerEventInfo method
fd "SharingRequest\.java" --exec cat {}Repository: debate-timer/debate-timer-be Length of output: 639 🏁 Script executed: # Check if SharingRequest.data has `@NotNull` or other validation constraints
rg "@Valid|@NotNull|@Nullable" src/main/java/com/debatetimer/dto/sharing/request/SharingRequest.javaRepository: debate-timer/debate-timer-be Length of output: 113 🏁 Script executed: # Check the SharingResponse constructor chain - see all constructors
rg -A 10 "public SharingResponse" src/main/java/com/debatetimer/dto/sharing/response/SharingResponse.javaRepository: debate-timer/debate-timer-be Length of output: 277 🏁 Script executed: # Get the full SharingResponse class
cat src/main/java/com/debatetimer/dto/sharing/response/SharingResponse.javaRepository: debate-timer/debate-timer-be Length of output: 539 🏁 Script executed: # Check if there are tests that pass null to this constructor
rg -A 5 -B 5 "FINISHED" src/test/java/com/debatetimer/controller/sharing/SharingControllerTest.javaRepository: debate-timer/debate-timer-be Length of output: 54 🏁 Script executed: # Check for any `@Nullable` annotations on data field
rg "@Nullable" src/main/java/com/debatetimer/dto/sharing/request/SharingRequest.javaRepository: debate-timer/debate-timer-be Length of output: 54
제안된 수정 public SharingResponse(TimerEventType eventType, TimerEventInfo timerEventInfo) {
this(
eventType,
- new TimerEventInfoResponse(timerEventInfo)
+ timerEventInfo == null ? null : new TimerEventInfoResponse(timerEventInfo)
);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.debatetimer.dto.sharing.response; | ||
|
|
||
|
|
||
| import com.debatetimer.domain.customize.CustomizeBoxType; | ||
| import com.debatetimer.domain.customize.Stance; | ||
| import com.debatetimer.domain.sharing.TimerEventInfo; | ||
| import jakarta.annotation.Nullable; | ||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record TimerEventInfoResponse( | ||
| @NotNull CustomizeBoxType timerType, | ||
| int sequence, | ||
| @Nullable Stance currentTeam, | ||
| long time | ||
|
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. |
||
| ) { | ||
|
|
||
| public TimerEventInfoResponse(TimerEventInfo timerEventInfo) { | ||
| this( | ||
| timerEventInfo.getTimerType(), | ||
| timerEventInfo.getSequence(), | ||
| timerEventInfo.getCurrentTeam(), | ||
| timerEventInfo.getRemainingTime() | ||
| ); | ||
| } | ||
| } | ||
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.
(질문) 여기 전부 다 NotNull 맞아요? 특정 부분은 Nullable 이라면
@Nullable표시해주는 것이 좋지 않나요?