Skip to content

Commit

Permalink
chore: validate birthDate, lastCheckUp and nextCheckUp of Pet class
Browse files Browse the repository at this point in the history
  • Loading branch information
Hsbalazs committed Sep 10, 2024
1 parent e94eb2a commit 159408d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.greenfoxacademy.backend.dtos;

import jakarta.validation.constraints.FutureOrPresent;
import jakarta.validation.constraints.NotBlank;
import java.util.Date;

import jakarta.validation.constraints.PastOrPresent;
import lombok.Data;

/**
Expand All @@ -17,8 +20,10 @@ public class PetDetailsDto {
String breed;
@NotBlank
String sex;
@NotBlank
@PastOrPresent(message = "The birth date must be in the past or present")
Date birthDate;
@PastOrPresent(message = "The last check-up date must be in the past or present")
Date lastCheckUp;
@FutureOrPresent(message = "The next check-up date must be in the future or present")
Date nextCheckUp;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
* Repository to manage Pet entities.
*/
public interface PetRepository extends JpaRepository<Pet, Integer> {
List<Pet> findAllByOwnerId(Integer owner);
List<Pet> findAllByOwnerId(Integer ownerId);
}

0 comments on commit 159408d

Please sign in to comment.