Changed folder structure
This commit is contained in:
@@ -1,22 +1,39 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import com.faf223.expensetrackerfaf.util.IMoneyTransaction;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "income")
|
||||
public class Income implements IMoneyTransaction {
|
||||
|
||||
private long userId;
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||
private User user;
|
||||
private int amount;
|
||||
private Categories.IncomeCategory category;
|
||||
|
||||
public Income(long userId, int amount, Categories.IncomeCategory category) {
|
||||
this.userId = userId;
|
||||
public Income(User user, int amount, Categories.IncomeCategory category) {
|
||||
this.user = user;
|
||||
this.amount = amount;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public Income() {}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,8 +46,8 @@ public class Income implements IMoneyTransaction {
|
||||
return category.getEffectiveName();
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
public void setUserId(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
|
||||
Reference in New Issue
Block a user