Skip to content

Commit

Permalink
[refactor] CityInfoResponseDto 'isStored' 필드 추가
Browse files Browse the repository at this point in the history
related to: #144
  • Loading branch information
jo0oy committed Feb 3, 2024
1 parent 119b287 commit 3137d41
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public record CityInfoResponseDto(
String curUnit,
String curName,
Double latitude,
Double longitude
Double longitude,
Boolean isStored
) {

@Builder
Expand All @@ -40,4 +41,24 @@ public static CityInfoResponseDto fromEntity(City entity) {
.longitude(entity.getLongitude())
.build();
}

public static CityInfoResponseDto fromEntity(City entity, boolean isStored) {
return CityInfoResponseDto.builder()
.id(entity.getId())
.name(entity.getName())
.language(entity.getLanguage())
.timeDifference(entity.getTimeDifference())
.voltage(entity.getVoltage())
.visa(entity.getVisa())
.curUnit(
Objects.nonNull(entity.getCurrency()) ? entity.getCurrency().name() : null
)
.curName(
Objects.nonNull(entity.getCurrency()) ? entity.getCurrency().getCurrencyName() : null
)
.latitude(entity.getLatitude())
.longitude(entity.getLongitude())
.isStored(isStored)
.build();
}
}

0 comments on commit 3137d41

Please sign in to comment.