Files

File: src/main/java/com/paymentlink/model/entity/PaymentLinkItem.java

1 package com.paymentlink.model.entity;
2
3 import com.fasterxml.jackson.annotation.JsonBackReference;
4 import jakarta.persistence.*;
5 import lombok.AllArgsConstructor;
6 import lombok.Builder;
7 import lombok.Data;
8 import lombok.NoArgsConstructor;
9
10 @Entity
11 @Table(name = "payment_link_items")
12 @Data
13 @NoArgsConstructor
14 @AllArgsConstructor
15 @Builder
16 public class PaymentLinkItem {
17
18 @Id
19 @GeneratedValue(strategy = GenerationType.IDENTITY)
20 private Long id;
21
22 @ManyToOne(fetch = FetchType.LAZY)
23 @JoinColumn(name = "payment_link_id", nullable = false)
24 @JsonBackReference
25 private PaymentLink paymentLink;
26
27 @Column(name = "product_id", nullable = false)
28 private Long productId;
29
30 @Column(name = "product_name", nullable = false)
31 private String productName;
32
33 @Column(nullable = false)
34 private Integer quantity;
35
36 @Column(nullable = false)
37 private Long price; // Price per item in cents
38 }
39
40