diff --git a/build.gradle.kts b/build.gradle.kts index ee52766..0e91833 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { } group = "com.aitrainer" -version = "1.0.15" +version = "1.0.16" java.sourceCompatibility = JavaVersion.VERSION_1_8 repositories { diff --git a/data/db/install.sql b/data/db/install.sql index 857b75c..48864c9 100644 --- a/data/db/install.sql +++ b/data/db/install.sql @@ -374,6 +374,8 @@ CREATE TABLE `customer_property` ( `property_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', `property_value` DOUBLE UNSIGNED NOT NULL DEFAULT '0', `date_add` DATETIME NULL DEFAULT NULL, + `sort` INT(11) NULL DEFAULT '0', + `place` TINYINT(4) NULL DEFAULT '0', PRIMARY KEY (`customer_property_id`) USING BTREE ) COLLATE='utf8_hungarian_ci' @@ -391,9 +393,11 @@ COLLATE='utf8_hungarian_ci' ENGINE=InnoDB ; -INSERT INTO `exercise_device` (`exercise_device_id`, `name`, `description`, `image_url`) VALUES (1, 'Weight', NULL, NULL); -INSERT INTO `exercise_device` (`exercise_device_id`, `name`, `description`, `image_url`) VALUES (2, 'Own Weight', NULL, NULL); - +INSERT INTO `exercise_device` (`exercise_device_id`, `name`, `description`, `image_url`, `sort`, `place`) VALUES (1, 'Weight', NULL, NULL, 5, 0); +INSERT INTO `exercise_device` (`exercise_device_id`, `name`, `description`, `image_url`, `sort`, `place`) VALUES (2, 'Own Weight', NULL, NULL, 4, 0); +INSERT INTO `exercise_device` (`exercise_device_id`, `name`, `description`, `image_url`, `sort`, `place`) VALUES (3, 'Machine', '', 'images/csengo2.png', 3, 0); +INSERT INTO `exercise_device` (`exercise_device_id`, `name`, `description`, `image_url`, `sort`, `place`) VALUES (4, 'HOME', NULL, NULL, 1, 1); +INSERT INTO `exercise_device` (`exercise_device_id`, `name`, `description`, `image_url`, `sort`, `place`) VALUES (5, 'STREET', NULL, NULL, 2, 1); CREATE TABLE `exercise_device_translation` ( `translation_id` INT(11) NOT NULL AUTO_INCREMENT, diff --git a/data/db/update_1_0_16.sql b/data/db/update_1_0_16.sql new file mode 100644 index 0000000..b6456cf --- /dev/null +++ b/data/db/update_1_0_16.sql @@ -0,0 +1,5 @@ +ALTER TABLE `exercise_device` + ADD COLUMN `sort` INT NULL DEFAULT '0' AFTER `image_url`, + ADD COLUMN `place` TINYINT NULL DEFAULT '0' AFTER `sort`; + +UPDATE configuration set config_value = "1.0.16", date_change=CURRENT_DATE WHERE config_key = "db_version"; \ No newline at end of file diff --git a/src/main/kotlin/com/aitrainer/api/model/ExerciseDevice.kt b/src/main/kotlin/com/aitrainer/api/model/ExerciseDevice.kt index 3ab9462..188b8fe 100644 --- a/src/main/kotlin/com/aitrainer/api/model/ExerciseDevice.kt +++ b/src/main/kotlin/com/aitrainer/api/model/ExerciseDevice.kt @@ -13,7 +13,9 @@ data class ExerciseDevice ( @get: NotBlank var name: String = "", @get: NotBlank var description: String = "", - @get: NotBlank var imageUrl: String = "" + @get: NotBlank var imageUrl: String = "", + @get: NotBlank var sort: Int = 0, + @get: NotBlank var place: Int = 0 ){ @OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseDevice") @Fetch(value = FetchMode.SUBSELECT) diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index d68e3e7..41b60bb 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -16,6 +16,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.15 +application.version=1.0.16 jwt.secret=aitrainer \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c53ce4f..42eee8f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -16,6 +16,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.15 +application.version=1.0.16 jwt.secret=aitrainer \ No newline at end of file diff --git a/src/test/kotlin/com/aitrainer/api/test/ExerciseDeviceTest.kt b/src/test/kotlin/com/aitrainer/api/test/ExerciseDeviceTest.kt index 5350f5c..4a558a9 100644 --- a/src/test/kotlin/com/aitrainer/api/test/ExerciseDeviceTest.kt +++ b/src/test/kotlin/com/aitrainer/api/test/ExerciseDeviceTest.kt @@ -26,10 +26,11 @@ class ExerciseDeviceTest { assertTrue(properties is List) assertTrue(properties.isNotEmpty()) - assertEquals(properties.size, 3) + assertEquals(properties.size, 5) assertEquals(properties[0].name, "Weight") assertEquals(properties[0].translations[0].name, "Súlyzó") assertEquals(properties[1].name, "Own Weight") + assertEquals(properties[3].place, 1) } } \ No newline at end of file