add validation

This commit is contained in:
mirrerror
2023-11-15 09:16:27 +02:00
parent 2d981c5af8
commit fb2695e58a
23 changed files with 314 additions and 62 deletions

View File

@@ -1,6 +1,8 @@
package com.faf223.expensetrackerfaf.dto;
import com.faf223.expensetrackerfaf.model.IncomeCategory;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -10,9 +12,19 @@ import java.time.LocalDate;
@Data
@AllArgsConstructor
public class IncomeDTO {
@NotNull(message = "ID must not be null")
private long incomeId;
@NotNull(message = "User must not be null")
private UserDTO userDTO;
@NotNull(message = "Category must not be null")
private IncomeCategory incomeCategory;
@NotNull(message = "Date must not be null")
private LocalDate date;
@NotNull(message = "Amount must not be null")
@DecimalMin(value = "0.0", inclusive = false, message = "Amount must be positive")
private BigDecimal amount;
}