API1.0.28 ExerciseTree description

This commit is contained in:
Bossanyi Tibor 2021-03-10 21:14:51 +01:00
parent d2d7948a49
commit 2bb531afcd
9 changed files with 61 additions and 40 deletions

View File

@ -11,7 +11,7 @@ plugins {
} }
group = "com.aitrainer" group = "com.aitrainer"
version = "1.0.27" version = "1.0.28"
java.sourceCompatibility = JavaVersion.VERSION_1_8 java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories { repositories {

View File

@ -585,6 +585,7 @@ REPLACE INTO `exercise_plan_translation` (`translation_id`, `language_code`, `na
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,
`name` char(50) DEFAULT NULL, `name` char(50) DEFAULT NULL,
`description` text DEFAULT NULL,
`image_url` char(200) DEFAULT NULL, `image_url` char(200) DEFAULT NULL,
`active` tinyint(1) DEFAULT 1, `active` tinyint(1) DEFAULT 1,
PRIMARY KEY (`tree_id`) USING BTREE, 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; ) 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`, `name`, `image_url`, `active`) VALUES REPLACE INTO `exercise_tree` (`tree_id`, `name`, `description`, `image_url`, `active`) VALUES
(3, 'Cardio', 'images/1.cardio.png', 1), (3, 'Cardio', NULL, 'images/1.cardio.png', 1),
(4, 'Strength', 'images/2.strength.png', 1), (4, 'Strength', NULL, 'images/2.strength.png', 1),
(5, 'Body Compositions', 'images/3.bcs1.png', 1), (5, 'Body Compositions', NULL, 'images/3.bcs1.png', 1),
(7, 'Aerob', 'images/1.1.aerob.png', 1), (7, 'Aerob', NULL, 'images/1.1.aerob.png', 1),
(8, 'Anaerob', 'images/1.2.anaerob.png', 1), (8, 'Anaerob', NULL, 'images/1.2.anaerob.png', 1),
(9, 'One Rep Max', 'images/2.2.1.1RM.png', 1), (9, 'One Rep Max', NULL, 'images/2.2.1.1RM.png', 1),
(10, 'Endurance', 'images/2.1.endurance.png', 1), (10, 'Endurance', NULL, 'images/2.1.endurance.png', 1),
(11, 'BMI', 'images/3.1.BMI.png', 0), (11, 'BMI', NULL, 'images/3.1.BMI.png', 0),
(12, 'BMR', 'images/3.2.BMR.png', 0), (12, 'BMR', NULL, 'images/3.2.BMR.png', 0),
(13, 'Sizes', 'images/3.3.sizes.png', 0), (13, 'Sizes', NULL, 'images/3.3.sizes.png', 0),
(14, 'Chest', 'images/2.2.1.1.chestpress.png', 1), (14, 'Chest', NULL, 'images/2.2.1.1.chestpress.png', 1),
(15, 'Biceps', 'images/2.2.1.3.biceps.png', 1), (15, 'Biceps', NULL, 'images/2.2.1.3.biceps.png', 1),
(16, 'Triceps', 'images/2.2.1.4.triceps.png', 1), (16, 'Triceps', NULL, 'images/2.2.1.4.triceps.png', 1),
(17, 'Shoulders', 'images/2.2.1.5.shoulders.png', 1), (17, 'Shoulders', NULL, 'images/2.2.1.5.shoulders.png', 1),
(18, 'Thigh', 'images/2.1.4.squats.png', 1), (18, 'Thigh', NULL, 'images/2.1.4.squats.png', 1),
(19, 'Calf', 'images/2.1.4.squats.png', 1), (19, 'Calf', NULL, 'images/2.1.4.squats.png', 1),
(20, 'Back', 'images/2.2.1.5.shoulders.png', 1); (20, 'Back', NULL, 'images/2.2.1.5.shoulders.png', 1);
(21, 'Test Center', '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` ( 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,
@ -647,6 +648,7 @@ CREATE TABLE IF NOT EXISTS `exercise_tree_translation` (
`tree_id` int(13) NOT NULL DEFAULT 0, `tree_id` int(13) NOT NULL DEFAULT 0,
`language_code` char(2) DEFAULT NULL, `language_code` char(2) DEFAULT NULL,
`name` char(100) DEFAULT NULL, `name` char(100) DEFAULT NULL,
`description` text DEFAULT NULL,
PRIMARY KEY (`translation_id`), PRIMARY KEY (`translation_id`),
KEY `tree_id` (`tree_id`) KEY `tree_id` (`tree_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4; ) 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) -- Tábla adatainak mentése aitrainer2.exercise_tree_translation: ~2 rows (hozzávetőleg)
/*!40000 ALTER TABLE `exercise_tree_translation` DISABLE KEYS */; /*!40000 ALTER TABLE `exercise_tree_translation` DISABLE KEYS */;
REPLACE INTO `exercise_tree_translation` (`translation_id`, `tree_id`, `language_code`, `name`) VALUES REPLACE INTO `exercise_tree_translation` (`translation_id`, `tree_id`, `language_code`, `name`) VALUES
(1, 3, 'hu', 'Kardió'), (1, 3, 'hu', 'Kardió', NULL),
(2, 4, 'hu', 'Erő'), (2, 4, 'hu', 'Erő', NULL),
(4, 7, 'hu', 'Aerob'), (4, 7, 'hu', 'Aerob', NULL),
(5, 8, 'hu', 'Anaerob'), (5, 8, 'hu', 'Anaerob', NULL),
(6, 9, 'hu', 'Max Erő'), (6, 9, 'hu', 'Max Erő', NULL),
(7, 10, 'hu', 'Erő állóképesség'), (7, 10, 'hu', 'Erő állóképesség', NULL),
(8, 11, 'hu', 'Testtömegindex'), (8, 11, 'hu', 'Testtömegindex', NULL),
(9, 12, 'hu', 'Anyagcsere'), (9, 12, 'hu', 'Anyagcsere', NULL),
(10, 13, 'hu', 'Méretek'), (10, 13, 'hu', 'Méretek', NULL),
(11, 14, 'hu', 'Mellizom'), (11, 14, 'hu', 'Mellizom', NULL),
(12, 15, 'hu', 'Bicepsz'), (12, 15, 'hu', 'Bicepsz', NULL),
(13, 16, 'hu', 'Tricepsz'), (13, 16, 'hu', 'Tricepsz', NULL),
(14, 17, 'hu', 'Vállak'), (14, 17, 'hu', 'Vállak', NULL),
(15, 18, 'hu', 'Comb'), (15, 18, 'hu', 'Comb', NULL),
(16, 19, 'hu', 'Vádli'), (16, 19, 'hu', 'Vádli', NULL),
(17, 20, 'hu', 'Hát'); (17, 20, 'hu', 'Hát', NULL);
(18, 21, 'hu', 'Test Center', "Üdv");
/*!40000 ALTER TABLE `exercise_tree_translation` ENABLE KEYS */; /*!40000 ALTER TABLE `exercise_tree_translation` ENABLE KEYS */;
-- Struktúra mentése tábla aitrainer2. exercise_type -- Struktúra mentése tábla aitrainer2. exercise_type

12
data/db/update_1_0_28.sql Normal file
View File

@ -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;

View File

@ -17,7 +17,7 @@ class ExerciseTreeController (private val exerciseTreeRepository: ExerciseTreeRe
@GetMapping("/exercise_tree") @GetMapping("/exercise_tree")
fun getAllActiveMenu(): ResponseEntity<List<ExerciseTree>> { fun getAllActiveMenu(): ResponseEntity<List<ExerciseTree>> {
val list: List<ExerciseTree> = exerciseTreeRepository.getActiveMenu() val list: List<ExerciseTree> = 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 return if (list.isEmpty()) ResponseEntity.notFound().build() else
ResponseEntity.ok().body(list) ResponseEntity.ok().body(list)
} }

View File

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

View File

@ -10,7 +10,8 @@ data class ExerciseTreeTranslation (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0, @Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
@Expose @get: NotBlank var languageCode: String?, @Expose @get: NotBlank var languageCode: String?,
@Expose @get: NotBlank var name: String = "" @Expose @get: NotBlank var name: String = "",
@Expose @get: NotBlank var description: String = ""
) { ) {

View File

@ -17,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.27 application.version=1.0.28
jwt.secret=aitrainer jwt.secret=aitrainer

View File

@ -17,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.27 application.version=1.0.28
jwt.secret=aitrainer jwt.secret=aitrainer

View File

@ -29,5 +29,9 @@ class ExerciseTreeTest {
assertEquals(exerciseTreeItem.name, "Cardio") assertEquals(exerciseTreeItem.name, "Cardio")
assertEquals(responseEntity.body!![1].translations[0].name, "Erő!") assertEquals(responseEntity.body!![1].translations[0].name, "Erő!")
assertEquals(responseEntity.body!![0].abilities[0].exerciseAbilityId, 3) 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")
} }
} }