feat: payment date
This commit is contained in:
parent
f30f896f7b
commit
742450b672
2 changed files with 7 additions and 1 deletions
|
@ -7,6 +7,7 @@ import lombok.Setter;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
|
@ -64,8 +65,11 @@ public class Expense extends AbstractEntity {
|
|||
@Column(name = "Date", nullable = false, columnDefinition = "DATE DEFAULT CURRENT_DATE")
|
||||
private LocalDate date;
|
||||
|
||||
@Column(name = "PaymentDate")
|
||||
private LocalDateTime paymentDate;
|
||||
|
||||
/**
|
||||
* the isResolved field starts as always false, cause at creation an expense cant be already be resolved
|
||||
* the isResolved field starts as always false
|
||||
*/
|
||||
@Column(name = "isResolved", nullable = false)
|
||||
private Boolean isResolved = false;
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -51,6 +52,7 @@ public class ExpenseService {
|
|||
public List<Expense> findAll() {return repository.findAll();}
|
||||
|
||||
public void update(Expense entity) {
|
||||
if (Boolean.TRUE.equals(entity.getIsResolved())) entity.setPaymentDate(LocalDateTime.now());
|
||||
repository.save(entity);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue