API 1.0.37+2 SSL, password encryption, TrainingPlanTranslation

This commit is contained in:
Bossanyi Tibor
2021-05-12 20:46:10 +02:00
parent a38c244d79
commit 7d78aa38fb
20 changed files with 540 additions and 17 deletions
@@ -0,0 +1,16 @@
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 CustomerTrainingPlan (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var customerTrainingPlanId: Long = 0,
@Expose @get: NonNull var customerId: Long = 0,
@Expose @get: NonNull var trainingPlanId: Long = 0,
@Expose @get: NonNull var dateAdd: String? = null
)
@@ -11,10 +11,15 @@ import javax.validation.constraints.NotBlank
data class TrainingPlan (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var trainingPlanId: Long = 0,
@Expose @get: NotBlank var name: String = "",
@Expose var description: String?,
@Expose @get: NotBlank var type: String = "",
) {
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "trainingPlan")
@Fetch(value = FetchMode.SUBSELECT)
@Expose val details: List<TrainingPlanDetail> = mutableListOf<TrainingPlanDetail>().toList()
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "trainingPlan")
@Fetch(value = FetchMode.SUBSELECT)
@Expose val details: List<TrainingPlanDetail> = mutableListOf<TrainingPlanDetail>().toList()
@OneToMany(fetch = FetchType.EAGER, mappedBy = "trainingPlan")
@Fetch(value = FetchMode.SUBSELECT)
@Expose val translations: List<TrainingPlanTranslation> = mutableListOf<TrainingPlanTranslation>()
}
@@ -11,11 +11,11 @@ data class TrainingPlanDetail (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var trainingPlanDetailId: Long = 0,
@Expose @get: NotBlank var exerciseTypeId: Int = 0,
@Expose @get: NotBlank var sort: Int = 0,
@Expose @get: NotBlank var set: Int = 0,
@Expose @get: NotBlank var repeats: Int = 0,
@Expose @get: NotBlank var weight: Double = 0.0,
@Expose @get: NotBlank var restingTime: Int = 0,
@Expose @get: NotBlank var parallel: Boolean = false,
@Expose var set: Int = 0,
@Expose var repeats: Int? = 0,
@Expose var weight: Double? = 0.0,
@Expose var restingTime: Int? = 0,
@Expose var parallel: Boolean? = false,
@Expose var day: String? = null,
) {
@@ -24,7 +24,4 @@ data class TrainingPlanDetail (
@JoinColumn(name = "trainingPlanId", nullable = false)
@JsonIgnore
val trainingPlan: TrainingPlan? = null
}
@@ -0,0 +1,23 @@
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 TrainingPlanTranslation (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
@Expose @get: NotBlank var languageCode: String?,
@Expose @get: NotBlank var nameTranslation: String = "",
@Expose @get: NotBlank var descriptionTranslation: String = "",
) {
@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "trainingPlanId", nullable = false)
@JsonIgnore
val trainingPlan: TrainingPlan? = null
}