Added: migrations
Fix: removed password field from entity and dto.
This commit is contained in:
parent
812957b93a
commit
ec8f49ea00
7 changed files with 61 additions and 41 deletions
|
|
@ -1,49 +1,63 @@
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
id("org.springframework.boot") version "3.5.3"
|
id("org.springframework.boot") version "3.5.3"
|
||||||
id("io.spring.dependency-management") version "1.1.7"
|
id("io.spring.dependency-management") version "1.1.7"
|
||||||
|
id("org.flywaydb.flyway") version "11.10.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "ru.team58"
|
group = "ru.team58"
|
||||||
version = "0.0.1-SNAPSHOT"
|
version = "0.0.1-SNAPSHOT"
|
||||||
|
|
||||||
|
flyway {
|
||||||
|
url = "jdbc:postgresql://localhost:5432/userdb"
|
||||||
|
user = "userdb"
|
||||||
|
password = "1205"
|
||||||
|
driver = "org.postgresql.Driver"
|
||||||
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
languageVersion = JavaLanguageVersion.of(17)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
compileOnly {
|
compileOnly {
|
||||||
extendsFrom(configurations.annotationProcessor.get())
|
extendsFrom(configurations.annotationProcessor.get())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
dependencies {
|
||||||
|
classpath("org.flywaydb:flyway-database-postgresql:11.10.0")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||||
implementation("org.flywaydb:flyway-core")
|
implementation("org.flywaydb:flyway-core")
|
||||||
implementation("org.mapstruct:mapstruct:1.6.3")
|
implementation("org.flywaydb:flyway-database-postgresql:11.10.0")
|
||||||
implementation("org.postgresql:postgresql")
|
implementation("org.mapstruct:mapstruct:1.6.3")
|
||||||
implementation("org.flywaydb:flyway-database-postgresql")
|
implementation("org.postgresql:postgresql")
|
||||||
implementation("org.apache.logging.log4j:log4j-api:2.22.1")
|
implementation("org.apache.logging.log4j:log4j-api:2.22.1")
|
||||||
implementation("org.apache.logging.log4j:log4j-core:2.22.1")
|
implementation("org.apache.logging.log4j:log4j-core:2.22.1")
|
||||||
implementation("org.slf4j:slf4j-api:2.0.13")
|
implementation("org.slf4j:slf4j-api:2.0.13")
|
||||||
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.6")
|
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.6")
|
||||||
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.22.1")
|
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.22.1")
|
||||||
annotationProcessor("org.mapstruct:mapstruct-processor:1.6.3")
|
annotationProcessor("org.mapstruct:mapstruct-processor:1.6.3")
|
||||||
compileOnly("org.projectlombok:lombok")
|
compileOnly("org.projectlombok:lombok")
|
||||||
annotationProcessor("org.projectlombok:lombok")
|
annotationProcessor("org.projectlombok:lombok")
|
||||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||||
testImplementation("org.springframework.security:spring-security-test")
|
testImplementation("org.springframework.security:spring-security-test")
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Test> {
|
tasks.withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package ru.team58.profileservice;
|
package ru.team58.profileservice;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
||||||
|
|
@ -9,9 +8,8 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
|
@SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
|
||||||
@EnableJpaRepositories
|
@EnableJpaRepositories
|
||||||
|
@Slf4j
|
||||||
public class ProfileserviceApplication {
|
public class ProfileserviceApplication {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ProfileserviceApplication.class);
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(ProfileserviceApplication.class, args);
|
SpringApplication.run(ProfileserviceApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,4 @@ public class CreateUserRequest {
|
||||||
String firstName;
|
String firstName;
|
||||||
String lastName;
|
String lastName;
|
||||||
String email;
|
String email;
|
||||||
String hashedPassword;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import ru.team58.profileservice.service.UserDTO;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "user")
|
@Table(name = "users")
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
|
|
@ -22,7 +22,7 @@ public class UserEntity {
|
||||||
@Column(name = "username", nullable = false)
|
@Column(name = "username", nullable = false)
|
||||||
String username;
|
String username;
|
||||||
|
|
||||||
@Column(name = "firstname", nullable = false)
|
@Column(name = "firstName", nullable = false)
|
||||||
String firstName;
|
String firstName;
|
||||||
|
|
||||||
@Column(name = "lastName", nullable = false)
|
@Column(name = "lastName", nullable = false)
|
||||||
|
|
@ -30,7 +30,4 @@ public class UserEntity {
|
||||||
|
|
||||||
@Column(name = "email", nullable = false)
|
@Column(name = "email", nullable = false)
|
||||||
String email;
|
String email;
|
||||||
|
|
||||||
@Column(name = "hashed_password", nullable = false)
|
|
||||||
String hashed_password;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,4 @@ public class UserDTO {
|
||||||
String firstName;
|
String firstName;
|
||||||
String lastName;
|
String lastName;
|
||||||
String email;
|
String email;
|
||||||
String hashedPassword;
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,4 +3,10 @@ spring.application.name=profileservice
|
||||||
## PostgreSQL
|
## PostgreSQL
|
||||||
spring.datasource.url=jdbc:postgresql://localhost:5432/userdb
|
spring.datasource.url=jdbc:postgresql://localhost:5432/userdb
|
||||||
spring.datasource.username=userdb
|
spring.datasource.username=userdb
|
||||||
spring.datasource.password=1205
|
spring.datasource.password=1205
|
||||||
|
|
||||||
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
|
|
||||||
|
## Flyway
|
||||||
|
spring.flyway.enabled=true
|
||||||
|
spring.flyway.locations=classpath:db.migration
|
||||||
7
src/main/resources/db/migration/V1_0_0__CreateUser.sql
Normal file
7
src/main/resources/db/migration/V1_0_0__CreateUser.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS "users" (
|
||||||
|
"id" uuid PRIMARY KEY,
|
||||||
|
"username" varchar,
|
||||||
|
"firstName" varchar,
|
||||||
|
"lastName" varchar,
|
||||||
|
"email" varchar
|
||||||
|
);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue