Skip to content

Commit

Permalink
Extended from base class.
Browse files Browse the repository at this point in the history
  • Loading branch information
CerenBdk committed Jun 2, 2021
1 parent 94f0aa0 commit cd851d6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 118 deletions.
18 changes: 2 additions & 16 deletions hrms/src/main/java/kodlamaio/hrms/entities/concretes/City.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

Expand All @@ -19,28 +17,16 @@
@NoArgsConstructor
@Table(name = "cities")
@JsonIgnoreProperties({"hibernateLazyInitializer","handler","jobAdverts"})
public class City {
public class City extends Base{

@Id
@GeneratedValue
@Column(name = "id")
private int id;

@Column(name = "name")
private String name;

@OneToMany(mappedBy = "city")
private List<JobAdvert> jobAdverts;

@Column(name= "is_active", columnDefinition = "boolean default true")
private boolean isActive = true;

@Column(name= "is_deleted", columnDefinition = "boolean default false")
private boolean isDeleted = false;

public City(int id, String name, List<JobAdvert> jobAdverts) {
public City(String name, List<JobAdvert> jobAdverts) {
super();
this.id = id;
this.name = name;
this.jobAdverts = jobAdverts;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Entity
@NoArgsConstructor
@Table(name = "job_adverts")
public class JobAdvert {
@AllArgsConstructor
public class JobAdvert extends Base{

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;

// @Column(name = "job_position_id")
// private int jobPositionId;
Expand Down Expand Up @@ -54,15 +49,6 @@ public class JobAdvert {

@Column(name = "is_open")
private boolean isOpen;

@Column(name= "created_at", columnDefinition = "Date defult CURRENT_DATE")
private LocalDate createdAt = LocalDate.now();

@Column(name= "is_active", columnDefinition = "boolean default true")
private boolean isActive = true;

@Column(name= "is_deleted", columnDefinition = "boolean default false")
private boolean isDeleted = false;

@ManyToOne
@JoinColumn(name = "job_position_id")
Expand All @@ -76,20 +62,4 @@ public class JobAdvert {
@JoinColumn(name = "city_id")
private City city;

public JobAdvert(int id, String description, int salaryMin, int salaryMax, int openPositionCount,
LocalDate deadline, LocalDate publishedAt, boolean isOpen, JobPosition jobPosition, Employer employer,
City city) {
super();
this.id = id;
this.description = description;
this.salaryMin = salaryMin;
this.salaryMax = salaryMax;
this.openPositionCount = openPositionCount;
this.deadline = deadline;
this.publishedAt = publishedAt;
this.isOpen = isOpen;
this.jobPosition = jobPosition;
this.employer = employer;
this.city = city;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package kodlamaio.hrms.entities.concretes;

import java.time.LocalDate;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

Expand All @@ -20,34 +17,18 @@
@Data
@NoArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer","handler","jobAdverts"})
public class JobPosition {

@Id
@GeneratedValue
@Column(name="id")
private int id;
public class JobPosition extends Base{

@Column(name="job_title")
private String jobTitle;

@Column(name= "created_at", columnDefinition = "Date default CURRENT_DATE")
private LocalDate createdDate = LocalDate.now();

@Column(name= "is_active", columnDefinition = "boolean default true")
private boolean isActive = true;

@Column(name= "is_deleted", columnDefinition = "boolean default false")
private boolean isDeleted = false;


@OneToMany(mappedBy = "jobPosition")
private List<JobAdvert> jobAdverts;

public JobPosition(int id, String jobTitle, List<JobAdvert> jobAdverts) {
public JobPosition(String jobTitle, List<JobAdvert> jobAdverts) {
super();
this.id = id;
this.jobTitle = jobTitle;
this.jobAdverts = jobAdverts;
}


}
22 changes: 2 additions & 20 deletions hrms/src/main/java/kodlamaio/hrms/entities/concretes/User.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package kodlamaio.hrms.entities.concretes;

import java.time.LocalDate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
Expand All @@ -19,31 +15,17 @@
@Data
@Inheritance(strategy = InheritanceType.JOINED)
@NoArgsConstructor
public class User {
public class User extends Base{

@Id
@GeneratedValue
@Column(name= "id")
private int id;

@Column(name= "email")
private String email;

@Column(name= "password")
private String password;

@Column(name= "created_at", columnDefinition = "Date defult CURRENT_DATE")
private LocalDate createdAt = LocalDate.now();

@Column(name= "is_active", columnDefinition = "boolean default true")
private boolean isActive = true;

@Column(name= "is_deleted", columnDefinition = "boolean default false")
private boolean isDeleted = false;

public User(int id, String email, String password) {
public User(String email, String password) {
super();
this.id = id;
this.email = email;
this.password = password;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
package kodlamaio.hrms.entities.concretes;
import java.time.LocalDate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name="verification_codes")
@Data
@NoArgsConstructor
public class VerificationCode {

@Id
@GeneratedValue
@Column(name="id")
private int id;
@AllArgsConstructor
public class VerificationCode extends Base{

@Column(name="user_id")
private int userId;
Expand All @@ -28,22 +22,6 @@ public class VerificationCode {
private String code;

@Column(name="is_confirmed")
private boolean isConfirmed;

@Column(name= "created_at", columnDefinition = "Date defult CURRENT_DATE")
private LocalDate createdAt = LocalDate.now();

@Column(name= "is_active", columnDefinition = "boolean default true")
private boolean isActive = true;

@Column(name= "is_deleted", columnDefinition = "boolean default false")
private boolean isDeleted = false;

public VerificationCode(int userId, String code, boolean isConfirmed) {
super();
this.userId = userId;
this.code = code;
this.isConfirmed = isConfirmed;
}

private boolean isConfirmed;

}

0 comments on commit cd851d6

Please sign in to comment.