feat: added userId to entities
This commit is contained in:
parent
52ec376e4d
commit
73d1811d04
4 changed files with 8 additions and 1 deletions
|
@ -21,4 +21,7 @@ public class Category {
|
|||
|
||||
@Column(name = "Description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "userId", nullable = false, unique = true)
|
||||
private Long userId;
|
||||
}
|
||||
|
|
|
@ -64,4 +64,7 @@ public class Expense {
|
|||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "expenseType", nullable = false)
|
||||
private ExpenseType expenseType;
|
||||
|
||||
@Column(name = "userId", nullable = false, unique = true)
|
||||
private Long userId;
|
||||
}
|
|
@ -49,7 +49,7 @@ public class Person {
|
|||
@Column(name = "Username", unique = true)
|
||||
private String username; // This field will link to the User entity
|
||||
|
||||
@Column(name = "UserId", unique = true)
|
||||
@Column(name = "UserId", unique = true, nullable = false)
|
||||
private Long userId; // Reference to the User entity
|
||||
|
||||
@Override
|
||||
|
|
|
@ -146,6 +146,7 @@ public class ExpenseService {
|
|||
*/
|
||||
public void update(Expense entity) {
|
||||
if (Boolean.TRUE.equals(entity.getIsPaid())) entity.setPaymentDate(LocalDate.now());
|
||||
else entity.setPaymentDate(null);
|
||||
this.setExpenseType(entity);
|
||||
expenseRepository.save(entity);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue