связал юзера с создателем, нужно будет пофиксить код, так как из создателя убрал логин и пароль
This commit is contained in:
parent
182427a9cf
commit
0463cef7fa
@ -1,5 +1,7 @@
|
||||
package com.LabWork.app.MangaStore.model.Default;
|
||||
|
||||
import com.LabWork.app.MangaStore.user.model.User;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@ -10,16 +12,11 @@ import java.util.Objects;
|
||||
@Entity
|
||||
public class Creator {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "creatorName can't be null or empty")
|
||||
@Column
|
||||
private String creatorName;
|
||||
|
||||
@NotBlank(message = "hashedPassword can't be null or empty")
|
||||
@Column
|
||||
private String hashedPassword;
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@MapsId
|
||||
private User user;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "creator", cascade = CascadeType.REMOVE)
|
||||
private List<Manga> mangas;
|
||||
@ -28,8 +25,7 @@ public class Creator {
|
||||
}
|
||||
|
||||
public Creator(String creatorName, String hashedPassword) {
|
||||
this.creatorName = creatorName;
|
||||
this.hashedPassword = hashedPassword;
|
||||
this.user = user;
|
||||
this.mangas = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -41,25 +37,11 @@ public class Creator {
|
||||
return mangas;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
|
||||
public String getHashedPassword() {
|
||||
return hashedPassword;
|
||||
}
|
||||
|
||||
public void setMangas(List<Manga> mangas) {
|
||||
this.mangas = mangas;
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
|
||||
public void setHashedPassword(String hashedPassword) {
|
||||
this.hashedPassword = hashedPassword;
|
||||
}
|
||||
public User getUser() { return user; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
Loading…
Reference in New Issue
Block a user