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

refactor: 숙소, 숙소 이미지, 객실 테이블에 comment를 추가합니다. #95

Merged
merged 2 commits into from
Dec 5, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Comment;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand All @@ -26,19 +27,26 @@ public class Product {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("숙소 식별자")
private Long id;
@Column(nullable = false)
@Comment("숙소 이름")
private String name;
@Column(nullable = false)
@Comment("숙소 위치")
private String address;
@Column(nullable = false)
@Convert(converter = CategoryConverter.class)
@Comment("숙소 카테고리")
private Category category;
@Column(columnDefinition = "TEXT", nullable = false)
@Comment("숙소 설명")
private String description;
@ColumnDefault("0")
@Comment("숙소 평점")
private float starAvg;
@Column(columnDefinition = "TEXT", nullable = false)
@Comment("숙소 대표 이미지 URL")
private String thumbnail;
@OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
private List<ProductImage> photoUrls = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;


@Getter
Expand All @@ -21,11 +22,14 @@ public class ProductImage {

@Id
@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;

@Builder
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/fc/shimpyo_be/domain/room/entity/Room.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand All @@ -22,23 +23,32 @@ public class Room {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("객실 식별자")
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "product_id")
@Comment("숙소 식별자")
private Product product;
@Column(length = 30)
@Comment("객실 이름")
private String name;
@Column(nullable = false)
@Comment("객실 설명")
private String description;
@Column(columnDefinition = "TINYINT")
@Comment("객실 기준인원")
private int standard;
@Column(columnDefinition = "TINYINT")
@Comment("객실 최대인원")
private int capacity;
@Column(columnDefinition = "TIME")
@Comment("객실 체크인 시간")
private LocalTime checkIn;
@Column(columnDefinition = "TIME")
@Comment("객실 체크아웃 시간")
private LocalTime checkOut;
@Column(nullable = false)
@Comment("객실 가격")
private int price;

@Builder
Expand Down