java.lang.Object
org.ntnu.idi.idatt2106.sparesti.sparestibackend.validation.ObjectValidator<GoalCreateDTO>
org.ntnu.idi.idatt2106.sparesti.sparestibackend.validation.goal.GoalValidator

@Component public class GoalValidator extends ObjectValidator<GoalCreateDTO>
Validator class for fields in GoalCreateDTO
Since:
29.4.24
Version:
1.0
Author:
Harry L.X
  • Constructor Details

    • GoalValidator

      public GoalValidator()
  • Method Details

    • validate

      public void validate(GoalCreateDTO dto) throws BadInputException
      Validation method for dto field constraints. In addition, also checks that saved amount cannot be greater than target amount.
      Overrides:
      validate in class ObjectValidator<GoalCreateDTO>
      Parameters:
      dto - Object of type T
      Throws:
      BadInputException - If saved amount is greater than target
    • validateGoalIds

      public void validateGoalIds(List<Long> distinctGoalIds, List<Long> activeGoalIds)
      Validates that list of goal Id's for priority sorting match the active goal Id's
      Parameters:
      distinctGoalIds - Goal Id's with new sorting order
      activeGoalIds - Active goal Id's