Skip to content

Commit 014ff1d

Browse files
committed
feat: 검색 히스토리 응답값 추가
- id, 크롤링 유무
1 parent eb1a540 commit 014ff1d

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/main/java/com/ourmenu/backend/domain/search/application/SearchService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ private void saveSearchHistory(Long userId, GetStoreResponse getStoreResponse) {
213213
NotOwnedMenuSearch notOwnedMenuSearch = NotOwnedMenuSearch.builder()
214214
.title(getStoreResponse.getStoreTitle())
215215
.address(getStoreResponse.getStoreAddress())
216+
.storeId(getStoreResponse.getStoreId())
217+
.isCrawled(getStoreResponse.isCrawled())
216218
.userId(userId)
217219
.build();
218220
notOwnedMenuSearchRepository.save(notOwnedMenuSearch);

src/main/java/com/ourmenu/backend/domain/search/domain/NotOwnedMenuSearch.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import jakarta.persistence.Id;
88
import jakarta.persistence.Table;
99
import jakarta.validation.constraints.NotNull;
10-
import java.time.LocalDateTime;
1110
import lombok.AccessLevel;
1211
import lombok.AllArgsConstructor;
1312
import lombok.Builder;
@@ -32,6 +31,12 @@ public class NotOwnedMenuSearch extends BaseEntity {
3231
@NotNull
3332
private String address;
3433

34+
@NotNull
35+
private String storeId;
36+
37+
@NotNull
38+
private boolean isCrawled;
39+
3540
@NotNull
3641
private Long userId;
3742
}

src/main/java/com/ourmenu/backend/domain/search/dto/GetSearchHistoryResponse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ public class GetSearchHistoryResponse {
1616

1717
private String storeAddress;
1818

19+
private String storeId;
20+
21+
private boolean isCrawled;
22+
1923
private LocalDateTime modifiedAt;
2024

21-
public static GetSearchHistoryResponse from(NotOwnedMenuSearch notOwnedMenuSearch){
25+
public static GetSearchHistoryResponse from(NotOwnedMenuSearch notOwnedMenuSearch) {
2226
return GetSearchHistoryResponse.builder()
2327
.menuTitle(notOwnedMenuSearch.getTitle())
2428
.storeAddress(notOwnedMenuSearch.getAddress())
29+
.storeId(notOwnedMenuSearch.getId().toString())
30+
.isCrawled(false)
2531
.modifiedAt(notOwnedMenuSearch.getModifiedAt())
2632
.build();
2733
}

src/main/java/com/ourmenu/backend/domain/search/dto/GetStoreResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class GetStoreResponse {
2121
private List<GetStoreMenuResponse> menus;
2222
private Double storeMapX;
2323
private Double storeMapY;
24+
private boolean isCrawled;
2425

2526
public static GetStoreResponse from(SearchableStore searchableStore) {
2627
List<GetStoreMenuResponse> getStoreMenuResponses = searchableStore.getStoreMenus().stream()
@@ -40,6 +41,7 @@ public static GetStoreResponse from(SearchableStore searchableStore) {
4041
.menus(getStoreMenuResponses)
4142
.storeMapX(mapX)
4243
.storeMapY(mapY)
44+
.isCrawled(true)
4345
.build();
4446
}
4547

@@ -50,6 +52,7 @@ public static GetStoreResponse from(NotFoundStore notFoundStore) {
5052
.storeAddress(notFoundStore.getAddress())
5153
.storeMapX(notFoundStore.getMapX())
5254
.storeMapY(notFoundStore.getMapY())
55+
.isCrawled(false)
5356
.build();
5457
}
5558
}

0 commit comments

Comments
 (0)