Skip to content

Commit

Permalink
🔨 Refactor/#192 - 길찾기를 위한 Store에 위경도 추가, 가게 상세조회 Response 변경 (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
dongkyeomjang authored Dec 5, 2024
1 parent c09d34d commit 2b3da24
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 11 deletions.
21 changes: 15 additions & 6 deletions http/DummyHttpRequest.http
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Content-Type: application/json
"youtube_url" : "{{dummy.dummy1.store_info.youtube_url}}",
"name" : "{{dummy.dummy1.store_info.name}}",
"category" : "{{dummy.dummy1.store_info.category}}",
"introduction" : "{{dummy.dummy1.store_info.introduction}}"
"introduction" : "{{dummy.dummy1.store_info.introduction}}",
"latitude" : "{{dummy.dummy1.store_info.latitude}}",
"longitude" : "{{dummy.dummy1.store_info.longitude}}"
},
"ocr_info" :
{
Expand Down Expand Up @@ -74,9 +76,10 @@ Content-Type: application/json
"title" : "{{dummy.dummy2.store_info.title}}",
"youtube_url" : "{{dummy.dummy2.store_info.youtube_url}}",
"name" : "{{dummy.dummy2.store_info.name}}",

"category" : "{{dummy.dummy2.store_info.category}}",
"introduction" : "{{dummy.dummy2.store_info.introduction}}"
"introduction" : "{{dummy.dummy2.store_info.introduction}}",
"latitude" : "{{dummy.dummy2.store_info.latitude}}",
"longitude" : "{{dummy.dummy2.store_info.longitude}}"
},
"ocr_info" :
{
Expand Down Expand Up @@ -121,7 +124,9 @@ Content-Type: application/json
"youtube_url" : "{{dummy.dummy3.store_info.youtube_url}}",
"name" : "{{dummy.dummy3.store_info.name}}",
"category" : "{{dummy.dummy3.store_info.category}}",
"introduction" : "{{dummy.dummy3.store_info.introduction}}"
"introduction" : "{{dummy.dummy3.store_info.introduction}}",
"latitude" : "{{dummy.dummy3.store_info.latitude}}",
"longitude" : "{{dummy.dummy3.store_info.longitude}}"
},
"ocr_info" :
{
Expand Down Expand Up @@ -166,7 +171,9 @@ Content-Type: application/json
"youtube_url" : "{{dummy.dummy4.store_info.youtube_url}}",
"name" : "{{dummy.dummy4.store_info.name}}",
"category" : "{{dummy.dummy4.store_info.category}}",
"introduction" : "{{dummy.dummy4.store_info.introduction}}"
"introduction" : "{{dummy.dummy4.store_info.introduction}}",
"latitude" : "{{dummy.dummy4.store_info.latitude}}",
"longitude" : "{{dummy.dummy4.store_info.longitude}}"
},
"ocr_info" :
{
Expand Down Expand Up @@ -211,7 +218,9 @@ Content-Type: application/json
"youtube_url" : "{{dummy.dummy5.store_info.youtube_url}}",
"name" : "{{dummy.dummy5.store_info.name}}",
"category" : "{{dummy.dummy5.store_info.category}}",
"introduction" : "{{dummy.dummy5.store_info.introduction}}"
"introduction" : "{{dummy.dummy5.store_info.introduction}}",
"latitude" : "{{dummy.dummy5.store_info.latitude}}",
"longitude" : "{{dummy.dummy5.store_info.longitude}}"
},
"ocr_info" :
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ public static class StoreInfoDto {
@JsonProperty("introduction")
private final String introduction;

@JsonProperty("latitude")
private final Double latitude;

@JsonProperty("longitude")
private final Double longitude;

@Builder
public StoreInfoDto(
String bannerImgUrl,
Expand All @@ -100,7 +106,9 @@ public StoreInfoDto(
String name,
String category,
String address,
String introduction
String introduction,
Double latitude,
Double longitude
) {
this.bannerImgUrl = bannerImgUrl;
this.tags = tags;
Expand All @@ -111,6 +119,8 @@ public StoreInfoDto(
this.category = category;
this.address = address;
this.introduction = introduction;
this.latitude = latitude;
this.longitude = longitude;
}

public static StoreInfoDto fromEntity(Store store) {
Expand All @@ -124,6 +134,8 @@ public static StoreInfoDto fromEntity(Store store) {
.category(store.getCategory().name())
.address(store.getOcrStoreAddress())
.introduction(store.getIntroduction())
.latitude(store.getLatitude())
.longitude(store.getLongitude())
.build();
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/daon/onjung/account/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ public class Store {
@Column(name = "ocr_store_address", length = 100, nullable = false)
private String ocrStoreAddress;

@Column(name = "latitude", nullable = false)
private Double latitude;

@Column(name = "longitude", nullable = false)
private Double longitude;

/* -------------------------------------------- */
/* Timestamp Column --------------------------- */
/* -------------------------------------------- */
Expand All @@ -91,7 +97,7 @@ public class Store {
/* Methods ------------------------------------ */
/* -------------------------------------------- */
@Builder
public Store(String title, String bannerImgUrl, Set<EOnjungTag> onjungTags, String youtubeUrl, String logoImgUrl, String name, ECategory category, String introduction, String ocrStoreName, String ocrStoreAddress, Owner owner) {
public Store(String title, String bannerImgUrl, Set<EOnjungTag> onjungTags, String youtubeUrl, String logoImgUrl, String name, ECategory category, String introduction, String ocrStoreName, String ocrStoreAddress, Double latitude, Double longitude, Owner owner) {
this.title = title;
this.onjungTags = onjungTags;
this.bannerImgUrl = bannerImgUrl;
Expand All @@ -102,6 +108,8 @@ public Store(String title, String bannerImgUrl, Set<EOnjungTag> onjungTags, Stri
this.introduction = introduction;
this.ocrStoreName = ocrStoreName;
this.ocrStoreAddress = ocrStoreAddress;
this.latitude = latitude;
this.longitude = longitude;
this.createdAt = LocalDateTime.now();
this.owner = owner;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public Store createStore(
ECategory category,
String introduction,
String ocrStoreName,
String ocrStoreAddress
, Owner owner) {
String ocrStoreAddress,
Double latitude,
Double longitude,
Owner owner) {
return Store.builder()
.title(title)
.bannerImgUrl(bannerImgUrl)
Expand All @@ -36,6 +38,8 @@ public Store createStore(
.introduction(introduction)
.ocrStoreName(ocrStoreName)
.ocrStoreAddress(ocrStoreAddress)
.latitude(latitude)
.longitude(longitude)
.owner(owner)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ public record StoreInfo(
@NotNull
@Size(min = 1, max = 100)
@JsonProperty("introduction")
String introduction
String introduction,

@NotNull
@JsonProperty("latitude")
Double latitude,

@NotNull
@JsonProperty("longitude")
Double longitude
) {}

public record OcrInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public void execute(MultipartFile logo,
requestDto.storeInfo().introduction(),
requestDto.ocrInfo().storeName(),
requestDto.ocrInfo().addressName(),
requestDto.storeInfo().latitude(),
requestDto.storeInfo().longitude(),
owner
);
storeRepository.save(store);
Expand Down

0 comments on commit 2b3da24

Please sign in to comment.