Merge branch 'tibor' into 'master'

API 1.0.23 ExerciseTree parent_id delete, kotlin, spring boot 2.4

See merge request bossanyit/aitrainer_server!34
This commit is contained in:
Bossányi Tibor 2021-01-29 21:10:22 +00:00
commit 91318168c9
13 changed files with 51 additions and 50 deletions

View File

@ -2,16 +2,16 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("org.springframework.boot") version "2.3.0.RELEASE" id("org.springframework.boot") version "2.4.2"
id("io.spring.dependency-management") version "1.0.9.RELEASE" id("io.spring.dependency-management") version "1.0.10.RELEASE"
kotlin("jvm") version "1.3.72" kotlin("jvm") version "1.4.21"
kotlin("plugin.spring") version "1.3.72" kotlin("plugin.spring") version "1.4.30-RC"
kotlin("plugin.jpa") version "1.3.72" kotlin("plugin.jpa") version "1.4.30-RC"
kotlin("plugin.serialization") version "1.3.70" kotlin("plugin.serialization") version "1.4.30-RC"
} }
group = "com.aitrainer" group = "com.aitrainer"
version = "1.0.22" version = "1.0.23"
java.sourceCompatibility = JavaVersion.VERSION_1_8 java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories { repositories {
@ -24,25 +24,24 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-aop") implementation("org.springframework.boot:spring-boot-starter-aop")
implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.3.0.RELEASE") implementation("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.4.2")
implementation("org.springframework.security.oauth:spring-security-oauth2:2.5.0.RELEASE") implementation("org.springframework.security.oauth:spring-security-oauth2:2.5.0.RELEASE")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.apache.logging.log4j:log4j-core:2.13.3") implementation("org.apache.logging.log4j:log4j-core:2.14.0")
implementation("org.apache.logging.log4j:log4j-api:2.13.3") implementation("org.apache.logging.log4j:log4j-api:2.14.0")
implementation("org.slf4j:slf4j-api:1.7.30") implementation("org.slf4j:slf4j-api:1.7.30")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0") // JVM dependency implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc") // JVM dependency
implementation("io.jsonwebtoken:jjwt:0.9.1") implementation("io.jsonwebtoken:jjwt:0.9.1")
implementation("org.yaml:snakeyaml:1.27")
runtimeOnly("mysql:mysql-connector-java") runtimeOnly("mysql:mysql-connector-java")
testImplementation("org.springframework.boot:spring-boot-starter-test") { testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine") exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
} }
testImplementation("junit:junit:4.13") testImplementation("junit:junit:4.13.1")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:1.3.72") testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:1.4.30-RC")
} }

View File

@ -580,7 +580,6 @@ REPLACE INTO `exercise_plan_translation` (`translation_id`, `language_code`, `na
-- Struktúra mentése tábla aitrainer2. exercise_tree -- Struktúra mentése tábla aitrainer2. exercise_tree
CREATE TABLE IF NOT EXISTS `exercise_tree` ( CREATE TABLE IF NOT EXISTS `exercise_tree` (
`tree_id` int(11) NOT NULL AUTO_INCREMENT, `tree_id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT 0,
`name` char(50) DEFAULT NULL, `name` char(50) DEFAULT NULL,
`image_url` char(200) DEFAULT NULL, `image_url` char(200) DEFAULT NULL,
`active` tinyint(1) DEFAULT 1, `active` tinyint(1) DEFAULT 1,
@ -589,24 +588,24 @@ CREATE TABLE IF NOT EXISTS `exercise_tree` (
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;
-- Tábla adatainak mentése aitrainer2.exercise_tree: ~3 rows (hozzávetőleg) -- Tábla adatainak mentése aitrainer2.exercise_tree: ~3 rows (hozzávetőleg)
REPLACE INTO `exercise_tree` (`tree_id`, `parent_id`, `name`, `image_url`, `active`) VALUES REPLACE INTO `exercise_tree` (`tree_id`, `name`, `image_url`, `active`) VALUES
(3, 0, 'Cardio', 'images/1.cardio.png', 1), (3, 'Cardio', 'images/1.cardio.png', 1),
(4, 0, 'Strength', 'images/2.strength.png', 1), (4, 'Strength', 'images/2.strength.png', 1),
(5, 0, 'Body Compositions', 'images/3.bcs1.png', 1), (5, 'Body Compositions', 'images/3.bcs1.png', 1),
(7, 3, 'Aerob', 'images/1.1.aerob.png', 1), (7, 'Aerob', 'images/1.1.aerob.png', 1),
(8, 3, 'Anaerob', 'images/1.2.anaerob.png', 1), (8, 'Anaerob', 'images/1.2.anaerob.png', 1),
(9, 4, 'One Rep Max', 'images/2.2.1.1RM.png', 1), (9, 'One Rep Max', 'images/2.2.1.1RM.png', 1),
(10, 4, 'Endurance', 'images/2.1.endurance.png', 1), (10, 'Endurance', 'images/2.1.endurance.png', 1),
(11, 5, 'BMI', 'images/3.1.BMI.png', 0), (11, 'BMI', 'images/3.1.BMI.png', 0),
(12, 5, 'BMR', 'images/3.2.BMR.png', 0), (12, 'BMR', 'images/3.2.BMR.png', 0),
(13, 5, 'Sizes', 'images/3.3.sizes.png', 0), (13, 'Sizes', 'images/3.3.sizes.png', 0),
(14, 9, 'Chest', 'images/2.2.1.1.chestpress.png', 1), (14, 'Chest', 'images/2.2.1.1.chestpress.png', 1),
(15, 9, 'Biceps', 'images/2.2.1.3.biceps.png', 1), (15, 'Biceps', 'images/2.2.1.3.biceps.png', 1),
(16, 9, 'Triceps', 'images/2.2.1.4.triceps.png', 1), (16, 'Triceps', 'images/2.2.1.4.triceps.png', 1),
(17, 9, 'Shoulders', 'images/2.2.1.5.shoulders.png', 1), (17, 'Shoulders', 'images/2.2.1.5.shoulders.png', 1),
(18, 9, 'Thigh', 'images/2.1.4.squats.png', 1), (18, 'Thigh', 'images/2.1.4.squats.png', 1),
(19, 9, 'Calf', 'images/2.1.4.squats.png', 1), (19, 'Calf', 'images/2.1.4.squats.png', 1),
(20, 9, 'Back', 'images/2.2.1.5.shoulders.png', 1); (20, 'Back', 'images/2.2.1.5.shoulders.png', 1);
CREATE TABLE IF NOT EXISTS `exercise_tree_parents` ( CREATE TABLE IF NOT EXISTS `exercise_tree_parents` (
`exercise_tree_parents_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `exercise_tree_parents_id` int(10) unsigned NOT NULL AUTO_INCREMENT,

View File

@ -0,0 +1,4 @@
ALTER TABLE `exercise_tree`
DROP COLUMN `parent_id`;
UPDATE configuration set config_value = "1.0.23", date_change=CURRENT_DATE WHERE config_key = "db_version";

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -13,7 +13,6 @@ data class ExerciseTree (
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
val treeId: Long = 0, val treeId: Long = 0,
@get: NonNull var parentId: Int,
@get: NotBlank var name: String = "", @get: NotBlank var name: String = "",
@get: NotBlank var imageUrl: String = "", @get: NotBlank var imageUrl: String = "",
@get: NonNull var active: Boolean? @get: NonNull var active: Boolean?

View File

@ -9,8 +9,7 @@ data class User (
var password: String = "", var password: String = "",
var firebaseUid: String = "" var firebaseUid: String = ""
) { ) {
@OptIn(UnstableDefault::class)
fun fromJson(json: String): User { fun fromJson(json: String): User {
return Json.parse(serializer(), json) return Json.decodeFromString(serializer(), json)
} }
} }

View File

@ -1,4 +1,5 @@
spring.profiles.active=dev spring.config.activate.on-profile=dev
spring.config.use-legacy-processing = true
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
#spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false #spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false
spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true

View File

@ -1,4 +1,5 @@
spring.profiles.active=prod spring.config.activate.on-profile=prod
spring.config.use-legacy-processing = true
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url = jdbc:mysql://62.171.188.119:33060/aitrainer?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true spring.datasource.url = jdbc:mysql://62.171.188.119:33060/aitrainer?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true
spring.datasource.username = aitrainer spring.datasource.username = aitrainer
@ -16,6 +17,6 @@ logging.config=classpath:logback-spring.xml
logging.file=logs logging.file=logs
# if the database structure has been changed, increment this version number # if the database structure has been changed, increment this version number
application.version=1.0.22 application.version=1.0.23
jwt.secret=aitrainer jwt.secret=aitrainer

View File

@ -1,4 +1,5 @@
spring.profiles.active=test spring.profiles.active=test
spring.config.use-legacy-processing = true
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
#spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false #spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false
spring.datasource.url = jdbc:mysql://mysql:3306/aitrainer?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true spring.datasource.url = jdbc:mysql://mysql:3306/aitrainer?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true

View File

@ -1,4 +1,5 @@
spring.profiles.active=testmac spring.config.activate.on-profile=testmac
spring.config.use-legacy-processing = true
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
#spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false #spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true spring.datasource.url = jdbc:mysql://127.0.0.1:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true

View File

@ -1,4 +1,5 @@
spring.profiles.active=dev,test,prod,prodtest #spring.config.activate.on-profile=dev,test,prod,prodtest
spring.config.use-legacy-processing = true
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
#spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false #spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false
spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true
@ -16,6 +17,6 @@ logging.config=classpath:logback-spring.xml
logging.file=logs logging.file=logs
# if the database structure has been changed, increment this version number # if the database structure has been changed, increment this version number
application.version=1.0.22 application.version=1.0.23
jwt.secret=aitrainer jwt.secret=aitrainer

View File

@ -1,12 +1,8 @@
package com.aitrainer.api.test package com.aitrainer.api.test
import com.aitrainer.api.controller.ExerciseTreeController
import com.aitrainer.api.controller.ExerciseTreeParentsController import com.aitrainer.api.controller.ExerciseTreeParentsController
import com.aitrainer.api.model.ExerciseTree
import com.aitrainer.api.model.ExerciseTreeParents import com.aitrainer.api.model.ExerciseTreeParents
import com.aitrainer.api.repository.ExerciseTreeParentsRepository import com.aitrainer.api.repository.ExerciseTreeParentsRepository
import com.aitrainer.api.repository.ExerciseTreeRepository
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.SpringBootTest
@ -39,7 +35,7 @@ class ExerciseTreeParentsTest {
assertTrue(responseEntity.body!!.isNotEmpty()) assertTrue(responseEntity.body!!.isNotEmpty())
val exerciseTreeParentList = responseEntity.body!! val exerciseTreeParentList = responseEntity.body!!
assertEquals(exerciseTreeParentList.size, 27) assertEquals(exerciseTreeParentList.size, 17)
assertEquals(exerciseTreeParentList[4].exerciseTreeParentId, 3) assertEquals(exerciseTreeParentList[4].exerciseTreeParentId, 3)
assertEquals(exerciseTreeParentList[4].exerciseTreeChildId, 7) assertEquals(exerciseTreeParentList[4].exerciseTreeChildId, 7)

View File

@ -27,6 +27,6 @@ class ExerciseTreeTest {
val exerciseTreeItem = responseEntity.body!![0] val exerciseTreeItem = responseEntity.body!![0]
assertEquals(exerciseTreeItem.name, "Cardio") assertEquals(exerciseTreeItem.name, "Cardio")
assertEquals(responseEntity.body!![1].translations[0].name, "Erő") assertEquals(responseEntity.body!![1].translations[0].name, "Erő!")
} }
} }