API 1.0.50 AppText Translations
This commit is contained in:
@@ -27,7 +27,8 @@ class PackageController(private val exerciseAbilityRepository: ExerciseAbilityRe
|
||||
private val faqRepository: FaqRepository,
|
||||
private val trainingPlanRepository: TrainingPlanRepository,
|
||||
private val splitTestsRepository: SplitTestsRepository,
|
||||
private val trainingPlanDayRepository: TrainingPlanDayRepository
|
||||
private val trainingPlanDayRepository: TrainingPlanDayRepository,
|
||||
private val appTextRepository: AppTextRepository
|
||||
) {
|
||||
private val logger = LoggerFactory.getLogger(javaClass)
|
||||
|
||||
@@ -87,6 +88,9 @@ class PackageController(private val exerciseAbilityRepository: ExerciseAbilityRe
|
||||
val listTrainingPlanDay = trainingPlanDayRepository.findAll()
|
||||
val listTrainingPlanDayJson = gson.toJson(listTrainingPlanDay)
|
||||
|
||||
val listAppText = appTextRepository.findAll()
|
||||
val listAppTextJson = gson.toJson(listAppText)
|
||||
|
||||
val packageJson: String =
|
||||
getClassRecord(ExerciseDevice::class.simpleName, listDevicesJson) +
|
||||
"|||" + getClassRecord(Product::class.simpleName, listProductsJson) +
|
||||
@@ -103,7 +107,8 @@ class PackageController(private val exerciseAbilityRepository: ExerciseAbilityRe
|
||||
"|||" + getClassRecord(Faq::class.simpleName, listFaqJson) +
|
||||
"|||" + getClassRecord(TrainingPlan::class.simpleName, listTrainingPlanJson) +
|
||||
"|||" + getClassRecord(SplitTests::class.simpleName, listSplitTestsJson) +
|
||||
"|||" + getClassRecord(TrainingPlanDay::class.simpleName, listTrainingPlanDayJson)
|
||||
"|||" + getClassRecord(TrainingPlanDay::class.simpleName, listTrainingPlanDayJson) +
|
||||
"|||" + getClassRecord(AppText::class.simpleName, listAppTextJson)
|
||||
|
||||
return if (packageJson.isEmpty()) ResponseEntity.notFound().build() else
|
||||
ResponseEntity.ok().body(packageJson)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
|
||||
@Entity
|
||||
data class AppText (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var textId: Long = 0,
|
||||
@Expose @get: NonNull var textKey: String,
|
||||
@Expose @get: NonNull var screenshotUrl: String,
|
||||
@Expose @get: NonNull var checked: Boolean? = null,
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "appText")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
@Expose val translations: List<AppTextTranslation> = mutableListOf<AppTextTranslation>().toList()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class AppTextTranslation (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var translationId: Long = 0,
|
||||
@Expose @get: NotBlank var languageCode: String? = "hu",
|
||||
@Expose @get: NonNull var text: String? = null
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "textId", nullable = false)
|
||||
@JsonIgnore val appText: AppText? = null
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.aitrainer.api.repository
|
||||
|
||||
import com.aitrainer.api.model.AppText
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
interface AppTextRepository: JpaRepository<AppText, Long> {
|
||||
}
|
||||
Reference in New Issue
Block a user