Done ticket GEPAFINBE-3

This commit is contained in:
harish
2024-08-14 15:31:00 +05:30
parent 2773dfa034
commit e09f61f918
51 changed files with 2107 additions and 70 deletions

View File

@@ -0,0 +1,35 @@
package net.gepafin.tendermanagement.entities;
import jakarta.persistence.*;
import lombok.Data;
import net.gepafin.tendermanagement.util.DateTimeUtil;
import java.time.LocalDateTime;
@MappedSuperclass
@Data
public class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", unique = true)
private Long id;
@Column(name = "CREATED_DATE", updatable = false)
LocalDateTime createdDate;
@Column(name = "UPDATED_DATE")
LocalDateTime updatedDate;
@PrePersist
public void setCreatedDate() {
this.createdDate = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
this.updatedDate = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
}
@PreUpdate
public void setUpdatedDate() {
this.updatedDate = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
}
}

View File

@@ -0,0 +1,60 @@
package net.gepafin.tendermanagement.entities;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import net.gepafin.tendermanagement.entities.BaseEntity;
import java.math.BigDecimal;
@Entity
@Table(name = "\"REGION\"")
@Getter
@Setter
public class RegionEntity extends BaseEntity {
@Column(name = "REGION_NAME", length = 255, nullable = true)
private String regionName;
@Column(name = "DESCRIPTION", length = 255, nullable = true)
private String description;
@Column(name = "COUNTRY", length = 50, nullable = true)
private String country;
@Column(name = "STATUS", length = 30, nullable = true)
private String status;
@Column(name = "PRIORITY_AREA", length = 255, nullable = true)
private String priorityArea;
@Column(name = "POPULATION", nullable = true)
private Long population;
@Column(name = "AREA_SIZE", nullable = true)
private BigDecimal areaSize;
@Column(name = "GDP", nullable = true)
private BigDecimal gdp;
@Column(name = "UNEMPLOYMENT_RATE", nullable = true)
private BigDecimal unemploymentRate;
@Column(name = "INFRASTRUCTURE_SCORE", nullable = true)
private BigDecimal infrastructureScore;
@Column(name = "EDUCATION_LEVEL", nullable = true)
private BigDecimal educationLevel;
@Column(name = "HEALTHCARE_ACCESS", nullable = true)
private BigDecimal healthcareAccess;
@Column(name = "ENVIRONMENTAL_SCORE", nullable = true)
private BigDecimal environmentalScore;
}

View File

@@ -0,0 +1,26 @@
package net.gepafin.tendermanagement.entities;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "\"ROLE\"")
@Getter
@Setter
public class RoleEntity extends BaseEntity {
@Column(name = "ROLE_NAME", length = 50, nullable = true)
private String roleName;
@Column(name = "DESCRIPTION", length = 255, nullable = true)
private String description;
@Column(name = "PERMISSIONS", length = 255, nullable = true)
private String permissions;
@ManyToOne
@JoinColumn(name = "REGION_ID", nullable = true)
private RegionEntity region;
}

View File

@@ -0,0 +1,77 @@
package net.gepafin.tendermanagement.entities;
import com.fasterxml.jackson.annotation.JsonValue;
import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import net.gepafin.tendermanagement.entities.BaseEntity;
import java.time.LocalDateTime;
@Entity
@Table(name = "\"USER\"")
@Getter
@Setter
public class UserEntity extends BaseEntity {
@Column(name = "PASSWORD", columnDefinition = "TEXT",nullable = false)
@JsonIgnore
private String password;
@Email
@Column(name = "EMAIL", length = 255, unique = true, nullable = false)
private String email;
@ManyToOne
@JoinColumn(name = "ROLE_ID")
@JsonIgnore
private RoleEntity roleEntity;
@Column(name = "LAST_LOGIN")
private LocalDateTime lastLogin;
@Column(name = "STATUS", length = 30, nullable = true)
private String status;
@Column(name = "FIRST_NAME", length = 50, nullable = true)
private String firstName;
@Column(name = "LAST_NAME", length = 50, nullable = true)
private String lastName;
@Column(name = "PHONE_NUMBER", length = 15, nullable = true)
private String phoneNumber;
@Column(name = "ORGANIZATION", length = 255, nullable = true)
private String organization;
@Column(name = "ADDRESS", length = 255, nullable = true)
private String address;
@Column(name = "CITY", length = 50, nullable = true)
private String city;
@Column(name = "COUNTRY", length = 50, nullable = true)
private String country;
public enum UserStatusEnum {
ACTIVE("ACTIVE"),
INACTIVE("INACTIVE");
private String value;
UserStatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
}
}