add validation

This commit is contained in:
mirrerror
2023-11-15 09:16:27 +02:00
parent 2d981c5af8
commit fb2695e58a
23 changed files with 314 additions and 62 deletions

View File

@@ -1,6 +1,8 @@
package com.faf223.expensetrackerfaf.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.List;
@@ -17,15 +19,23 @@ public class User {
private String userUuid;
@Column(name = "name")
@NotNull(message = "First name must not be null")
@NotEmpty(message = "First name must not be empty")
private String firstName;
@Column(name = "surname")
@NotNull(message = "Last name must not be null")
@NotEmpty(message = "Last name must not be empty")
private String lastName;
@Column(name = "username")
@NotNull(message = "Username must not be null")
@NotEmpty(message = "Username must not be empty")
private String username;
@Transient
@NotNull(message = "Password must not be null")
@NotEmpty(message = "Password must not be empty")
private String password;
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)