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 lombok.*;
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
|
import site.easystartup.web.project.domain.model.Participant;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -16,6 +18,7 @@ import java.util.Set;
|
|||||||
public class User {
|
public class User {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
@Column(name = "user_id")
|
||||||
private long id;
|
private long id;
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
@@ -37,6 +40,9 @@ public class User {
|
|||||||
@CollectionTable(name = "user_projects", joinColumns = @JoinColumn(name = "user_id"))
|
@CollectionTable(name = "user_projects", joinColumns = @JoinColumn(name = "user_id"))
|
||||||
private Set<Long> projects;
|
private Set<Long> projects;
|
||||||
|
|
||||||
|
@ManyToMany(mappedBy = "requests")
|
||||||
|
private List<Participant> requests;
|
||||||
|
|
||||||
@ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
|
@ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
|
||||||
@CollectionTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"))
|
@CollectionTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"))
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import site.easystartup.web.domain.User;
|
|||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -30,6 +31,9 @@ public class Participant {
|
|||||||
@JoinColumn(name = "user_id")
|
@JoinColumn(name = "user_id")
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@OneToMany
|
@ManyToMany
|
||||||
private Set<User> requests;
|
@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