Skip to content

Commit

Permalink
[REFACTOR] round의 정적 팩토리 메서드를 오버로딩하도록 변경 #217
Browse files Browse the repository at this point in the history
  • Loading branch information
Zena0128 committed Sep 20, 2024
1 parent d0f03f2 commit 2a32272
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/sports/server/command/league/domain/Round.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ public static Round from(final String value) {
});
}

<<<<<<< Updated upstream
=======
public static Round from(final int number) {
return Stream.of(Round.values())
.filter(round -> round.number == number)
.findAny()
.orElseThrow(() -> new CustomException(HttpStatus.BAD_REQUEST, LeagueErrorMessages.ROUND_NOT_FOUND_EXCEPTION));
}


>>>>>>> Stashed changes
public static boolean isValidDescription(final String value) {
return Stream.of(Round.values())
.anyMatch(round -> round.getDescription().equals(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ public record Register(
LocalDateTime startAt,
LocalDateTime endAt
) {
<<<<<<< Updated upstream
public League toEntity(final Member manager, final Organization organization) {
return new League(manager, organization, name, startAt, endAt, Round.from(maxRound));
=======
public League toEntity(final Member manager) {
return new League(manager, manager.getOrganization(), name, startAt, endAt, Round.from(maxRound));
>>>>>>> Stashed changes
}
}

Expand Down

0 comments on commit 2a32272

Please sign in to comment.