Skip to content

Commit

Permalink
fix: solved hibernate validation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
melistik committed Aug 6, 2024
1 parent 6d1d2b5 commit 77dc2ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import java.time.Instant;
import java.util.List;

Expand All @@ -13,7 +15,7 @@ public interface AppInviteEntity extends EntityWithKeyValue<AppInviteEntity>, Ha

String getInvitor();

void setInvitor(String invitor);
void setInvitor(@NotNull String invitor);

String getMessage();

Expand All @@ -29,7 +31,7 @@ public interface AppInviteEntity extends EntityWithKeyValue<AppInviteEntity>, Ha

String getEmail();

void setEmail(String email);
void setEmail(@NotNull @Email String email);

List<String> getRoles();

Expand All @@ -39,7 +41,7 @@ public interface AppInviteEntity extends EntityWithKeyValue<AppInviteEntity>, Ha

Instant getExpiration();

void setExpiration(Instant expiration);
void setExpiration(@NotNull Instant expiration);

/**
* fullname fallback if null use email
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.security.core.userdetails.UserDetails;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import java.time.Instant;
import java.util.List;

public interface AppUserEntity extends UserDetails, AppUserToken, EntityWithKeyValue<AppUserEntity> {

void setId(String id);

void setUsername(String username);
void setUsername(@NotNull String username);

String getPassword();

void setPassword(String password);
void setPassword(@NotNull String password);

void setFirstName(String firstName);

void setLastName(String lastName);

void setEmail(String email);
void setEmail(@NotNull @Email String email);

void setAvatar(String avatar);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import org.springframework.data.annotation.CreatedDate;

import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import java.time.Instant;
import java.util.HashMap;
import java.util.List;
Expand All @@ -26,7 +24,6 @@ public class AppInviteJpaEntity implements AppInviteEntity {
@Column(length = 36, nullable = false)
private String id;

@NotNull
private String invitor;

@Column(length = 4000)
Expand All @@ -36,8 +33,6 @@ public class AppInviteJpaEntity implements AppInviteEntity {

private String lastName;

@NotNull
@Email
private String email;

@Column(name = "roles")
Expand All @@ -57,12 +52,10 @@ public class AppInviteJpaEntity implements AppInviteEntity {
@Builder.Default
private Map<String, String> keyValueMap = new HashMap<>();

@NotNull
@CreatedDate
@Column(nullable = false)
private Instant created;

@NotNull
@Column(nullable = false)
private Instant expiration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.springframework.security.core.GrantedAuthority;

import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import java.time.Instant;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -30,19 +28,14 @@ public class AppUserJpaEntity implements AppUserEntity {
@Column(length = 36)
private String id;

@NotNull
private String username;


private String firstName;

private String lastName;

@NotNull
private String password;

@NotNull
@Email
private String email;

@Column(length = 2000)
Expand Down Expand Up @@ -72,7 +65,6 @@ public class AppUserJpaEntity implements AppUserEntity {

private boolean enabled;

@NotNull
@CreatedDate
@Column(nullable = false)
private Instant created;
Expand Down

0 comments on commit 77dc2ba

Please sign in to comment.