Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions infra/sql/ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ create table owned_menu_search (
menu_id bigint not null,
modified_at datetime(6),
user_id bigint not null,
map_id bigint not null,
menu_title varchar(255) not null,
store_address varchar(255) not null,
store_title varchar(255) not null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.ourmenu.backend.domain.menu.application.MapService;
import com.ourmenu.backend.domain.menu.dto.MapSearchDto;
import com.ourmenu.backend.domain.menu.dto.MapSearchHistoryDto;
import com.ourmenu.backend.domain.menu.dto.MenuInfoOnMapDto;
import com.ourmenu.backend.domain.menu.dto.MenuOnMapDto;
import com.ourmenu.backend.domain.user.domain.CustomUserDetails;
Expand Down Expand Up @@ -62,9 +61,9 @@ public ApiResponse<MenuInfoOnMapDto> findMenuInfoByMenuId(@PathVariable Long men

@Operation(summary = "지도 검색 기록 조회", description = "지도에서 식당 검색 기록을 조회한다.")
@GetMapping("/maps/search-history")
public ApiResponse<List<MapSearchHistoryDto>> findSearchHistoryOnMap(
public ApiResponse<List<MapSearchDto>> findSearchHistoryOnMap(
@AuthenticationPrincipal CustomUserDetails userDetails) {
List<MapSearchHistoryDto> response = mapService.findSearchHistoryOnMap(userDetails.getId());
List<MapSearchDto> response = mapService.findSearchHistoryOnMap(userDetails.getId());
return ApiUtil.success(response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.ourmenu.backend.domain.menu.domain.MenuFolder;
import com.ourmenu.backend.domain.menu.domain.MenuImg;
import com.ourmenu.backend.domain.menu.dto.MapSearchDto;
import com.ourmenu.backend.domain.menu.dto.MapSearchHistoryDto;
import com.ourmenu.backend.domain.menu.dto.MenuFolderInfoOnMapDto;
import com.ourmenu.backend.domain.menu.dto.MenuInfoOnMapDto;
import com.ourmenu.backend.domain.menu.dto.MenuOnMapDto;
Expand Down Expand Up @@ -112,7 +111,7 @@ public List<MapSearchDto> findSearchResultOnMap(String title, double mapX, doubl
* @param userId
* @return
*/
public List<MapSearchHistoryDto> findSearchHistoryOnMap(Long userId) {
public List<MapSearchDto> findSearchHistoryOnMap(Long userId) {
Pageable pageable = PageRequest.of(
0, 10, Sort.by(Sort.Direction.DESC, "modifiedAt")
);
Expand All @@ -121,7 +120,7 @@ public List<MapSearchHistoryDto> findSearchHistoryOnMap(Long userId) {
.findByUserId(userId, pageable);

return searchHistoryPage.stream()
.map(MapSearchHistoryDto::from)
.map(MapSearchDto::from)
.collect(Collectors.toList());
}

Expand Down Expand Up @@ -178,6 +177,7 @@ private void saveOwnedMenuSearchHistory(Long userId, Menu menu) {
}

OwnedMenuSearch ownedMenuSearch = OwnedMenuSearch.builder()
.mapId(menu.getStore().getMap().getId())
.menuId(menu.getId())
.menuTitle(menu.getTitle())
.storeTitle(menu.getStore().getTitle())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class MapSearchDto {

private Long mapId;
private Long menuId;
private String menuTitle;
private String storeTitle;
private String storeAddress;

public static MapSearchDto from(Menu menu){
return MapSearchDto.builder()
.mapId(menu.getStore().getMap().getId())
.menuId(menu.getId())
.menuTitle(menu.getTitle())
.storeTitle(menu.getStore().getTitle())
.storeAddress(menu.getStore().getAddress())
Expand All @@ -26,6 +30,8 @@ public static MapSearchDto from(Menu menu){

public static MapSearchDto from(OwnedMenuSearch ownedMenuSearch){
return MapSearchDto.builder()
.mapId(ownedMenuSearch.getMapId())
.menuId(ownedMenuSearch.getMenuId())
.menuTitle(ownedMenuSearch.getMenuTitle())
.storeTitle(ownedMenuSearch.getStoreTitle())
.storeAddress(ownedMenuSearch.getStoreAddress())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -26,18 +24,15 @@ public class OwnedMenuSearch extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
private Long menuId;

@NotNull
private String menuTitle;

@NotNull
private String storeTitle;

@NotNull
private String storeAddress;

@NotNull
private Long userId;

private Long mapId;
}
Loading