diff --git a/src/main/java/co/orange/ddanzi/domain/order/PaymentHistory.java b/src/main/java/co/orange/ddanzi/domain/order/PaymentHistory.java new file mode 100644 index 00000000..90974757 --- /dev/null +++ b/src/main/java/co/orange/ddanzi/domain/order/PaymentHistory.java @@ -0,0 +1,40 @@ +package co.orange.ddanzi.domain.order; + + +import co.orange.ddanzi.domain.order.enums.PayStatus; +import jakarta.persistence.*; +import lombok.Builder; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@NoArgsConstructor +@Table(name = "payment_histories") +@Entity +public class PaymentHistory { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "payment_history_id") + private Long id; + + @Column(name = "buyer_id") + private Long buyerId; + + @Column(name = "pay_status") + private PayStatus payStatus; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "payment_id") + private Payment payment; + + @Column + private LocalDateTime createAt; + + @Builder + public PaymentHistory(Long buyerId, PayStatus payStatus, Payment payment, LocalDateTime createAt) { + this.buyerId = buyerId; + this.payStatus = payStatus; + this.payment = payment; + this.createAt = createAt; + } +} diff --git a/src/main/java/co/orange/ddanzi/repository/PaymentHistoryRepository.java b/src/main/java/co/orange/ddanzi/repository/PaymentHistoryRepository.java new file mode 100644 index 00000000..bdd60038 --- /dev/null +++ b/src/main/java/co/orange/ddanzi/repository/PaymentHistoryRepository.java @@ -0,0 +1,7 @@ +package co.orange.ddanzi.repository; + +import co.orange.ddanzi.domain.order.PaymentHistory; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface PaymentHistoryRepository extends JpaRepository { +}