diff --git a/build.gradle.kts b/build.gradle.kts index 933932e..d26e696 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { } group = "com.aitrainer" -version = "1.0.32" +version = "1.0.33" java.sourceCompatibility = JavaVersion.VERSION_1_8 repositories { diff --git a/data/db/install.sql b/data/db/install.sql index bf5b9ff..36fcf9a 100644 --- a/data/db/install.sql +++ b/data/db/install.sql @@ -1396,8 +1396,11 @@ CREATE TABLE `tutorial_steps` ( `tutorial_text` TEXT NOT NULL COLLATE 'utf8_hungarian_ci', `error_text` TEXT NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci', `check_text` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci', + `condition` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci', + `parent` INT(3) NOT NULL DEFAULT '0', PRIMARY KEY (`tutorial_step_id`) USING BTREE, - INDEX `tutorial_id` (`tutorial_id`) USING BTREE + INDEX `tutorial_id` (`tutorial_id`) USING BTREE, + INDEX `parent` (`parent`) USING BTREE ) COLLATE='utf8_hungarian_ci' ENGINE=InnoDB diff --git a/data/db/update_1_0_33.sql b/data/db/update_1_0_33.sql new file mode 100644 index 0000000..edac21b --- /dev/null +++ b/data/db/update_1_0_33.sql @@ -0,0 +1,14 @@ +START TRANSACTION; + + +ALTER TABLE `tutorial_steps` + ADD COLUMN `condition` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci' AFTER `check_text`; + +ALTER TABLE `tutorial_steps` + ADD COLUMN `parent` INT(3) NOT NULL DEFAULT '0' AFTER `condition`; + + +UPDATE configuration set config_value = "1.0.33", date_change=CURRENT_DATE WHERE config_key = "db_version"; + +COMMIT; + diff --git a/src/main/kotlin/com/aitrainer/api/model/TutorialSteps.kt b/src/main/kotlin/com/aitrainer/api/model/TutorialSteps.kt index ec1791c..8d32f04 100644 --- a/src/main/kotlin/com/aitrainer/api/model/TutorialSteps.kt +++ b/src/main/kotlin/com/aitrainer/api/model/TutorialSteps.kt @@ -15,6 +15,8 @@ data class TutorialSteps ( @Expose @get: NotBlank var step: Int = 0, @Expose var errorText: String? = null, @Expose var checkText: String? = null, + @Expose var condition: String? = null, + @Expose @get: NotBlank var parent: Int = 0, ) { @ManyToOne(fetch = FetchType.LAZY, optional = false) diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 2063886..99d67e8 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.32 +application.version=1.0.33 jwt.secret=aitrainer \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 6433459..cbec6ca 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.32 +application.version=1.0.33 jwt.secret=aitrainer \ No newline at end of file diff --git a/src/test/kotlin/com/aitrainer/api/test/AppPackageTest.kt b/src/test/kotlin/com/aitrainer/api/test/AppPackageTest.kt index 0ed7d8c..24822be 100644 --- a/src/test/kotlin/com/aitrainer/api/test/AppPackageTest.kt +++ b/src/test/kotlin/com/aitrainer/api/test/AppPackageTest.kt @@ -135,7 +135,9 @@ class AppPackageTest { val tutorials: List = gson.fromJson(tutorialJson, type) assertEquals(tutorials.size, 1) assertEquals(tutorials[0].name, "Basic") - assertEquals(tutorials[0].steps.size, 2) + assertEquals(tutorials[0].steps.size, 4) + assertEquals(tutorials[0].steps[3].parent, 2) + assertEquals(tutorials[0].steps[3].condition, "Check2") assertEquals(tutorials[0].steps[0].translations.size, 2) } }