API 1.0.17 ExerciseTypeAlternative ExerciseDeviceAlternative ExerciseTypeParents
This commit is contained in:
@@ -20,4 +20,8 @@ data class ExerciseDevice (
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseDevice")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseDeviceTranslation> = mutableListOf<ExerciseDeviceTranslation>().toList()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseDevice")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val alternatives: List<ExerciseDeviceAlternative> = mutableListOf<ExerciseDeviceAlternative>().toList()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class ExerciseDeviceAlternative (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var exerciseDeviceAlternativeId: Long = 0,
|
||||
//@get: NotNull var exerciseDeviceParentId: Long?,
|
||||
@get: NotNull var exerciseDeviceChildId: Long?
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseDeviceParentId", nullable = false)
|
||||
@JsonIgnore
|
||||
val exerciseDevice: ExerciseDevice? = null
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -32,4 +32,12 @@ data class ExerciseType(
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseTypeTranslation> = mutableListOf<ExerciseTypeTranslation>()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val alternatives: List<ExerciseTypeAlternative> = mutableListOf<ExerciseTypeAlternative>()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val parents: List<ExerciseTypeParents> = mutableListOf<ExerciseTypeParents>()
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class ExerciseTypeAlternative (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var exerciseTypeAlternativeId: Long = 0,
|
||||
//@get: NotNull var exerciseTypeParentId: Long?,
|
||||
@get: NotNull var exerciseTypeChildId: Long?
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseTypeParentId", nullable = false)
|
||||
@JsonIgnore
|
||||
val exerciseType: ExerciseType? = null
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class ExerciseTypeParents (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var exerciseTypeParentsId: Long = 0,
|
||||
@get: NotNull var exerciseTreeId: Long?
|
||||
//@get: NotNull var exerciseTypeId: Long?
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseTypeId", nullable = false)
|
||||
@JsonIgnore
|
||||
val exerciseType: ExerciseType? = null
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Repository
|
||||
interface ExerciseDeviceRepository: JpaRepository<ExerciseDevice, Long> {
|
||||
@Query("FROM ExerciseDevice as e " +
|
||||
"LEFT JOIN ExerciseDeviceTranslation as t ON e.exerciseDeviceId = t.exerciseDevice AND t.languageCode = 'hu' " +
|
||||
"LEFT JOIN ExerciseDeviceAlternative as t ON e.exerciseDeviceId = t.exerciseDevice " +
|
||||
"ORDER BY e.exerciseDeviceId ")
|
||||
fun getExerciseDevices(): List<ExerciseDevice>
|
||||
}
|
||||
@@ -17,6 +17,8 @@ interface ExerciseTypeRepository : JpaRepository<ExerciseType, Long>{
|
||||
"LEFT JOIN ExerciseTypeImage as i ON e.exerciseTypeId = i.exerciseType " +
|
||||
"LEFT JOIN ExerciseTypeTranslation as t ON e.exerciseTypeId = t.exerciseType " +
|
||||
"LEFT JOIN ExerciseTypeDevice as td ON e.exerciseTypeId = td.exerciseType " +
|
||||
"LEFT JOIN ExerciseTypeAlternative as td ON e.exerciseTypeId = td.exerciseType " +
|
||||
"LEFT JOIN ExerciseTypeParents as td ON e.exerciseTypeId = td.exerciseType " +
|
||||
"WHERE e.active = 1 " +
|
||||
"AND t.languageCode = 'hu' " +
|
||||
"AND i.type = 'menu' " +
|
||||
|
||||
@@ -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.16
|
||||
application.version=1.0.17
|
||||
|
||||
jwt.secret=aitrainer
|
||||
@@ -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.16
|
||||
application.version=1.0.17
|
||||
|
||||
jwt.secret=aitrainer
|
||||
Reference in New Issue
Block a user