Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/main/java/com/somemore/location/domain/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -26,14 +27,14 @@ public class Location extends BaseEntity {
@Column(name = "address", nullable = false)
private String address;

@Column(name = "latitude", nullable = false)
private String latitude;
@Column(name = "latitude", nullable = false, precision = 11, scale = 8)
private BigDecimal latitude;

@Column(name = "longitude", nullable = false)
private String longitude;
@Column(name = "longitude", nullable = false, precision = 12, scale = 8)
private BigDecimal longitude;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정밀도를 8자리로 한이유


@Builder
public Location(String address, String latitude, String longitude) {
public Location(String address, BigDecimal latitude, BigDecimal longitude) {
this.address = address;
this.latitude = latitude;
this.longitude = longitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.somemore.location.domain.Location;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;
import lombok.Builder;

@JsonNaming(SnakeCaseStrategy.class)
Expand All @@ -15,11 +19,16 @@ public record LocationCreateRequestDto(
@NotBlank(message = "주소는 필수 입력 값입니다.")
String address,
@Schema(description = "주소에 해당하는 위도 정보", example = "37.4845373748015")
@NotBlank(message = "위도는 필수 입력 값입니다.")
String latitude,
@NotNull(message = "위도는 필수 입력 값입니다.")
@DecimalMin(value = "33", message = "위도는 33도 이상이어야 합니다.")
@DecimalMax(value = "39", message = "위도는 38도 이하이어야 합니다.")
BigDecimal latitude,

@Schema(description = "주소에 해당하는 경도 정보", example = "127.010842267696")
@NotBlank(message = "경도는 필수 입력 값입니다.")
String longitude
@NotNull(message = "경도는 필수 입력 값입니다.")
@DecimalMin(value = "124", message = "경도는 124도 이상이어야 합니다.")
@DecimalMax(value = "132", message = "경도는 132도 이하이어야 합니다.")
BigDecimal longitude
) {

public Location toEntity() {
Expand Down