diff --git a/build.gradle.kts b/build.gradle.kts index 935e2cc..41d266f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { } group = "com.aitrainer" -version = "1.0.27" +version = "1.0.28" java.sourceCompatibility = JavaVersion.VERSION_1_8 repositories { diff --git a/data/db/install.sql b/data/db/install.sql index 5384ef9..15cac6c 100644 --- a/data/db/install.sql +++ b/data/db/install.sql @@ -585,6 +585,7 @@ REPLACE INTO `exercise_plan_translation` (`translation_id`, `language_code`, `na CREATE TABLE IF NOT EXISTS `exercise_tree` ( `tree_id` int(11) NOT NULL AUTO_INCREMENT, `name` char(50) DEFAULT NULL, + `description` text DEFAULT NULL, `image_url` char(200) DEFAULT NULL, `active` tinyint(1) DEFAULT 1, PRIMARY KEY (`tree_id`) USING BTREE, @@ -592,25 +593,25 @@ CREATE TABLE IF NOT EXISTS `exercise_tree` ( ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4; -- Tábla adatainak mentése aitrainer2.exercise_tree: ~3 rows (hozzávetőleg) -REPLACE INTO `exercise_tree` (`tree_id`, `name`, `image_url`, `active`) VALUES -(3, 'Cardio', 'images/1.cardio.png', 1), -(4, 'Strength', 'images/2.strength.png', 1), -(5, 'Body Compositions', 'images/3.bcs1.png', 1), -(7, 'Aerob', 'images/1.1.aerob.png', 1), -(8, 'Anaerob', 'images/1.2.anaerob.png', 1), -(9, 'One Rep Max', 'images/2.2.1.1RM.png', 1), -(10, 'Endurance', 'images/2.1.endurance.png', 1), -(11, 'BMI', 'images/3.1.BMI.png', 0), -(12, 'BMR', 'images/3.2.BMR.png', 0), -(13, 'Sizes', 'images/3.3.sizes.png', 0), -(14, 'Chest', 'images/2.2.1.1.chestpress.png', 1), -(15, 'Biceps', 'images/2.2.1.3.biceps.png', 1), -(16, 'Triceps', 'images/2.2.1.4.triceps.png', 1), -(17, 'Shoulders', 'images/2.2.1.5.shoulders.png', 1), -(18, 'Thigh', 'images/2.1.4.squats.png', 1), -(19, 'Calf', 'images/2.1.4.squats.png', 1), -(20, 'Back', 'images/2.2.1.5.shoulders.png', 1); -(21, 'Test Center', 'images/2.2.1.5.shoulders.png', 1); +REPLACE INTO `exercise_tree` (`tree_id`, `name`, `description`, `image_url`, `active`) VALUES +(3, 'Cardio', NULL, 'images/1.cardio.png', 1), +(4, 'Strength', NULL, 'images/2.strength.png', 1), +(5, 'Body Compositions', NULL, 'images/3.bcs1.png', 1), +(7, 'Aerob', NULL, 'images/1.1.aerob.png', 1), +(8, 'Anaerob', NULL, 'images/1.2.anaerob.png', 1), +(9, 'One Rep Max', NULL, 'images/2.2.1.1RM.png', 1), +(10, 'Endurance', NULL, 'images/2.1.endurance.png', 1), +(11, 'BMI', NULL, 'images/3.1.BMI.png', 0), +(12, 'BMR', NULL, 'images/3.2.BMR.png', 0), +(13, 'Sizes', NULL, 'images/3.3.sizes.png', 0), +(14, 'Chest', NULL, 'images/2.2.1.1.chestpress.png', 1), +(15, 'Biceps', NULL, 'images/2.2.1.3.biceps.png', 1), +(16, 'Triceps', NULL, 'images/2.2.1.4.triceps.png', 1), +(17, 'Shoulders', NULL, 'images/2.2.1.5.shoulders.png', 1), +(18, 'Thigh', NULL, 'images/2.1.4.squats.png', 1), +(19, 'Calf', NULL, 'images/2.1.4.squats.png', 1), +(20, 'Back', NULL, 'images/2.2.1.5.shoulders.png', 1); +(21, 'Test Center', "Welcome", 'images/2.2.1.5.shoulders.png', 1); CREATE TABLE IF NOT EXISTS `exercise_tree_parents` ( `exercise_tree_parents_id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -647,6 +648,7 @@ CREATE TABLE IF NOT EXISTS `exercise_tree_translation` ( `tree_id` int(13) NOT NULL DEFAULT 0, `language_code` char(2) DEFAULT NULL, `name` char(100) DEFAULT NULL, + `description` text DEFAULT NULL, PRIMARY KEY (`translation_id`), KEY `tree_id` (`tree_id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4; @@ -654,22 +656,23 @@ CREATE TABLE IF NOT EXISTS `exercise_tree_translation` ( -- Tábla adatainak mentése aitrainer2.exercise_tree_translation: ~2 rows (hozzávetőleg) /*!40000 ALTER TABLE `exercise_tree_translation` DISABLE KEYS */; REPLACE INTO `exercise_tree_translation` (`translation_id`, `tree_id`, `language_code`, `name`) VALUES -(1, 3, 'hu', 'Kardió'), -(2, 4, 'hu', 'Erő'), -(4, 7, 'hu', 'Aerob'), -(5, 8, 'hu', 'Anaerob'), -(6, 9, 'hu', 'Max Erő'), -(7, 10, 'hu', 'Erő állóképesség'), -(8, 11, 'hu', 'Testtömegindex'), -(9, 12, 'hu', 'Anyagcsere'), -(10, 13, 'hu', 'Méretek'), -(11, 14, 'hu', 'Mellizom'), -(12, 15, 'hu', 'Bicepsz'), -(13, 16, 'hu', 'Tricepsz'), -(14, 17, 'hu', 'Vállak'), -(15, 18, 'hu', 'Comb'), -(16, 19, 'hu', 'Vádli'), -(17, 20, 'hu', 'Hát'); +(1, 3, 'hu', 'Kardió', NULL), +(2, 4, 'hu', 'Erő', NULL), +(4, 7, 'hu', 'Aerob', NULL), +(5, 8, 'hu', 'Anaerob', NULL), +(6, 9, 'hu', 'Max Erő', NULL), +(7, 10, 'hu', 'Erő állóképesség', NULL), +(8, 11, 'hu', 'Testtömegindex', NULL), +(9, 12, 'hu', 'Anyagcsere', NULL), +(10, 13, 'hu', 'Méretek', NULL), +(11, 14, 'hu', 'Mellizom', NULL), +(12, 15, 'hu', 'Bicepsz', NULL), +(13, 16, 'hu', 'Tricepsz', NULL), +(14, 17, 'hu', 'Vállak', NULL), +(15, 18, 'hu', 'Comb', NULL), +(16, 19, 'hu', 'Vádli', NULL), +(17, 20, 'hu', 'Hát', NULL); +(18, 21, 'hu', 'Test Center', "Üdv"); /*!40000 ALTER TABLE `exercise_tree_translation` ENABLE KEYS */; -- Struktúra mentése tábla aitrainer2. exercise_type diff --git a/data/db/update_1_0_28.sql b/data/db/update_1_0_28.sql new file mode 100644 index 0000000..b8d4081 --- /dev/null +++ b/data/db/update_1_0_28.sql @@ -0,0 +1,12 @@ +START TRANSACTION; + +ALTER TABLE `exercise_tree` + ADD COLUMN `description` TEXT NULL DEFAULT NULL AFTER `name`; +ALTER TABLE `exercise_tree_translation` + ADD COLUMN `description` TEXT NULL DEFAULT NULL AFTER `name`; + + +UPDATE configuration set config_value = "1.0.28", date_change=CURRENT_DATE WHERE config_key = "db_version"; + +COMMIT; + diff --git a/src/main/kotlin/com/aitrainer/api/controller/ExerciseTreeController.kt b/src/main/kotlin/com/aitrainer/api/controller/ExerciseTreeController.kt index 276045b..6199acf 100644 --- a/src/main/kotlin/com/aitrainer/api/controller/ExerciseTreeController.kt +++ b/src/main/kotlin/com/aitrainer/api/controller/ExerciseTreeController.kt @@ -17,7 +17,7 @@ class ExerciseTreeController (private val exerciseTreeRepository: ExerciseTreeRe @GetMapping("/exercise_tree") fun getAllActiveMenu(): ResponseEntity> { val list: List = exerciseTreeRepository.getActiveMenu() - logger.info(" -- Get All active Exercise Tree menu.. $list") + logger.info(" -- Get All active Exercise Tree menu.") return if (list.isEmpty()) ResponseEntity.notFound().build() else ResponseEntity.ok().body(list) } diff --git a/src/main/kotlin/com/aitrainer/api/model/ExerciseTree.kt b/src/main/kotlin/com/aitrainer/api/model/ExerciseTree.kt index dd2ce26..75be8ec 100644 --- a/src/main/kotlin/com/aitrainer/api/model/ExerciseTree.kt +++ b/src/main/kotlin/com/aitrainer/api/model/ExerciseTree.kt @@ -12,6 +12,7 @@ data class ExerciseTree ( @Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val treeId: Long = 0, @Expose @get: NotBlank var name: String = "", + @Expose @get: NotBlank var description: String = "", @Expose @get: NotBlank var imageUrl: String = "", @Expose @get: NonNull var active: Boolean? diff --git a/src/main/kotlin/com/aitrainer/api/model/ExerciseTreeTranslation.kt b/src/main/kotlin/com/aitrainer/api/model/ExerciseTreeTranslation.kt index 0d8d59c..6463a9f 100644 --- a/src/main/kotlin/com/aitrainer/api/model/ExerciseTreeTranslation.kt +++ b/src/main/kotlin/com/aitrainer/api/model/ExerciseTreeTranslation.kt @@ -10,7 +10,8 @@ data class ExerciseTreeTranslation ( @Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0, @Expose @get: NotBlank var languageCode: String?, - @Expose @get: NotBlank var name: String = "" + @Expose @get: NotBlank var name: String = "", + @Expose @get: NotBlank var description: String = "" ) { diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index ec38531..afdd18b 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -17,6 +17,6 @@ logging.config=classpath:logback-spring.xml logging.file=logs # if the database structure has been changed, increment this version number -application.version=1.0.27 +application.version=1.0.28 jwt.secret=aitrainer \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e31cb29..59ab5c7 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -17,6 +17,6 @@ logging.config=classpath:logback-spring.xml logging.file=logs # if the database structure has been changed, increment this version number -application.version=1.0.27 +application.version=1.0.28 jwt.secret=aitrainer \ No newline at end of file diff --git a/src/test/kotlin/com/aitrainer/api/test/ExerciseTreeTest.kt b/src/test/kotlin/com/aitrainer/api/test/ExerciseTreeTest.kt index 569a756..e041ac3 100644 --- a/src/test/kotlin/com/aitrainer/api/test/ExerciseTreeTest.kt +++ b/src/test/kotlin/com/aitrainer/api/test/ExerciseTreeTest.kt @@ -29,5 +29,9 @@ class ExerciseTreeTest { assertEquals(exerciseTreeItem.name, "Cardio") assertEquals(responseEntity.body!![1].translations[0].name, "Erő!") assertEquals(responseEntity.body!![0].abilities[0].exerciseAbilityId, 3) + assertEquals(responseEntity.body!![15].name, "Test Center") + assertEquals(responseEntity.body!![15].description, "Welcome") + assertEquals(responseEntity.body!![15].translations[0].name, "Tesztközpont") + assertEquals(responseEntity.body!![15].translations[0].description, "Üdv") } } \ No newline at end of file