39 lines
792 B
Java
39 lines
792 B
Java
package com.faf223.expensetrackerfaf.model;
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
import jakarta.persistence.*;
|
|
import lombok.*;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalDate;
|
|
|
|
@Data
|
|
@AllArgsConstructor
|
|
@NoArgsConstructor
|
|
@Entity(name = "expenses")
|
|
public class Expense implements IMoneyTransaction {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@Getter(AccessLevel.NONE)
|
|
private Long expenseId;
|
|
|
|
@ManyToOne()
|
|
@JoinColumn(name = "user_uuid")
|
|
@ToString.Exclude
|
|
@JsonIgnore
|
|
private User user;
|
|
|
|
@ManyToOne
|
|
@JoinColumn(name = "category_id")
|
|
private ExpenseCategory category;
|
|
|
|
private LocalDate date;
|
|
private BigDecimal amount;
|
|
|
|
@Override
|
|
public Long getId() {
|
|
return expenseId;
|
|
}
|
|
|
|
}
|
|
|