API 1.0.46 TrainingPlanDay

This commit is contained in:
Bossanyi Tibor
2021-06-21 20:15:56 +02:00
parent 36c5bcbc49
commit 4fcdf02221
17 changed files with 126 additions and 150 deletions
@@ -1,17 +0,0 @@
package com.aitrainer.api.model
import com.google.gson.annotations.Expose
import org.springframework.lang.NonNull
import javax.persistence.Entity
import javax.persistence.GeneratedValue
import javax.persistence.GenerationType
import javax.persistence.Id
@Entity
data class ProductTest (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var productTestId: Int = 0,
@Expose @get: NonNull var customerId: Long = 0,
@Expose @get: NonNull var productId: Int = 0,
@Expose @get: NonNull var dateView: String? = null,
@Expose @get: NonNull var purchaseClick: Boolean = false
)
@@ -0,0 +1,19 @@
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 TrainingPlanDay (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var dayId: Long = 0,
@Expose @get: NonNull var name: String,
) {
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "trainingPlanDay")
@Fetch(value = FetchMode.SUBSELECT)
@Expose val translations: List<TrainingPlanDayTranslation> = mutableListOf<TrainingPlanDayTranslation>().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 TrainingPlanDayTranslation (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var translationId: Long = 0,
@Expose @get: NotBlank var languageCode: String? = "hu",
@Expose @get: NonNull var nameTranslation: String? = null,
) {
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "dayId", nullable = false)
@JsonIgnore val trainingPlanDay: TrainingPlanDay? = null
}
@@ -17,6 +17,7 @@ data class TrainingPlanDetail (
@Expose var restingTime: Int? = 0,
@Expose var parallel: Boolean? = false,
@Expose var day: String? = null,
@Expose var dayId: Int? = 0,
) {