diff --git a/src/main/java/com/snowmanvillage/server/dto/req/LocationRequestDto.java b/src/main/java/com/snowmanvillage/server/dto/req/LocationRequestDto.java index 15f28b3..3fb21e8 100644 --- a/src/main/java/com/snowmanvillage/server/dto/req/LocationRequestDto.java +++ b/src/main/java/com/snowmanvillage/server/dto/req/LocationRequestDto.java @@ -8,16 +8,14 @@ @Getter @NoArgsConstructor public class LocationRequestDto { - private String roadName; - private String lotNumber; + private String address; private Double latitude; private Double longitude; public Location toEntity(LocationRequestDto requestDto, Photo photo) { return Location.builder() .photo(photo) - .roadName(requestDto.getRoadName()) - .lotNumber(requestDto.getLotNumber()) + .address(requestDto.getAddress()) .latitude(requestDto.getLatitude()) .longitude(requestDto.getLongitude()) .build(); diff --git a/src/main/java/com/snowmanvillage/server/entity/Location.java b/src/main/java/com/snowmanvillage/server/entity/Location.java index fdaa91a..b6d95ee 100644 --- a/src/main/java/com/snowmanvillage/server/entity/Location.java +++ b/src/main/java/com/snowmanvillage/server/entity/Location.java @@ -28,18 +28,15 @@ public class Location extends BaseTimeEntity { @JoinColumn(name="photo_id") private Photo photo; - private String roadName; - - private String lotNumber; + private String address; private Double latitude; private Double longitude; @Builder - public Location(String roadName, String lotNumber, Double latitude, Double longitude) { - this.roadName = roadName; - this.lotNumber = lotNumber; + public Location(String address, Double latitude, Double longitude) { + this.address = address; this.latitude = latitude; this.longitude = longitude; } diff --git a/src/main/java/com/snowmanvillage/server/entity/Photo.java b/src/main/java/com/snowmanvillage/server/entity/Photo.java index 55a935a..4bc8cb8 100644 --- a/src/main/java/com/snowmanvillage/server/entity/Photo.java +++ b/src/main/java/com/snowmanvillage/server/entity/Photo.java @@ -9,7 +9,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.springframework.web.ErrorResponse; +import lombok.Setter; @Getter @Entity @@ -27,8 +27,10 @@ public class Photo extends BaseTimeEntity { private String username; + @Setter private String password; + @Setter @Column(name = "like_count") private Integer likeCount; @@ -40,12 +42,4 @@ public Photo(String filePath, String title, String username, String password) { this.password = password; this.likeCount = 0; } - - public void setPassword(String encodedPassword) { - this.password = encodedPassword; - } - - public void setLikeCount(int likeCount) { - this.likeCount = likeCount; - } } diff --git a/src/main/java/com/snowmanvillage/server/repository/LocationRepository.java b/src/main/java/com/snowmanvillage/server/repository/LocationRepository.java index bdccf82..df60771 100644 --- a/src/main/java/com/snowmanvillage/server/repository/LocationRepository.java +++ b/src/main/java/com/snowmanvillage/server/repository/LocationRepository.java @@ -11,9 +11,7 @@ @Repository public interface LocationRepository extends JpaRepository { - // roadName, lotNumber 에 searchValue 가 포함되어 있는 Location 을 반환 @Query("SELECT l.photo FROM Location l " - + "WHERE l.roadName LIKE %:searchValue% " - + "OR l.lotNumber LIKE %:searchValue%") + + "WHERE l.address LIKE %:searchValue% ") List findByLocationContaining(@Param("searchValue") String searchValue); }