Skip to content

Commit 243fe8f

Browse files
committed
Employer.
1 parent 7ad4117 commit 243fe8f

File tree

8 files changed

+178
-5
lines changed

8 files changed

+178
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ src/main/webapp/components/*
1111

1212
/src/main/webapp/css/all.css
1313
/src/main/webapp/js/all.js
14+
/src/main/resources/database.properties

pom.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
</properties>
2424

2525
<dependencies>
26-
<!--<dependency>-->
27-
<!--<groupId>org.springframework.boot</groupId>-->
28-
<!--<artifactId>spring-boot-starter-data-jpa</artifactId>-->
29-
<!--</dependency>-->
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-data-jpa</artifactId>
29+
</dependency>
3030

3131
<dependency>
3232
<groupId>org.springframework.boot</groupId>
@@ -43,6 +43,12 @@
4343
<artifactId>spring-boot-starter-test</artifactId>
4444
<scope>test</scope>
4545
</dependency>
46+
47+
<dependency>
48+
<groupId>mysql</groupId>
49+
<artifactId>mysql-connector-java</artifactId>
50+
<version>6.0.5</version>
51+
</dependency>
4652
</dependencies>
4753

4854
<build>

src/main/java/ro/jobzz/Application.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.context.annotation.PropertySource;
56

67
@SpringBootApplication
8+
@PropertySource(value = {"application.properties", "database.properties"})
79
public class Application {
810

911
public static void main(String[] args) {
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
package ro.jobzz.model;
2+
3+
4+
import javax.persistence.Entity;
5+
import javax.persistence.GeneratedValue;
6+
import javax.persistence.GenerationType;
7+
import javax.persistence.Id;
8+
import java.sql.Blob;
9+
import java.sql.Date;
10+
11+
@Entity
12+
public class Employer {
13+
14+
@Id
15+
@GeneratedValue(strategy = GenerationType.AUTO)
16+
private Integer employerId;
17+
18+
private String email;
19+
20+
private String phoneNumber;
21+
22+
private Date dateOfBirth;
23+
24+
private String firstName;
25+
26+
private String lastName;
27+
28+
private String cardNumber;
29+
30+
private String expirationDate;
31+
32+
private String cvv;
33+
34+
private Integer reputation;
35+
36+
private Blob profilePicture;
37+
38+
public Employer() {
39+
}
40+
41+
public Integer getEmployerId() {
42+
return employerId;
43+
}
44+
45+
public void setEmployerId(Integer employerId) {
46+
this.employerId = employerId;
47+
}
48+
49+
public String getEmail() {
50+
return email;
51+
}
52+
53+
public void setEmail(String email) {
54+
this.email = email;
55+
}
56+
57+
public String getPhoneNumber() {
58+
return phoneNumber;
59+
}
60+
61+
public void setPhoneNumber(String phoneNumber) {
62+
this.phoneNumber = phoneNumber;
63+
}
64+
65+
public Date getDateOfBirth() {
66+
return dateOfBirth;
67+
}
68+
69+
public void setDateOfBirth(Date dateOfBirth) {
70+
this.dateOfBirth = dateOfBirth;
71+
}
72+
73+
public String getFirstName() {
74+
return firstName;
75+
}
76+
77+
public void setFirstName(String firstName) {
78+
this.firstName = firstName;
79+
}
80+
81+
public String getLastName() {
82+
return lastName;
83+
}
84+
85+
public void setLastName(String lastName) {
86+
this.lastName = lastName;
87+
}
88+
89+
public String getCardNumber() {
90+
return cardNumber;
91+
}
92+
93+
public void setCardNumber(String cardNumber) {
94+
this.cardNumber = cardNumber;
95+
}
96+
97+
public String getExpirationDate() {
98+
return expirationDate;
99+
}
100+
101+
public void setExpirationDate(String expirationDate) {
102+
this.expirationDate = expirationDate;
103+
}
104+
105+
public String getCvv() {
106+
return cvv;
107+
}
108+
109+
public void setCvv(String cvv) {
110+
this.cvv = cvv;
111+
}
112+
113+
public Integer getReputation() {
114+
return reputation;
115+
}
116+
117+
public void setReputation(Integer reputation) {
118+
this.reputation = reputation;
119+
}
120+
121+
public Blob getProfilePicture() {
122+
return profilePicture;
123+
}
124+
125+
public void setProfilePicture(Blob profilePicture) {
126+
this.profilePicture = profilePicture;
127+
}
128+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package ro.jobzz.repository;
2+
3+
4+
import org.springframework.data.jpa.repository.JpaRepository;
5+
import ro.jobzz.model.Employer;
6+
7+
import java.util.List;
8+
9+
public interface EmployerRepository extends JpaRepository<Employer, Integer> {
10+
11+
List<Employer> findAll();
12+
13+
}
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Security
12
security.user.password=password
23
security.user.name=user
3-
security.basic.enabled=false
4+
security.basic.enabled=false
5+
# Database
6+
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
7+
spring.jpa.hibernate.ddl-auto=update
8+
spring.jpa.show-sql=true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
spring.datasource.url=jdbc:mysql://mysql.ceio85fyyyy1.eu-central-1.rds.amazonaws.com:3306/jobzz
2+
spring.datasource.username=daniellungu
3+
spring.datasource.password=80pdopx5

src/main/resources/jobzz.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CREATE DATABASE jobzz;
2+
3+
CREATE TABLE jobzz.employer(
4+
employer_id INT NOT NULL PRIMARY KEY,
5+
email VARCHAR(255) NOT NULL UNIQUE,
6+
password VARCHAR(255) NOT NULL,
7+
phone_number VARCHAR(10) NOT NULL,
8+
date_of_birth DATE NOT NULL,
9+
first_name VARCHAR(255) NOT NULL,
10+
last_name VARCHAR(255) NOT NULL,
11+
card_number VARCHAR(16) NOT NULL,
12+
cvv VARCHAR(3) NOT NULL,
13+
reputation INT NOT NULL,
14+
picture BLOB
15+
);

0 commit comments

Comments
 (0)