add validation in request
This commit is contained in:
@@ -2,15 +2,31 @@ package com.billpaymentservice.bbps.dto.auth;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.request.BaseClass;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class RegisterRequest extends BaseClass {
|
||||
|
||||
@NotNull(message = "Mobile number cannot be null.")
|
||||
@Size(min = 10, max = 10, message = "Mobile number must be exactly 10 digits.")
|
||||
@Pattern(regexp = "^[0-9]{10}$", message = "Mobile number must contain only 10 digits.")
|
||||
private String mobile;
|
||||
|
||||
@NotNull(message = "Name cannot be null.")
|
||||
@Size(min = 2, max = 100, message = "Name must be between 2 and 100 characters.")
|
||||
private String name;
|
||||
|
||||
@NotNull(message = "Email cannot be null.")
|
||||
@Email(message = "Email must be a valid email address.")
|
||||
private String email;
|
||||
|
||||
@NotNull(message = "Registration token cannot be null.")
|
||||
private String registrationToken;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user