-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/#117 dto fix
- Loading branch information
Showing
4 changed files
with
25 additions
and
7 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...a/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventOptionRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 18 additions & 5 deletions
23
...in/java/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,35 @@ | ||
package JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import JGS.CasperEvent.global.enums.CustomErrorCode; | ||
import JGS.CasperEvent.global.enums.Position; | ||
import JGS.CasperEvent.global.error.exception.CustomException; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalTime; | ||
import java.util.Set; | ||
|
||
@ToString | ||
@Getter | ||
public class RushEventRequestDto { | ||
private Long rushEventId; | ||
private LocalDate eventDate; | ||
private LocalTime startTime; | ||
private LocalTime endTime; | ||
private int winnerCount; | ||
private String prizeDescription; | ||
@JsonProperty("leftOption") | ||
private RushEventOptionRequestDto leftOption; | ||
@JsonProperty("rightOption") | ||
private RushEventOptionRequestDto rightOption; | ||
private Set<RushEventOptionRequestDto> options; | ||
|
||
public RushEventOptionRequestDto getLeftOption() { | ||
return options.stream() | ||
.filter(option -> option.getPosition() == Position.LEFT) | ||
.findFirst().orElseThrow(() -> new CustomException(CustomErrorCode.INVALID_RUSH_EVENT_OPTION)); | ||
} | ||
|
||
public RushEventOptionRequestDto getRightOption() { | ||
return options.stream() | ||
.filter(option -> option.getPosition() == Position.RIGHT) | ||
.findFirst().orElseThrow(() -> new CustomException(CustomErrorCode.INVALID_RUSH_EVENT_OPTION)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters