-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from GlobeDaBoarder/dev
Dev -> master: name and surname update
- Loading branch information
Showing
18 changed files
with
167 additions
and
14 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.openapi-generator/user.yaml-generate-user-spring-controllers.sha256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1e2aa971ec97b1bd78a451195d7fa53e0fe3ca4cbd2ac1c9cec78da943702e00 | ||
41ced36deafe737a87868e6f537bb404c4732836183115d245fac14a8efd14fe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
public record LoginRequestDto( | ||
@NotBlank(message = "email is required") | ||
@Email(regexp = ValidationConstants.emailRegex) | ||
@Email(regexp = ValidationConstants.EMAIL) | ||
@Schema(example = "[email protected]") | ||
String email, | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/ua/rivnegray/boardgames_shop/DTO/request/update/UpdateNameAndSurnameDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ua.rivnegray.boardgames_shop.DTO.request.update; | ||
|
||
import ua.rivnegray.boardgames_shop.utils.validation.annotation.NameAndSurname; | ||
|
||
public record UpdateNameAndSurnameDto( | ||
@NameAndSurname | ||
String nameAndSurname) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
src/main/java/ua/rivnegray/boardgames_shop/utils/validation/ValidationConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/ua/rivnegray/boardgames_shop/utils/validation/annotation/NameAndSurname.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ua.rivnegray.boardgames_shop.utils.validation.annotation; | ||
|
||
import jakarta.validation.Constraint; | ||
import jakarta.validation.Payload; | ||
import ua.rivnegray.boardgames_shop.utils.validation.validator.NameAndSurnameValidator; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Documented | ||
@Constraint(validatedBy = NameAndSurnameValidator.class) | ||
@Target(ElementType.FIELD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface NameAndSurname { | ||
String message() default "Invalid name and surname format!"; | ||
Class<?>[] groups() default { }; | ||
Class<? extends Payload>[] payload() default { }; | ||
} |
22 changes: 22 additions & 0 deletions
22
...java/ua/rivnegray/boardgames_shop/utils/validation/validator/NameAndSurnameValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ua.rivnegray.boardgames_shop.utils.validation.validator; | ||
|
||
import jakarta.validation.ConstraintValidator; | ||
import jakarta.validation.ConstraintValidatorContext; | ||
import ua.rivnegray.boardgames_shop.utils.validation.ValidationConstants; | ||
import ua.rivnegray.boardgames_shop.utils.validation.annotation.NameAndSurname; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public class NameAndSurnameValidator implements ConstraintValidator<NameAndSurname, String> { | ||
private Pattern pattern; | ||
@Override | ||
public void initialize(NameAndSurname constraintAnnotation) { | ||
pattern = Pattern.compile(ValidationConstants.NAME_AND_SURNAME); | ||
} | ||
@Override | ||
public boolean isValid(String nameAndSurname, ConstraintValidatorContext constraintValidatorContext) { | ||
if (nameAndSurname == null) | ||
return false; | ||
return pattern.matcher(nameAndSurname).matches(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters