add validation
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
package com.faf223.expensetrackerfaf.dto;
|
||||
|
||||
import com.faf223.expensetrackerfaf.model.IncomeCategory;
|
||||
import com.faf223.expensetrackerfaf.model.User;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class IncomeCreationDTO {
|
||||
@NotNull(message = "Category must not be null")
|
||||
private int incomeCategory;
|
||||
|
||||
@NotNull(message = "Amount must not be null")
|
||||
@DecimalMin(value = "0.0", inclusive = false, message = "Amount must be positive")
|
||||
private BigDecimal amount;
|
||||
}
|
||||
Reference in New Issue
Block a user