API 1.0.39 FAQ sort

This commit is contained in:
Bossanyi Tibor 2021-05-14 11:12:41 +02:00
parent 7d78aa38fb
commit af4264d018
6 changed files with 15 additions and 5 deletions

View File

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

View File

@ -0,0 +1,8 @@
START TRANSACTION;
ALTER TABLE `faq`
ADD COLUMN `sort` INT NULL AFTER `description`;
UPDATE configuration set config_value = "1.0.38", date_change=CURRENT_DATE WHERE config_key = "db_version";
COMMIT;

View File

@ -10,7 +10,8 @@ import javax.persistence.*
data class Faq (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var faqId: Long = 0,
@Expose @get: NonNull var name: String,
@Expose @get: NonNull var description: String,
@Expose var description: String? = null,
@Expose var sort: Int? = null,
) {
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "faq")

View File

@ -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.37
application.version=1.0.38
jwt.secret=aitrainer

View File

@ -17,7 +17,7 @@ logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structure has been changed, increment this version number
application.version=1.0.37
application.version=1.0.38
jwt.secret=aitrainer
jasypt.encryptor.password=Tibor

View File

@ -160,8 +160,9 @@ class AppPackageTest {
val faqJson: String = record[1]
val type = object : TypeToken<List<Faq?>?>() {}.type
val faqs: List<Faq> = gson.fromJson(faqJson, type)
assertEquals(faqs.size,1)
assertEquals(faqs.size,2)
assertEquals(faqs[0].name, "What is 1RM?")
assertEquals(faqs[0].sort, 1)
assertEquals(faqs[0].translations[0].languageCode, "hu")
} else if (record[0] == TrainingPlan::class.simpleName) {
val trainingPlanJson: String = record[1]