Commit 4a88ad00 authored by Jakub Balga's avatar Jakub Balga
Browse files

Merge branch 'feature/balga/reviewfix' into 'main'

Feature/balga/reviewfix

See merge request !50
parents 3007ef20 e888eb76
Pipeline #142402 passed with stages
in 2 minutes and 22 seconds
...@@ -18,10 +18,9 @@ import java.math.BigDecimal; ...@@ -18,10 +18,9 @@ import java.math.BigDecimal;
public class WineBottleDto extends PersistentDtoBase { public class WineBottleDto extends PersistentDtoBase {
/** /**
* name of the bottle, allows only alphanumerical characters * name of the bottle
*/ */
@NotBlank @NotBlank
@Pattern(regexp = "^[\\w0-9 ]+$", message = "Only alphanumerical characters and spaces")
private String name; private String name;
/** /**
......
...@@ -5,7 +5,6 @@ import lombok.*; ...@@ -5,7 +5,6 @@ import lombok.*;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
/** /**
* @author Jakub Balga * @author Jakub Balga
...@@ -18,10 +17,9 @@ import javax.validation.constraints.Pattern; ...@@ -18,10 +17,9 @@ import javax.validation.constraints.Pattern;
public class WineTypeDto extends PersistentDtoBase { public class WineTypeDto extends PersistentDtoBase {
/** /**
* Name of the wine, allows only alphanumerical characters * Name of the wine
*/ */
@NotBlank @NotBlank
@Pattern(regexp = "^[\\w0-9 ]+$", message = "Only alphanumerical characters and spaces")
private String name; private String name;
/** /**
......
...@@ -27,11 +27,9 @@ public class WineBottle extends EntityBase{ ...@@ -27,11 +27,9 @@ public class WineBottle extends EntityBase{
/** /**
* attribute of type String representing name, * attribute of type String representing name,
* allows only alphanumerical characters
*/ */
@Column(nullable = false) @Column(nullable = false)
@NotNull @NotBlank
@Pattern(regexp = "^[\\w0-9 ]*$", message = "Only alphanumerical characters")
private String name; private String name;
/** /**
......
...@@ -11,7 +11,6 @@ import org.modelmapper.ModelMapper; ...@@ -11,7 +11,6 @@ import org.modelmapper.ModelMapper;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.PositiveOrZero; import javax.validation.constraints.PositiveOrZero;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
...@@ -38,7 +37,6 @@ public class WineBottleUpsertViewModel extends ViewModelBase { ...@@ -38,7 +37,6 @@ public class WineBottleUpsertViewModel extends ViewModelBase {
* name of wine bottle * name of wine bottle
*/ */
@NotNull(message = "Cannot be empty") @NotNull(message = "Cannot be empty")
@Pattern(regexp = "^[\\w0-9 ]*$", message = "Only alphanumerical characters")
private String name; private String name;
/** /**
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<div class="form-group"> <div class="form-group">
<label th:for="*{name}" th:value="*{name}">Name</label> <label th:for="*{name}" th:value="*{name}">Name</label>
<input class="form-control" type="text" th:field="*{name}"> <input class="form-control" type="text" th:field="*{name}">
<p class="text-danger" th:each="error : ${#fields.errors('name')}" th:text="${error}"></p>
</div> </div>
<button type="submit" class="btn btn-primary">Submit</button> <button type="submit" class="btn btn-primary">Submit</button>
</form> </form>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment