Skip to content

Commit

Permalink
Refactor: Added validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Am0du committed Aug 27, 2024
1 parent 57262f4 commit 06d40d5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/hng_java_boilerplate/product/dto/ProductDTO.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package hng_java_boilerplate.product.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -13,12 +15,28 @@
@NoArgsConstructor
@AllArgsConstructor
public class ProductDTO {

private String id;
@NotNull(message = "Name is required")
@NotBlank(message = "Name is required")
private String name;

@NotNull(message = "Name is required")
@NotBlank(message = "Name is required")
private String description;

@NotNull(message = "Name is required")
@NotBlank(message = "Name is required")
private String category;

@NotNull(message = "Name is required")
@NotBlank(message = "Name is required")
private Double price;

@NotNull(message = "Name is required")
@NotBlank(message = "Name is required")
private String image_url;

private LocalDateTime created_at;
private LocalDateTime updated_at;
}

0 comments on commit 06d40d5

Please sign in to comment.