Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.security.oauth:spring-security-oauth2:2.5.2.RELEASE'
implementation 'org.springframework.security:spring-security-jwt:1.1.1.RELEASE'
// implementation 'com.h2database:h2'
implementation 'org.flywaydb:flyway-mysql'
implementation 'org.flywaydb:flyway-core'
implementation 'mysql:mysql-connector-java'
implementation 'org.projectlombok:lombok:1.18.26'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

// runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.h2database:h2'
}

tasks.named('test') {
Expand Down
10 changes: 6 additions & 4 deletions data/src/main/java/com/example/data/backendapi/dto/Customer.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.example.data.backendapi.dto;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.*;
import org.springframework.security.core.GrantedAuthority;

import java.util.ArrayList;
Expand All @@ -13,15 +10,20 @@
/**
* Client's objects with personal information
*/
@Table(name = "customer")
@Entity
public class Customer {

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "user_name")
private String userName;
@Column(name = "password")
private String password;
private Collection<GrantedAuthority> grantedAuthoritiesList = new ArrayList<>();

Expand Down
24 changes: 16 additions & 8 deletions data/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
spring:
# datasource:
# driverClassName: org.h2.Driver
# jpa:
# properties:
# hibernate:
# dialect: org.hibernate.dialect.H2Dialect
# database:
# database-platform: org.hibernate.dialect.H2Dialect
datasource:
url: jdbc:mysql://localhost:3306/flyway_migrations?useSSL=false
username: mysql
password: mysql
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
flyway:
baseline-on-migration: true
user:
password:
baseline-description: "Initialisation of the Customer DB"
baseline-version: 1
security:
oauth2:
resource:
Expand Down
8 changes: 8 additions & 0 deletions data/src/main/resources/db/migrations/v1__init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE customer
(
id Long(20) not null AUTO_INCREMENT,
first_name varchar(50) not null,
last_name varchar(50) not null,
password varchar(50) not null,
primary key (id),
)