dev add rest for company, add link for users , update reg users
Test Workflow / test (push) Successful in 2s
Test Workflow / test (push) Successful in 2s
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package ru.soune.nocopy.entity.company;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.*;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import ru.soune.nocopy.entity.user.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Getter @Setter
|
||||
@Table(name = "company")
|
||||
public class Company {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private String id;
|
||||
|
||||
@Column(name = "company_name")
|
||||
private String companyName;
|
||||
|
||||
@Column(name = "address")
|
||||
private String address;
|
||||
|
||||
@Column(name = "phone")
|
||||
private String phone;
|
||||
|
||||
@CreatedDate
|
||||
@Column(name = "register_date", updatable = false, nullable = false)
|
||||
private LocalDateTime registerDate = LocalDateTime.now();
|
||||
|
||||
@Column(name = "update_date")
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
@Size(max = 1024)
|
||||
@Column(name = "email", length = 1024)
|
||||
private String email;
|
||||
|
||||
@OneToMany(mappedBy = "company")
|
||||
@JsonIgnore
|
||||
@ToString.Exclude
|
||||
private List<User> users = new ArrayList<>();
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import jakarta.validation.constraints.Size;
|
||||
import lombok.*;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
import ru.soune.nocopy.entity.company.Company;
|
||||
import ru.soune.nocopy.entity.file.Violation;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -37,9 +38,6 @@ public class User {
|
||||
@Column(name = "email_verified")
|
||||
private boolean emailVerified = false;
|
||||
|
||||
@Column(name = "company")
|
||||
private String company;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Size(min = 6)
|
||||
@JsonIgnore
|
||||
@@ -70,6 +68,9 @@ public class User {
|
||||
@Column(name = "is_active")
|
||||
private boolean isActive = false;
|
||||
|
||||
@Column(name = "permissions")
|
||||
private Long userPermissions;
|
||||
|
||||
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JsonIgnore
|
||||
@ToString.Exclude
|
||||
@@ -88,4 +89,9 @@ public class User {
|
||||
@OneToOne(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JsonIgnore
|
||||
private ProtectedFileCheck protectedFileCheck;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "company_id")
|
||||
@ToString.Exclude
|
||||
private Company company;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user