Skip to content

Commit

Permalink
Merge pull request #47 from AlongTheBlue/develop
Browse files Browse the repository at this point in the history
[Refactor] tour data image url 변수명 수정
  • Loading branch information
MoonInbae authored Oct 13, 2024
2 parents ddffbac + 6a6e16b commit 85c8aa4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class TourDataImage {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String url;
private String originimgurl;

// TourImageEntity에 맞추어 변경
@ManyToOne
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,17 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import org.alongtheblue.alongtheblue_server.global.common.response.ApiResponse;
import org.alongtheblue.alongtheblue_server.global.data.accommodation.Accommodation;
import org.alongtheblue.alongtheblue_server.global.data.accommodation.AccommodationDTO;
import org.alongtheblue.alongtheblue_server.global.data.accommodation.AccommodationImage;
import org.alongtheblue.alongtheblue_server.global.data.cafe.Cafe;
import org.alongtheblue.alongtheblue_server.global.data.cafe.CafeService;
import org.alongtheblue.alongtheblue_server.global.data.cafe.dto.PartCafeResponseDto;
import org.alongtheblue.alongtheblue_server.global.data.global.Category;
import org.alongtheblue.alongtheblue_server.global.data.global.CustomPage;
import org.alongtheblue.alongtheblue_server.global.data.global.SimpleInformation;
import org.alongtheblue.alongtheblue_server.global.data.global.dto.response.DetailResponseDto;
import org.alongtheblue.alongtheblue_server.global.data.global.dto.response.HomeResponseDto;
import org.alongtheblue.alongtheblue_server.global.data.restaurant.Restaurant;
import org.alongtheblue.alongtheblue_server.global.data.tourData.dto.TourDataResponseDto;
import org.alongtheblue.alongtheblue_server.global.data.weather.WeatherResponseDto;
import org.alongtheblue.alongtheblue_server.global.data.weather.WeatherService;
import org.alongtheblue.alongtheblue_server.global.gpt.OpenAIService;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand Down Expand Up @@ -386,7 +378,7 @@ public ApiResponse<List<TourDataDto>> getHomeTourData() {

// 이미지 리스트를 DTO에 추가
List<String> imageUrls = tourData.getImages().stream()
.map(TourDataImage::getUrl)
.map(TourDataImage::getOriginimgurl)
.collect(Collectors.toList());
tourDataDto.setOriginimgurl(imageUrls);

Expand All @@ -413,7 +405,7 @@ public TourDataDto getTourDataDetails(String contentsid) {

// 이미지 리스트를 DTO에 추가
List<String> imageUrls = tourData.getImages().stream()
.map(image -> image.getUrl()) // 여기를 수정
.map(image -> image.getOriginimgurl()) // 여기를 수정
.collect(Collectors.toList());
tourDataDto.setOriginimgurl(imageUrls);

Expand Down Expand Up @@ -505,7 +497,7 @@ public void updateTourDataImageUrls(TourData tourData) {

// TourDataImage 객체 생성 및 저장
TourDataImage tourDataImage = new TourDataImage();
tourDataImage.setUrl(originimgurl);
tourDataImage.setOriginimgurl(originimgurl);
tourDataImage.setTourData(tourData); // 이미 전달된 TourData 객체 사용
tourDataImageRepository.save(tourDataImage);
}
Expand All @@ -525,7 +517,7 @@ public ApiResponse<List<TourDataResponseDto>> getTourDataListByKeyword(String ke
arr[0] + " " + arr[1],
tourData.getTitle(),
tourData.getContentId(),
tourData.getImages().isEmpty() ? null : tourData.getImages().get(0).getUrl(),
tourData.getImages().isEmpty() ? null : tourData.getImages().get(0).getOriginimgurl(),
tourData.getXMap(),
tourData.getYMap(),
"tourData"
Expand Down Expand Up @@ -558,7 +550,7 @@ public ApiResponse<List<TourDataResponseDto>> getTourDataListHome() {
arr[0] + " " + arr[1],
tourData.getTitle(),
tourData.getContentId(),
tourData.getImages().isEmpty() ? null : tourData.getImages().get(0).getUrl(),
tourData.getImages().isEmpty() ? null : tourData.getImages().get(0).getOriginimgurl(),
tourData.getXMap(),
tourData.getYMap(),
"tourData"
Expand Down Expand Up @@ -589,7 +581,7 @@ public ApiResponse<List<HomeResponseDto>> getHomeTourDataList() {
tourData.getContentId(),
tourData.getTitle(),
arr[0] + " " + arr[1],
tourData.getImages().get(0).getUrl() // 첫 번째 이미지 가져오기
tourData.getImages().get(0).getOriginimgurl() // 첫 번째 이미지 가져오기
);
})
.toList();
Expand All @@ -613,7 +605,7 @@ public ApiResponse<DetailResponseDto> getTourDataDetail(String id) {
weather.temperature(),
tourData.getInfoCenter(),
tourData.getIntroduction(),
tourData.getImages().get(0).getUrl(),
tourData.getImages().get(0).getOriginimgurl(),
tourData.getXMap(),
tourData.getYMap()
);
Expand Down

0 comments on commit 85c8aa4

Please sign in to comment.