Fix bugs caused by Expense/Income controllers
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
@@ -12,8 +14,10 @@ public class Expense {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long expenseId;
|
||||
|
||||
@ManyToOne
|
||||
@ManyToOne()
|
||||
@JoinColumn(name = "user_uuid")
|
||||
@ToString.Exclude
|
||||
@JsonIgnore
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
@@ -15,6 +17,8 @@ public class Income {
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_uuid")
|
||||
@ToString.Exclude
|
||||
@JsonIgnore
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -32,9 +29,11 @@ public class User {
|
||||
@Transient
|
||||
private String password;
|
||||
|
||||
@OneToMany(mappedBy = "user")
|
||||
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
|
||||
@ToString.Exclude
|
||||
private List<Expense> expenses;
|
||||
|
||||
@OneToMany(mappedBy = "user")
|
||||
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
|
||||
@ToString.Exclude
|
||||
private List<Income> incomes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user