Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -20,7 +20,7 @@ public class ExpenseMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ExpenseDTO toDto(Expense expense) {
|
public ExpenseDTO toDto(Expense expense) {
|
||||||
return new ExpenseDTO(expense.getExpenseId(), userMapper.toDto(expense.getUser()),
|
return new ExpenseDTO(expense.getId(), userMapper.toDto(expense.getUser()),
|
||||||
expense.getCategory(), expense.getDate(), expense.getAmount());
|
expense.getCategory(), expense.getDate(), expense.getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.faf223.expensetrackerfaf.dto.mappers;
|
|||||||
|
|
||||||
import com.faf223.expensetrackerfaf.dto.IncomeCreationDTO;
|
import com.faf223.expensetrackerfaf.dto.IncomeCreationDTO;
|
||||||
import com.faf223.expensetrackerfaf.dto.IncomeDTO;
|
import com.faf223.expensetrackerfaf.dto.IncomeDTO;
|
||||||
import com.faf223.expensetrackerfaf.model.Expense;
|
|
||||||
import com.faf223.expensetrackerfaf.model.Income;
|
import com.faf223.expensetrackerfaf.model.Income;
|
||||||
import com.faf223.expensetrackerfaf.service.IncomeService;
|
import com.faf223.expensetrackerfaf.service.IncomeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -21,7 +20,7 @@ public class IncomeMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IncomeDTO toDto(Income income) {
|
public IncomeDTO toDto(Income income) {
|
||||||
return new IncomeDTO(income.getIncomeId(), userMapper.toDto(income.getUser()),
|
return new IncomeDTO(income.getId(), userMapper.toDto(income.getUser()),
|
||||||
income.getCategory(), income.getDate(), income.getAmount());
|
income.getCategory(), income.getDate(), income.getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +1,35 @@
|
|||||||
package com.faf223.expensetrackerfaf.model;
|
package com.faf223.expensetrackerfaf.model;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Entity(name = "credentials")
|
@Entity(name = "credentials")
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Credential {
|
public class Credential {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long credentialId;
|
private Long credentialId;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "user_uuid")
|
@JoinColumn(name = "user_uuid")
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
private String email;
|
private String email;
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Role role;
|
private Role role;
|
||||||
|
|
||||||
public Credential(User user, String email, String password) {
|
public Credential(User user, String email, String password) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
|
||||||
this.role = Role.ROLE_USER;
|
this.role = Role.ROLE_USER;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.faf223.expensetrackerfaf.model;
|
package com.faf223.expensetrackerfaf.model;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.*;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -13,10 +10,11 @@ import java.time.LocalDate;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity(name = "expenses")
|
@Entity(name = "expenses")
|
||||||
public class Expense {
|
public class Expense implements IMoneyTransaction {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long expenseId;
|
@Column(name = "expense_id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne()
|
@ManyToOne()
|
||||||
@JoinColumn(name = "user_uuid")
|
@JoinColumn(name = "user_uuid")
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package com.faf223.expensetrackerfaf.model;
|
package com.faf223.expensetrackerfaf.model;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Entity(name = "expense_categories")
|
@Entity(name = "expense_categories")
|
||||||
public class ExpenseCategory {
|
public class ExpenseCategory implements IMoneyTransactionCategory {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long categoryId;
|
@Column(name = "category_id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
private String categoryName;
|
@Column(name = "category_name")
|
||||||
|
private String name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.faf223.expensetrackerfaf.model;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public interface IMoneyTransaction {
|
||||||
|
|
||||||
|
Long getId();
|
||||||
|
LocalDate getDate();
|
||||||
|
User getUser();
|
||||||
|
BigDecimal getAmount();
|
||||||
|
IMoneyTransactionCategory getCategory();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.faf223.expensetrackerfaf.model;
|
||||||
|
|
||||||
|
public interface IMoneyTransactionCategory {
|
||||||
|
Long getId();
|
||||||
|
String getName();
|
||||||
|
}
|
||||||
@@ -2,10 +2,8 @@ package com.faf223.expensetrackerfaf.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.*;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
@@ -13,10 +11,11 @@ import java.time.LocalDate;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity(name = "incomes")
|
@Entity(name = "incomes")
|
||||||
public class Income {
|
public class Income implements IMoneyTransaction {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long incomeId;
|
@Column(name = "income_id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "user_uuid")
|
@JoinColumn(name = "user_uuid")
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
package com.faf223.expensetrackerfaf.model;
|
package com.faf223.expensetrackerfaf.model;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Entity(name = "income_categories")
|
@Entity(name = "income_categories")
|
||||||
public class IncomeCategory {
|
public class IncomeCategory implements IMoneyTransactionCategory {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long categoryId;
|
@Column(name = "category_id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
private String categoryName;
|
@Column(name = "category_name")
|
||||||
|
private String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package com.faf223.expensetrackerfaf.model;
|
package com.faf223.expensetrackerfaf.model;
|
||||||
|
|
||||||
public enum Role {
|
public enum Role {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package com.faf223.expensetrackerfaf.model;
|
package com.faf223.expensetrackerfaf.model;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.faf223.expensetrackerfaf.util;
|
|
||||||
|
|
||||||
import com.faf223.expensetrackerfaf.model.User;
|
|
||||||
|
|
||||||
public interface IMoneyTransaction {
|
|
||||||
|
|
||||||
User getUser();
|
|
||||||
int getAmount();
|
|
||||||
String getCategory();
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user