|
|
@@ -1,23 +1,40 @@
|
|
|
package pl.dmcs.eldarmuk.backend_springboot.model;
|
|
|
|
|
|
+import org.hibernate.validator.constraints.Length;
|
|
|
+
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
+
|
|
|
import jakarta.persistence.Entity;
|
|
|
+import jakarta.persistence.GeneratedValue;
|
|
|
+import jakarta.persistence.GenerationType;
|
|
|
import jakarta.persistence.Id;
|
|
|
+import jakarta.persistence.OneToOne;
|
|
|
+import jakarta.validation.constraints.NotBlank;
|
|
|
|
|
|
@Entity
|
|
|
public class Account {
|
|
|
@Id
|
|
|
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
private Long id;
|
|
|
+
|
|
|
+ @NotBlank
|
|
|
+ @Length(min = 3, max = 50)
|
|
|
private String username;
|
|
|
+
|
|
|
+ @NotBlank
|
|
|
+ @Length(min = 6, max = 100)
|
|
|
private String password;
|
|
|
private String email;
|
|
|
|
|
|
+ @JsonIgnore
|
|
|
+ @OneToOne(mappedBy = "account")
|
|
|
+ private Student student;
|
|
|
+
|
|
|
public Account() {}
|
|
|
|
|
|
- public Account(Long id, String username, String password, String email) {
|
|
|
- this.id = id;
|
|
|
+ public Account(@NotBlank @Length(min = 3, max = 50) String username, @NotBlank @Length(min = 6, max = 100) String password) {
|
|
|
this.username = username;
|
|
|
this.password = password;
|
|
|
- this.email = email;
|
|
|
}
|
|
|
|
|
|
public Long getId() {
|