Added controller for FileUpload, refactor of main package, try to add forum system.

This commit is contained in:
redtea committed 2022-08-29 15:52:28 +03:00
1 parent cf24d07a78
commit 4a9efbb06d
38 files changed
+165 -78

No files matched your search

@@ -0,0 +1,57 @@
package site.easystartup.web.domain;
import lombok.*;
import org.hibernate.Hibernate;
import javax.persistence.*;
import java.util.Objects;
import java.util.Set;
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "usr")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String username;
private String password;
private boolean active;
private String full_name;
private String status;
private String iconPath;
private String email;
@ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
@CollectionTable(name = "user_tag", joinColumns = @JoinColumn(name = "user_id"))
private Set<String> tags;
@ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
@CollectionTable(name = "user_profession", joinColumns = @JoinColumn(name = "user_id"))
private Set<String> professions;
@ElementCollection(targetClass = Long.class, fetch = FetchType.EAGER)
@CollectionTable(name = "user_projects", joinColumns = @JoinColumn(name = "user_id"))
private Set<Long> projects;
@ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
@CollectionTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"))
@Enumerated(EnumType.STRING)
private Set<Role> roles;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
User user = (User) o;
return Objects.equals(id, user.id);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}