Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Open API에서 더 많은 정보를 활용하도록 구현 #102

Merged
merged 30 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
af7e9ae
#87 feat: 숙소 위치 엔터티 생성
JeongUijeong Dec 6, 2023
1a37b2c
#87 refactor: 숙소 위치 엔터티 분리에 따른 숙소 엔터티 수정
JeongUijeong Dec 6, 2023
2eae19b
#87 feat: 숙소 옵션 엔터티 생성
JeongUijeong Dec 6, 2023
49d852a
#87 refactor: 숙소 옵션 추가
JeongUijeong Dec 6, 2023
42b8065
#87 feat: 숙소 부대시설 엔터티 생성
JeongUijeong Dec 6, 2023
b1a30b0
#87 refactor: 숙소 부대시설 추가
JeongUijeong Dec 6, 2023
5d68175
#87 feat: 객실 이미지 엔터티 생성
JeongUijeong Dec 6, 2023
807a666
#87 refactor: 객실 이미지 추가
JeongUijeong Dec 6, 2023
e7e857d
#87 feat: 객실 옵션 엔터티 생성
JeongUijeong Dec 6, 2023
4bdde70
#87 refactor: 객실 옵션 추가
JeongUijeong Dec 6, 2023
49bd7a3
refactor: 숙소 옵션, 부대시설 속성 코멘트 추가
JeongUijeong Dec 6, 2023
3f44fb4
refactor: 숙소 이미지 필드 순서 수정
JeongUijeong Dec 6, 2023
228526b
#87 feat: 객실 가격 엔터티 생성
JeongUijeong Dec 6, 2023
b006123
#87 refactor: 객실 가격 엔터티 분리 적용
JeongUijeong Dec 6, 2023
a61a0c4
#87 refactor: 숙소, 객실 관련 엔터티 수정에 따른 코드 임시 수정
JeongUijeong Dec 6, 2023
d8582e5
#87 refactor: 객실 가격 엔터티 분리에 따라 로직 임시 수정
JeongUijeong Dec 6, 2023
3c9b041
#87 refactor: 객실 가격 엔터티 분리에 따라 로직 임시 수정
JeongUijeong Dec 6, 2023
6e5ea76
#87 refactor: 객실 가격 엔터티 분리에 따라 코드 수정
JeongUijeong Dec 6, 2023
e1732b6
#87 refactor: 숙소 주소 엔터티 분리에 따라 코드 수정
JeongUijeong Dec 6, 2023
ff11098
#94 feature:테이블 변경에 따른 dto및 mapper를 수정했습니다.
wocjf0513 Dec 7, 2023
cb8ff0d
#94 feature,fix: 시기마다 가격 변동에 의한 price picker 및 mapper 수정
wocjf0513 Dec 7, 2023
904eaa4
#94 test: 변경된 테이블에 맞게 숙소 test 수정
wocjf0513 Dec 7, 2023
0c82690
#94 fix: securityUtil이 mock으로 설정되있어, ioc 컨테이너에 등록 안
wocjf0513 Dec 7, 2023
24d70c6
#94 refactor: 사용되지 않은 import 구문 삭제
wocjf0513 Dec 7, 2023
1f4ddc7
#87 test: 테이블 변경에 따른 예약 Unit Test 수정
jo0oy Dec 7, 2023
708fc21
#87 feat: 객실 이미지 레포지토리 생성
JeongUijeong Dec 8, 2023
3db1d43
#87 refactor: 객실 이미지 설명 추가
JeongUijeong Dec 8, 2023
b87c747
#87 refactor: 객실 코드 추가 및 엔터티 수정
JeongUijeong Dec 8, 2023
40aeb0c
#87 refactor: Open API에서 더 많은 정보를 불러와 저장하도록 수정
JeongUijeong Dec 8, 2023
7137160
fix: 주석 삭제
JeongUijeong Dec 8, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public ResponseEntity<ResponseDto<List<ProductResponse>>> getProducts(
.productName(productName).address(address).category(category).build();

return ResponseEntity.ok(ResponseDto.res(HttpStatus.OK,
productService.getProducts(searchKeywordRequest, pageable), "상품 목록을 성공적으로 조회했습니다."));
productService.getProducts(searchKeywordRequest, pageable), "숙소 목록을 성공적으로 조회했습니다."));
}


Expand All @@ -62,7 +62,7 @@ public ResponseEntity<ResponseDto<ProductDetailsResponse>> getProductDetails(
}

return ResponseEntity.ok(ResponseDto.res(HttpStatus.OK,
productService.getProductDetails(productId, startDate, endDate), "상품을 성공적으로 조회했습니다."));
productService.getProductDetails(productId, startDate, endDate), "숙소을 성공적으로 조회했습니다."));
}

@GetMapping("/amounts/{roomId}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.fc.shimpyo_be.domain.product.dto.response;

import lombok.Builder;

public record ProductAmenityResponse(

boolean barbecue,
boolean beauty,
boolean beverage,
boolean bicycle,
boolean campfire,
boolean fitness,
boolean karaoke,
boolean publicBath,
boolean publicPc,
boolean sauna,
boolean sports,
boolean seminar
) {

@Builder
public ProductAmenityResponse(boolean barbecue, boolean beauty, boolean beverage, boolean bicycle,
boolean campfire, boolean fitness, boolean karaoke, boolean publicBath, boolean publicPc,
boolean sauna, boolean sports, boolean seminar) {
this.barbecue = barbecue;
this.beauty = beauty;
this.beverage = beverage;
this.bicycle = bicycle;
this.campfire = campfire;
this.fitness = fitness;
this.karaoke = karaoke;
this.publicBath = publicBath;
this.publicPc = publicPc;
this.sauna = sauna;
this.sports = sports;
this.seminar = seminar;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package com.fc.shimpyo_be.domain.product.dto.response;

import com.fc.shimpyo_be.domain.product.entity.Amenity;
import com.fc.shimpyo_be.domain.product.entity.ProductImage;
import com.fc.shimpyo_be.domain.room.dto.response.RoomResponse;

import java.util.List;

import lombok.Builder;

public record ProductDetailsResponse(Long productId, String category, String address,
String productName, String description, Boolean favorites,
Float starAvg,

String productName,
String description, Boolean favorites, Float starAvg,
List<String> images,

ProductAmenityResponse productAmenityResponse,
ProductOptionResponse productOptionResponse,
List<RoomResponse> rooms) {


@Builder
public ProductDetailsResponse(Long productId, String category, String address,
String productName, String description, Boolean favorites, Float starAvg,
List<String> images, List<RoomResponse> rooms) {
List<String> images, ProductAmenityResponse productAmenityResponse,
ProductOptionResponse productOptionResponse, List<RoomResponse> rooms) {
this.productId = productId;
this.category = category;
this.address = address;
Expand All @@ -24,6 +30,8 @@ public ProductDetailsResponse(Long productId, String category, String address,
this.favorites = favorites;
this.starAvg = starAvg;
this.images = images;
this.productAmenityResponse = productAmenityResponse;
this.productOptionResponse = productOptionResponse;
this.rooms = rooms;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.fc.shimpyo_be.domain.product.dto.response;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;

public record ProductOptionResponse(
boolean cooking,
boolean parking,
boolean pickup,
String foodPlace,
String infoCenter

) {
@Builder
public ProductOptionResponse(boolean cooking, boolean parking, boolean pickup,
String foodPlace,
String infoCenter) {
this.cooking = cooking;
this.parking = parking;
this.pickup = pickup;
this.foodPlace = foodPlace;
this.infoCenter = infoCenter;
}
}
44 changes: 44 additions & 0 deletions src/main/java/com/fc/shimpyo_be/domain/product/entity/Address.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.fc.shimpyo_be.domain.product.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Address {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("숙소 위치 식별자")
private Long id;
@Column(nullable = false)
@Comment("숙소 주소")
private String address;
@Column(nullable = false)
@Comment("숙소 상세 주소")
private String detailAddress;
@Column(nullable = false)
@Comment("숙소 X좌표")
private double mapX;
@Column(nullable = false)
@Comment("숙소 Y좌표")
private double mapY;

@Builder
public Address(Long id, String address, String detailAddress, double mapX, double mapY) {
this.id = id;
this.address = address;
this.detailAddress = detailAddress;
this.mapX = mapX;
this.mapY = mapY;
}
}
78 changes: 78 additions & 0 deletions src/main/java/com/fc/shimpyo_be/domain/product/entity/Amenity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.fc.shimpyo_be.domain.product.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Amenity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("숙소 부대시설 식별자")
private Long id;
@Column(nullable = false)
@Comment("바비큐장 여부")
private boolean barbecue;
@Column(nullable = false)
@Comment("뷰티시설 여부")
private boolean beauty;
@Column(nullable = false)
@Comment("식음료장 여부")
private boolean beverage;
@Column(nullable = false)
@Comment("자전거 대여 여부")
private boolean bicycle;
@Column(nullable = false)
@Comment("캠프파이어 여부")
private boolean campfire;
@Column(nullable = false)
@Comment("휘트니스 센터 여부")
private boolean fitness;
@Column(nullable = false)
@Comment("노래방 여부")
private boolean karaoke;
@Column(nullable = false)
@Comment("공동 샤워실 여부")
private boolean publicBath;
@Column(nullable = false)
@Comment("공동 PC실 여부")
private boolean publicPc;
@Column(nullable = false)
@Comment("사우나 여부")
private boolean sauna;
@Column(nullable = false)
@Comment("스포츠 시설 여부")
private boolean sports;
@Column(nullable = false)
@Comment("세미나실 여부")
private boolean seminar;

@Builder
public Amenity(Long id, boolean barbecue, boolean beauty, boolean beverage, boolean bicycle,
boolean campfire, boolean fitness, boolean karaoke, boolean publicBath, boolean publicPc,
boolean sauna, boolean sports, boolean seminar) {
this.id = id;
this.barbecue = barbecue;
this.beauty = beauty;
this.beverage = beverage;
this.bicycle = bicycle;
this.campfire = campfire;
this.fitness = fitness;
this.karaoke = karaoke;
this.publicBath = publicBath;
this.publicPc = publicPc;
this.sauna = sauna;
this.sports = sports;
this.seminar = seminar;
}
}
21 changes: 17 additions & 4 deletions src/main/java/com/fc/shimpyo_be/domain/product/entity/Product.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import java.util.ArrayList;
import java.util.List;
import lombok.AccessLevel;
Expand All @@ -32,9 +33,9 @@ public class Product {
@Column(nullable = false)
@Comment("숙소 이름")
private String name;
@Column(nullable = false)
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@Comment("숙소 위치")
private String address;
private Address address;
@Column(nullable = false)
@Convert(converter = CategoryConverter.class)
@Comment("숙소 카테고리")
Expand All @@ -48,21 +49,33 @@ public class Product {
@Column(columnDefinition = "TEXT", nullable = false)
@Comment("숙소 대표 이미지 URL")
private String thumbnail;
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@Comment("숙소 옵션 식별자")
private ProductOption productOption;
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@Comment("숙소 부대시설 식별자")
private Amenity amenity;
@OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
private List<ProductImage> photoUrls = new ArrayList<>();
@OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
private List<Room> rooms = new ArrayList<>();


@Builder
public Product(Long id, String name, String address, Category category, String description,
float starAvg, String thumbnail) {
public Product(Long id, String name, Address address, Category category, String description,
float starAvg, String thumbnail, ProductOption productOption, Amenity amenity,
List<ProductImage> photoUrls, List<Room> rooms) {
this.id = id;
this.name = name;
this.address = address;
this.category = category;
this.description = description;
this.starAvg = starAvg;
this.thumbnail = thumbnail;
this.productOption = productOption;
this.amenity = amenity;
this.photoUrls = photoUrls;
this.rooms = rooms;
}

public void updateStarAvg(float starAvg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ public class ProductImage {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("숙소 이미지 식별자")
private Long id;
@Column(nullable = false, columnDefinition = "TEXT")
@Comment("숙소 사진 URL")
private String photoUrl;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false, name = "product_id")
@Comment("숙소 식별자")
private Product product;
@Column(nullable = false, columnDefinition = "TEXT")
@Comment("숙소 사진 URL")
private String photoUrl;

@Builder
public ProductImage(Long id, String photoUrl, Product product) {
public ProductImage(Long id, Product product, String photoUrl) {
this.id = id;
this.photoUrl = photoUrl;
this.product = product;
this.photoUrl = photoUrl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.fc.shimpyo_be.domain.product.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class ProductOption {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("숙소 옵션 식별자")
private Long id;
@Column(nullable = false)
@Comment("객실 내 취사 여부")
private boolean cooking;
@Column(nullable = false)
@Comment("주차 시설 여부")
private boolean parking;
@Column(nullable = false)
@Comment("픽업 서비스 여부")
private boolean pickup;
@Column(nullable = false)
@Comment("식음료장")
private String foodPlace;
@Column(nullable = true)
@Comment("문의 및 안내")
private String infoCenter;

@Builder
public ProductOption(Long id, boolean cooking, boolean parking, boolean pickup,
String foodPlace,
String infoCenter) {
this.id = id;
this.cooking = cooking;
this.parking = parking;
this.pickup = pickup;
this.foodPlace = foodPlace;
this.infoCenter = infoCenter;
}
}
Loading