ViSnezh
This commit is contained in:
1 parent
eba3e0a7fb
commit
0d6fce8c48
2 files changed
+12
-2
No files matched your search
@@ -2,8 +2,10 @@ package site.easystartup.web.domain;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.Hibernate;
|
||||
import site.easystartup.web.project.domain.model.Participant;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -16,6 +18,7 @@ import java.util.Set;
|
||||
public class User {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "user_id")
|
||||
private long id;
|
||||
private String username;
|
||||
private String password;
|
||||
@@ -37,6 +40,9 @@ public class User {
|
||||
@CollectionTable(name = "user_projects", joinColumns = @JoinColumn(name = "user_id"))
|
||||
private Set<Long> projects;
|
||||
|
||||
@ManyToMany(mappedBy = "requests")
|
||||
private List<Participant> requests;
|
||||
|
||||
@ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
|
||||
@CollectionTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"))
|
||||
@Enumerated(EnumType.STRING)
|
||||
|
||||
@@ -5,6 +5,7 @@ import site.easystartup.web.domain.User;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@@ -30,6 +31,9 @@ public class Participant {
|
||||
@JoinColumn(name = "user_id")
|
||||
private User user;
|
||||
|
||||
@OneToMany
|
||||
private Set<User> requests;
|
||||
@ManyToMany
|
||||
@JoinTable(name = "user_request",
|
||||
joinColumns = @JoinColumn(name = "participant_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "user_id"))
|
||||
private List<User> requests;
|
||||
}
|
||||
Reference in new issue
Block a user