API 1.0.32 tutorials
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class Tutorial (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var tutorialId: Long = 0,
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "tutorial")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
@Expose val steps: List<TutorialSteps> = mutableListOf<TutorialSteps>().toList()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class TutorialSteps (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var tutorialStepId: Long = 0,
|
||||
@Expose @get: NotBlank var tutorialText: String = "",
|
||||
@Expose @get: NotBlank var step: Int = 0,
|
||||
@Expose var errorText: String? = null,
|
||||
@Expose var checkText: String? = null,
|
||||
) {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "tutorialId", nullable = false)
|
||||
@JsonIgnore
|
||||
val tutorial: Tutorial? = null
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "tutorialSteps")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
@Expose val translations: List<TutorialTranslation> = mutableListOf<TutorialTranslation>().toList()
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class TutorialTranslation (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
|
||||
|
||||
@Expose @get: NotBlank var languageCode: String?,
|
||||
@Expose @get: NotBlank var tutorialText: String = "",
|
||||
@Expose var errorText: String? = null,
|
||||
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "tutorialStepId", nullable = false)
|
||||
@JsonIgnore
|
||||
val tutorialSteps: TutorialSteps? = null
|
||||
}
|
||||
Reference in New Issue
Block a user