Skip to content

Commit

Permalink
chore: Image entity 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
junseokkim committed Nov 14, 2023
1 parent 4f61942 commit adf9b1a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/main/java/zerobibim/flory/domain/Image/entity/Image.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package zerobibim.flory.domain.Image.entity;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.Where;
import zerobibim.flory.global.common.BaseTime;

@Entity
@Getter
@Where(clause = "deleted_at is null")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class Image extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false)
private String url;

private Long senderId;

private Boolean isNFT;

@Builder
public Image(String url) {
this.url = url;
this.isNFT = Boolean.FALSE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.Where;
import zerobibim.flory.domain.Image.entity.Image;
import zerobibim.flory.global.common.BaseTime;

@Entity
Expand All @@ -24,6 +25,10 @@ public class Flower extends BaseTime {
@Column(nullable = false)
private Long price;

@OneToOne
@JoinColumn
private Image image;

@Builder
public Flower(String name, String description, Long price) {
this.name = name;
Expand Down

0 comments on commit adf9b1a

Please sign in to comment.