Merge updates from master
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Table(name = "Department", schema = "HumanResources")
|
||||
public class BasicEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "DepartmentID")
|
||||
private Short departmentId;
|
||||
|
||||
@Column(name = "GroupName", nullable = false, length = 50)
|
||||
private String groupName;
|
||||
|
||||
@Column(name = "ModifiedDate", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date modifiedDate;
|
||||
|
||||
@Column(name = "Name", nullable = false, length = 50)
|
||||
private String name;
|
||||
|
||||
public Short getDepartmentId() {
|
||||
return departmentId;
|
||||
}
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
public Date getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
public class Categories {
|
||||
|
||||
public enum ExpenseCategory {
|
||||
CREDIT, BUY, BUSINESS, ENTERTAINMENT, RESTAURANTS_AND_CAFE, COMMUNAL_PAYMENTS, SUPERMARKET, MISC;
|
||||
|
||||
public String getEffectiveName() {
|
||||
return Categories.getEffectiveName(this.name());
|
||||
}
|
||||
}
|
||||
|
||||
public enum IncomeCategory {
|
||||
P2P, SALARY, GIFT, CREDIT, MISC;
|
||||
|
||||
public String getEffectiveName() {
|
||||
return Categories.getEffectiveName(this.name());
|
||||
}
|
||||
}
|
||||
|
||||
private static String getEffectiveName(String name) {
|
||||
String[] arr = name.split("_");
|
||||
StringBuilder result = new StringBuilder();
|
||||
for(String entry : arr) {
|
||||
String[] entryArr = entry.split("");
|
||||
StringBuilder builder = new StringBuilder(entryArr[0]);
|
||||
for(int i = 1; i < entry.length(); i++) builder.append(entryArr[i].toLowerCase());
|
||||
result.append(builder).append(" ");
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity(name = "credentials")
|
||||
public class Credential {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long credentialId;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_uuid")
|
||||
private User user;
|
||||
|
||||
private String email;
|
||||
private String password;
|
||||
}
|
||||
|
||||
@@ -1,63 +1,26 @@
|
||||
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
import com.faf223.expensetrackerfaf.util.IMoneyTransaction;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Entity
|
||||
@Table(name = "expense")
|
||||
public class Expense implements IMoneyTransaction {
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Entity(name = "expenses")
|
||||
public class Expense {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
private Long expenseId;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||
@JoinColumn(name = "user_uuid")
|
||||
private User user;
|
||||
private int amount;
|
||||
private Categories.ExpenseCategory category;
|
||||
|
||||
public Expense(User user, int amount, Categories.ExpenseCategory category) {
|
||||
this.user = user;
|
||||
this.amount = amount;
|
||||
this.category = category;
|
||||
}
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "category_id")
|
||||
private ExpenseCategory category;
|
||||
|
||||
public Expense() {}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategory() {
|
||||
return category.getEffectiveName();
|
||||
}
|
||||
|
||||
public void setCategory(Categories.ExpenseCategory category) {
|
||||
this.category = category;
|
||||
}
|
||||
private LocalDate date;
|
||||
private BigDecimal amount;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity(name = "expense_categories")
|
||||
public class ExpenseCategory {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long categoryId;
|
||||
|
||||
private String categoryName;
|
||||
}
|
||||
@@ -1,63 +1,26 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import com.faf223.expensetrackerfaf.util.IMoneyTransaction;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Entity
|
||||
@Table(name = "income")
|
||||
public class Income implements IMoneyTransaction {
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Entity(name = "incomes")
|
||||
public class Income {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
private Long incomeId;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||
@JoinColumn(name = "user_uuid")
|
||||
private User user;
|
||||
private int amount;
|
||||
private Categories.IncomeCategory category;
|
||||
|
||||
public Income(User user, int amount, Categories.IncomeCategory category) {
|
||||
this.user = user;
|
||||
this.amount = amount;
|
||||
this.category = category;
|
||||
}
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "category_id")
|
||||
private IncomeCategory category;
|
||||
|
||||
public Income() {}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategory() {
|
||||
return category.getEffectiveName();
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public void setCategory(Categories.IncomeCategory category) {
|
||||
this.category = category;
|
||||
}
|
||||
private LocalDate date;
|
||||
private BigDecimal amount;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.faf223.expensetrackerfaf.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity(name = "income_categories")
|
||||
public class IncomeCategory {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long categoryId;
|
||||
|
||||
private String categoryName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user