package com.imprimelibros.erp.cart; import jakarta.persistence.*; import java.time.LocalDateTime; import com.imprimelibros.erp.presupuesto.dto.Presupuesto; @Entity @Table( name = "cart_items", uniqueConstraints = @UniqueConstraint(name="uq_cartitem_unique", columnNames={"cart_id","presupuesto_id"}) ) public class CartItem { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "cart_id", nullable = false) private Cart cart; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "presupuesto_id", nullable = false) private Presupuesto presupuesto; @Column(name = "created_at", nullable = false) private LocalDateTime createdAt = LocalDateTime.now(); // Getters & Setters public Long getId() { return id; } public Cart getCart() { return cart; } public void setCart(Cart cart) { this.cart = cart; } public Presupuesto getPresupuesto() { return presupuesto; } public void setPresupuesto(Presupuesto presupuesto) { this.presupuesto = presupuesto; } public LocalDateTime getCreatedAt() { return createdAt; } }