API 1.0.24 ExerciseAbility, AppPackage, AppCustomerPackage, Tracking
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
package com.aitrainer.api.controller
|
||||
|
||||
import com.aitrainer.api.model.*
|
||||
import com.aitrainer.api.repository.*
|
||||
import com.google.gson.GsonBuilder
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
class CustomerPackageController( private val customerRepository: CustomerRepository,
|
||||
private val customerExerciseDeviceRepository: CustomerExerciseDeviceRepository,
|
||||
private val exercisesRepository: ExercisesRepository,
|
||||
private val productTestRepository: ProductTestRepository,
|
||||
private val purchaseRepository: PurchaseRepository,
|
||||
private val customerPropertyRepository: CustomerPropertyRepository,
|
||||
private val exerciseResultRepository: ExerciseResultRepository) {
|
||||
|
||||
@GetMapping("/app_customer_package/{id}")
|
||||
fun getCustomerPackageData(@PathVariable(value = "id") customerId: Long): ResponseEntity<String> {
|
||||
|
||||
if (customerId <= 0) {
|
||||
return ResponseEntity.notFound().build()
|
||||
}
|
||||
|
||||
val gson = GsonBuilder()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.setPrettyPrinting()
|
||||
.create()
|
||||
|
||||
val customer: Customer = customerRepository.findById(customerId).orElse(null)
|
||||
?: return ResponseEntity.notFound().build()
|
||||
val customerJson: String = gson.toJson(customer)
|
||||
|
||||
val listCustomerExerciseDevices = customerExerciseDeviceRepository.findByCustomerId(customerId)
|
||||
val listCustomerExerciseDeviceJson = gson.toJson(listCustomerExerciseDevices)
|
||||
|
||||
val listExercises = exercisesRepository.getAllByCustomerIdOrderByDateAddDesc(customerId)
|
||||
val listExercisesJson = gson.toJson(listExercises)
|
||||
|
||||
val listProductTest = productTestRepository.findByCustomerId(customerId)
|
||||
val listProductTestJson = gson.toJson(listProductTest)
|
||||
|
||||
val listPurchase = purchaseRepository.findByCustomerId(customerId)
|
||||
val listPurchaseJson = gson.toJson(listPurchase)
|
||||
|
||||
val listCustomerProperty = customerPropertyRepository.findAllByCustomerId(customerId)
|
||||
val listCustomerPropertyJson = gson.toJson(listCustomerProperty)
|
||||
|
||||
val listExerciseResult = exerciseResultRepository.getAllByCustomerId(customerId)
|
||||
val listExerciseResultJson = gson.toJson(listExerciseResult)
|
||||
|
||||
val packageJson: String =
|
||||
getClassRecord(Customer::class.simpleName, customerJson) +
|
||||
"|||" + getClassRecord(CustomerExerciseDevice::class.simpleName, listCustomerExerciseDeviceJson) +
|
||||
"|||" + getClassRecord(Exercises::class.simpleName, listExercisesJson) +
|
||||
"|||" + getClassRecord(ProductTest::class.simpleName, listProductTestJson) +
|
||||
"|||" + getClassRecord(Purchase::class.simpleName, listPurchaseJson) +
|
||||
"|||" + getClassRecord(CustomerProperty::class.simpleName, listCustomerPropertyJson) +
|
||||
"|||" + getClassRecord(ExerciseResult::class.simpleName, listExerciseResultJson)
|
||||
|
||||
return if (packageJson.isEmpty()) ResponseEntity.notFound().build() else
|
||||
ResponseEntity.ok().body(packageJson)
|
||||
}
|
||||
|
||||
fun getClassRecord(className: String?, json: String): String {
|
||||
return "$className***$json"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.aitrainer.api.controller
|
||||
|
||||
import com.aitrainer.api.model.ExerciseAbility
|
||||
import com.aitrainer.api.model.ExerciseDevice
|
||||
import com.aitrainer.api.repository.ExerciseAbilityRepository
|
||||
import com.aitrainer.api.repository.ExerciseDeviceRepository
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
class ExerciseAbilityController(private val exerciseAbilityRepository: ExerciseAbilityRepository) {
|
||||
private val logger = LoggerFactory.getLogger(javaClass)
|
||||
|
||||
@GetMapping("/exercise_ability")
|
||||
fun getAbilities(): ResponseEntity<List<ExerciseAbility>> {
|
||||
val list = exerciseAbilityRepository.findAll()
|
||||
|
||||
logger.info(" -- Get All ExerciseAbility $list")
|
||||
return if (list.isEmpty()) ResponseEntity.notFound().build() else
|
||||
ResponseEntity.ok().body(list)
|
||||
}
|
||||
}
|
||||
@@ -51,8 +51,7 @@ class ExerciseTypeController ( private val exerciseTypeRepository: ExerciseTypeR
|
||||
return exerciseTypeRepository.findById(exerciseTypeId).map { existingExerciseType ->
|
||||
val updatedExerciseType: ExerciseType = existingExerciseType
|
||||
.copy(name = newExerciseType.name,
|
||||
description = newExerciseType.description,
|
||||
treeId = newExerciseType.treeId)
|
||||
description = newExerciseType.description)
|
||||
ResponseEntity.ok().body(exerciseTypeRepository.save(updatedExerciseType))
|
||||
}.orElse(ResponseEntity.notFound().build())
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.aitrainer.api.controller
|
||||
|
||||
import com.aitrainer.api.model.*
|
||||
import com.aitrainer.api.repository.*
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import com.google.gson.GsonBuilder
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
class PackageController(private val exerciseAbilityRepository: ExerciseAbilityRepository,
|
||||
private val exerciseTypeRepository: ExerciseTypeRepository,
|
||||
private val exerciseTreeRepository: ExerciseTreeRepository,
|
||||
private val propertyRepository: PropertyRepository,
|
||||
private val productRepository: ProductRepository,
|
||||
private val exerciseDeviceRepository: ExerciseDeviceRepository,
|
||||
private val exerciseTreeParentsRepository: ExerciseTreeParentsRepository
|
||||
) {
|
||||
private val logger = LoggerFactory.getLogger(javaClass)
|
||||
|
||||
@GetMapping("/app_package")
|
||||
fun getPackageData(): ResponseEntity<String> {
|
||||
|
||||
val gson = GsonBuilder()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.setPrettyPrinting()
|
||||
.create()
|
||||
|
||||
val listDevices: List<ExerciseDevice> = exerciseDeviceRepository.getExerciseDevices()
|
||||
val listDevicesJson: String = gson.toJson(listDevices)
|
||||
|
||||
val listProducts = productRepository.findAll()
|
||||
val listProductsJson: String = gson.toJson(listProducts)
|
||||
|
||||
val listProperty:List<Property> = propertyRepository.getProperties()
|
||||
val listPropertyJson: String = gson.toJson(listProperty)
|
||||
|
||||
val listExerciseTree = exerciseTreeRepository.getActiveMenu()
|
||||
val listExerciseTreeJson: String = gson.toJson(listExerciseTree)
|
||||
|
||||
val listExerciseType = exerciseTypeRepository.getActiveExerciseTypes()
|
||||
val listExerciseTypeJson = gson.toJson(listExerciseType)
|
||||
|
||||
val listExerciseAbility = exerciseAbilityRepository.findAll()
|
||||
val listExerciseAbilityJson: String = gson.toJson(listExerciseAbility)
|
||||
|
||||
val listExerciseTreeParents = exerciseTreeParentsRepository.findAll()
|
||||
val listExerciseTreeParentsJson: String = gson.toJson(listExerciseTreeParents)
|
||||
|
||||
|
||||
val packageJson: String =
|
||||
getClassRecord(ExerciseDevice::class.simpleName, listDevicesJson) +
|
||||
"|||" + getClassRecord(Product::class.simpleName, listProductsJson) +
|
||||
"|||" + getClassRecord(Property::class.simpleName, listPropertyJson) +
|
||||
"|||" + getClassRecord(ExerciseTree::class.simpleName, listExerciseTreeJson) +
|
||||
"|||" + getClassRecord(ExerciseType::class.simpleName, listExerciseTypeJson) +
|
||||
"|||" + getClassRecord(ExerciseAbility::class.simpleName, listExerciseAbilityJson) +
|
||||
"|||" + getClassRecord(ExerciseTreeParents::class.simpleName, listExerciseTreeParentsJson)
|
||||
|
||||
return if (packageJson.isEmpty()) ResponseEntity.notFound().build() else
|
||||
ResponseEntity.ok().body(packageJson)
|
||||
}
|
||||
|
||||
fun getClassRecord(className: String?, json: String): String {
|
||||
return "$className***$json"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.aitrainer.api.controller
|
||||
|
||||
import com.aitrainer.api.model.Tracking
|
||||
import com.aitrainer.api.repository.TrackingRepository
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import javax.validation.Valid
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
class TrackingController(private val trackingRepository: TrackingRepository) {
|
||||
|
||||
@PostMapping("/tracking")
|
||||
fun createNewTracking(@Valid @RequestBody tracking: Tracking): ResponseEntity<Tracking> {
|
||||
return ResponseEntity.ok().body(trackingRepository.save(tracking))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +1,29 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import javax.persistence.*
|
||||
|
||||
@Entity
|
||||
data class Customer (
|
||||
var name: String = "",
|
||||
var firstname: String = "",
|
||||
var email: String = "",
|
||||
var age: Int? = 0,
|
||||
var sex: String = "m",
|
||||
var active: String = "N",
|
||||
var dateAdd: String? = null,
|
||||
var dateChange: String? = null,
|
||||
var dataPolicyAllowed: Int = 0,
|
||||
var admin: Int = 0,
|
||||
var trainer: Int = 0,
|
||||
var trainerId: Long = 0,
|
||||
var password: String? = "",
|
||||
var birthYear:Int = 0,
|
||||
var goal: String? = null,
|
||||
var fitnessLevel: String = "beginner",
|
||||
var bodyType: String? = null,
|
||||
var firebaseUid: String? = null,
|
||||
@Expose var name: String = "",
|
||||
@Expose var firstname: String = "",
|
||||
@Expose var email: String = "",
|
||||
@Expose var age: Int? = 0,
|
||||
@Expose var sex: String = "m",
|
||||
@Expose var active: String = "N",
|
||||
@Expose var dateAdd: String? = null,
|
||||
@Expose var dateChange: String? = null,
|
||||
@Expose var dataPolicyAllowed: Int = 0,
|
||||
@Expose var admin: Int = 0,
|
||||
@Expose var trainer: Int = 0,
|
||||
@Expose var trainerId: Long = 0,
|
||||
@Expose var password: String? = "",
|
||||
@Expose var birthYear:Int = 0,
|
||||
@Expose var goal: String? = null,
|
||||
@Expose var fitnessLevel: String = "beginner",
|
||||
@Expose var bodyType: String? = null,
|
||||
@Expose var firebaseUid: String? = null,
|
||||
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var customerId: Long = 0
|
||||
@Expose var customerId: Long = 0
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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 javax.persistence.*
|
||||
@@ -8,13 +9,11 @@ import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class CustomerExerciseDevice (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var customerExerciseDeviceId: Long = 0,
|
||||
@get: NotNull var exerciseDeviceId: Long?,
|
||||
@get: NotNull var customerId: Long?,
|
||||
@get: NotNull var favourite: Boolean?,
|
||||
@get: NotNull var dateAdd: String? = null
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var customerExerciseDeviceId: Long = 0,
|
||||
@Expose @get: NotNull var exerciseDeviceId: Long?,
|
||||
@Expose @get: NotNull var customerId: Long?,
|
||||
@Expose @get: NotNull var favourite: Boolean?,
|
||||
@Expose @get: NotNull var dateAdd: String? = null
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
@@ -8,9 +9,9 @@ import javax.persistence.Id
|
||||
|
||||
@Entity
|
||||
data class CustomerProperty (
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var customerPropertyId: Long = 0,
|
||||
@get: NonNull var customerId: Long = 0,
|
||||
@get: NonNull var propertyId: Long = 0,
|
||||
@get: NonNull var propertyValue: Double? = null,
|
||||
@get: NonNull var dateAdd: String? = null
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var customerPropertyId: Long = 0,
|
||||
@Expose @get: NonNull var customerId: Long = 0,
|
||||
@Expose @get: NonNull var propertyId: Long = 0,
|
||||
@Expose @get: NonNull var propertyValue: Double? = null,
|
||||
@Expose @get: NonNull var dateAdd: String? = null
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class ExerciseAbility (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val exerciseAbilityId: Long = 0,
|
||||
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
@Expose @get: NotBlank var description: String = "",
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import javax.persistence.*
|
||||
@@ -7,21 +8,19 @@ import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class ExerciseDevice (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val exerciseDeviceId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val exerciseDeviceId: Long = 0,
|
||||
|
||||
@get: NotBlank var name: String = "",
|
||||
@get: NotBlank var description: String = "",
|
||||
@get: NotBlank var imageUrl: String = "",
|
||||
@get: NotBlank var sort: Int = 0,
|
||||
@get: NotBlank var place: Int = 0
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
@Expose var description: String?,
|
||||
@Expose var imageUrl: String?,
|
||||
@Expose @get: NotBlank var sort: Int = 0,
|
||||
@Expose @get: NotBlank var place: Int = 0
|
||||
){
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseDevice")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseDeviceTranslation> = mutableListOf<ExerciseDeviceTranslation>().toList()
|
||||
@Expose 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()
|
||||
@Expose val alternatives: List<ExerciseDeviceAlternative> = mutableListOf<ExerciseDeviceAlternative>().toList()
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.Serializable
|
||||
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?
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var exerciseDeviceAlternativeId: Long = 0,
|
||||
@Expose @get: NotNull var exerciseDeviceChildId: Long?
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseDeviceParentId", nullable = false)
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import kotlinx.serialization.Contextual
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class ExerciseDeviceTranslation (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val translationId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
|
||||
|
||||
@get: NotBlank var languageCode: String?,
|
||||
@get: NotBlank var name: String = ""
|
||||
@Expose @get: NotBlank var languageCode: String?,
|
||||
@Expose @get: NotBlank var name: String = ""
|
||||
|
||||
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseDeviceId", nullable = false)
|
||||
@JsonIgnore
|
||||
@Contextual
|
||||
val exerciseDevice: ExerciseDevice? = null
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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
|
||||
@@ -9,16 +9,19 @@ import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class ExerciseTree (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val treeId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val treeId: Long = 0,
|
||||
|
||||
@get: NotBlank var name: String = "",
|
||||
@get: NotBlank var imageUrl: String = "",
|
||||
@get: NonNull var active: Boolean?
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
@Expose @get: NotBlank var imageUrl: String = "",
|
||||
@Expose @get: NonNull var active: Boolean?
|
||||
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseTree")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseTreeTranslation> = mutableListOf<ExerciseTreeTranslation>().toList()
|
||||
@Expose val translations: List<ExerciseTreeTranslation> = mutableListOf<ExerciseTreeTranslation>().toList()
|
||||
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseTree")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
@Expose val abilities: List<ExerciseTreeAbility> = mutableListOf()
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class ExerciseTreeAbility (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val exerciseTreeAbilityId: Long = 0,
|
||||
|
||||
@Expose @get: NotNull var exerciseAbilityId: Int?
|
||||
|
||||
) {
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name="exerciseTreeId", nullable=false)
|
||||
@JsonIgnore
|
||||
val exerciseTree: ExerciseTree? = null
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class ExerciseTreeParents (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var exerciseTreeParentsId: Long = 0,
|
||||
@get: NotNull var exerciseTreeParentId: Long?,
|
||||
@get: NotNull var exerciseTreeChildId: Long?
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var exerciseTreeParentsId: Long = 0,
|
||||
@Expose @get: NotNull var exerciseTreeParentId: Long?,
|
||||
@Expose @get: NotNull var exerciseTreeChildId: Long?
|
||||
)
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
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 ExerciseTreeTranslation (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val translationId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
|
||||
|
||||
@get: NotBlank var languageCode: String?,
|
||||
@get: NotBlank var name: String = ""
|
||||
@Expose @get: NotBlank var languageCode: String?,
|
||||
@Expose @get: NotBlank var name: String = ""
|
||||
|
||||
|
||||
) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.springframework.lang.NonNull
|
||||
@@ -9,39 +10,35 @@ import javax.validation.constraints.Null
|
||||
|
||||
@Entity
|
||||
data class ExerciseType(
|
||||
@get: NonNull var treeId: Int,
|
||||
@get: NotBlank var name: String = "",
|
||||
@get: NotBlank var description: String = "",
|
||||
@get: Null var unit: String?,
|
||||
@get: Null var unitQuantity: String?,
|
||||
@get: Null var unitQuantityUnit: String?,
|
||||
@get: NonNull var active: Boolean?,
|
||||
@get: NonNull var base: Boolean?,
|
||||
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
@Expose @get: NotBlank var description: String = "",
|
||||
@Expose @get: Null var unit: String?,
|
||||
@Expose @get: Null var unitQuantity: String?,
|
||||
@Expose @get: Null var unitQuantityUnit: String?,
|
||||
@Expose @get: NonNull var active: Boolean?,
|
||||
@Expose @get: NonNull var base: Boolean?,
|
||||
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val exerciseTypeId: Long = 0
|
||||
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val exerciseTypeId: Long = 0,
|
||||
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val images: List<ExerciseTypeImage> = mutableListOf<ExerciseTypeImage>()
|
||||
@Expose val images: List<ExerciseTypeImage> = mutableListOf()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseTypeTranslation> = mutableListOf<ExerciseTypeTranslation>()
|
||||
@Expose val translations: List<ExerciseTypeTranslation> = mutableListOf()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val alternatives: List<ExerciseTypeAlternative> = mutableListOf<ExerciseTypeAlternative>()
|
||||
@Expose val alternatives: List<ExerciseTypeAlternative> = mutableListOf()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val parents: List<ExerciseTypeParents> = mutableListOf<ExerciseTypeParents>()
|
||||
@Expose val parents: List<ExerciseTypeParents> = mutableListOf()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val devices: List<ExerciseTypeDevice> = mutableListOf<ExerciseTypeDevice>()
|
||||
|
||||
@Expose val devices: List<ExerciseTypeDevice> = mutableListOf()
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
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?
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var exerciseTypeAlternativeId: Long = 0,
|
||||
@Expose @get: NotNull var exerciseTypeChildId: Long?
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseTypeParentId", nullable = false)
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@Entity
|
||||
data class ExerciseTypeDevice (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val exerciseTypeDeviceId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val exerciseTypeDeviceId: Long = 0,
|
||||
|
||||
@get: NotNull var exerciseDeviceId: Int?
|
||||
@Expose @get: NotNull var exerciseDeviceId: Int?
|
||||
|
||||
) {
|
||||
|
||||
|
||||
@@ -1,20 +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 ExerciseTypeImage (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val imageId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val imageId: Long = 0,
|
||||
|
||||
//@get: NonNull var exerciseTypeId: Integer?,
|
||||
@get: NotBlank var name: String = "",
|
||||
@get: NotBlank var type: String = "",
|
||||
@get: NotBlank var url: String = ""
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
@Expose @get: NotBlank var type: String = "",
|
||||
@Expose @get: NotBlank var url: String = ""
|
||||
|
||||
) {
|
||||
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
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?
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var exerciseTypeParentsId: Long = 0,
|
||||
@Expose @get: NotNull var exerciseTreeId: Long?
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseTypeId", nullable = false)
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
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 ExerciseTypeTranslation (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val translationId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
|
||||
|
||||
@get: NotBlank var languageCode: String?,
|
||||
@get: NotBlank var name: String = "",
|
||||
@get: NotBlank var description: String = ""
|
||||
@Expose @get: NotBlank var languageCode: String?,
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
@Expose @get: NotBlank var description: String = ""
|
||||
) {
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
@@ -9,15 +10,14 @@ import javax.validation.constraints.Null
|
||||
|
||||
@Entity
|
||||
data class Exercises (
|
||||
@get: NonNull var exerciseTypeId: Long = 0,
|
||||
@get: NonNull var customerId: Long = 0,
|
||||
@get: NonNull var dateAdd: String? = null,
|
||||
@get: NonNull var quantity: Double? = null,
|
||||
@get: Null var restTime: Int?, // in seconds
|
||||
@get: NonNull var unit: String? = null,
|
||||
@get: NonNull var unitQuantity: Double? = null,
|
||||
@get: NonNull var exercisePlanDetailId: Int = 0,
|
||||
@Expose @get: NonNull var exerciseTypeId: Long = 0,
|
||||
@Expose @get: NonNull var customerId: Long = 0,
|
||||
@Expose @get: NonNull var dateAdd: String? = null,
|
||||
@Expose @get: NonNull var quantity: Double? = null,
|
||||
@Expose @get: Null var restTime: Int?, // in seconds
|
||||
@Expose @get: NonNull var unit: String? = null,
|
||||
@Expose @get: NonNull var unitQuantity: Double? = null,
|
||||
@Expose @get: NonNull var exercisePlanDetailId: Int = 0,
|
||||
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val exerciseId: Long = 0
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val exerciseId: Long = 0
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
@@ -15,18 +16,18 @@ import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class Product (
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var productId: Int,
|
||||
@get: NotBlank var name: String = "",
|
||||
@get: NotBlank var description: String = "",
|
||||
@get: NonNull var appVersion: String? = null,
|
||||
@get: NonNull var productSet: Int? = null,
|
||||
@get: NonNull var sort: Int? = null,
|
||||
@get: NonNull var type: String? = null,
|
||||
@get: NonNull var validFrom: String? = null,
|
||||
@get: NonNull var validTo: String? = null,
|
||||
@get: NonNull var productIdIos: String? = null,
|
||||
@get: NonNull var productIdAndroid: String? = null,
|
||||
@get: NonNull var priceIos: Double? = null,
|
||||
@get: NonNull var priceAndroid: Double? = null
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var productId: Int,
|
||||
@Expose @get: NotBlank var name: String = "",
|
||||
@Expose @get: NotBlank var description: String = "",
|
||||
@Expose @get: NonNull var appVersion: String? = null,
|
||||
@Expose @get: NonNull var productSet: Int? = null,
|
||||
@Expose @get: NonNull var sort: Int? = null,
|
||||
@Expose @get: NonNull var type: String? = null,
|
||||
@Expose @get: NonNull var validFrom: String? = null,
|
||||
@Expose @get: NonNull var validTo: String? = null,
|
||||
@Expose @get: NonNull var productIdIos: String? = null,
|
||||
@Expose @get: NonNull var productIdAndroid: String? = null,
|
||||
@Expose @get: NonNull var priceIos: Double? = null,
|
||||
@Expose @get: NonNull var priceAndroid: Double? = null
|
||||
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
@@ -8,9 +9,9 @@ import javax.persistence.Id
|
||||
|
||||
@Entity
|
||||
data class ProductTest (
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var productTestId: Int = 0,
|
||||
@get: NonNull var customerId: Long = 0,
|
||||
@get: NonNull var productId: Int = 0,
|
||||
@get: NonNull var dateView: String? = null,
|
||||
@get: NonNull var purchaseClick: Boolean = false
|
||||
@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
|
||||
)
|
||||
@@ -1,5 +1,7 @@
|
||||
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
|
||||
@@ -8,12 +10,12 @@ import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class Property (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var propertyId: Long = 0,
|
||||
@get: NotBlank var propertyName: String = "",
|
||||
@get: NotBlank var propertyUnit: String = ""
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var propertyId: Long = 0,
|
||||
@Expose @get: NotBlank var propertyName: String = "",
|
||||
@Expose @get: NotBlank var propertyUnit: String = ""
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "property")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<PropertyTranslation> = mutableListOf<PropertyTranslation>().toList()
|
||||
@Expose val translations: List<PropertyTranslation> = mutableListOf<PropertyTranslation>().toList()
|
||||
|
||||
}
|
||||
@@ -1,21 +1,24 @@
|
||||
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 PropertyTranslation (
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val translationId: Long = 0,
|
||||
|
||||
@get: NotBlank var languageCode: String?,
|
||||
@get: NotBlank var propertyName: String = ""
|
||||
@Expose @get: NotBlank var languageCode: String?,
|
||||
@Expose @get: NotBlank var propertyName: String = "",
|
||||
|
||||
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "propertyId", nullable = false)
|
||||
@JsonIgnore
|
||||
val property: Property? = null
|
||||
|
||||
/* override fun toString() : String {
|
||||
return "PropertyTranslation [id=$translationId, languageCode=$languageCode, propertyName=$propertyName]"
|
||||
}*/
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
@@ -9,10 +10,10 @@ import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class Purchase (
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var purchaseId: Long = 0,
|
||||
@get: NonNull var customerId: Long = 0,
|
||||
@get: NonNull var productId: Int = 0,
|
||||
@get: NonNull var purchaseSum: Double? = null,
|
||||
@get: NonNull var dateAdd: String? = null,
|
||||
@get: NotBlank var currency: String = ""
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var purchaseId: Long = 0,
|
||||
@Expose @get: NonNull var customerId: Long = 0,
|
||||
@Expose @get: NonNull var productId: Int = 0,
|
||||
@Expose @get: NonNull var purchaseSum: Double? = null,
|
||||
@Expose @get: NonNull var dateAdd: String? = null,
|
||||
@Expose @get: NotBlank var currency: String = ""
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
import javax.persistence.GenerationType
|
||||
import javax.persistence.Id
|
||||
|
||||
@Entity
|
||||
data class Tracking (
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var trackingId: Long = 0,
|
||||
@get: NonNull var customerId: Long = 0,
|
||||
@get: NonNull var dateAdd: String? = null,
|
||||
@get: NonNull var event: String = "",
|
||||
var eventValue: Double? = null,
|
||||
var area: String = "",
|
||||
var platform: String = "",
|
||||
var version: String = ""
|
||||
)
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.aitrainer.api.repository
|
||||
|
||||
import com.aitrainer.api.model.ExerciseAbility
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
interface ExerciseAbilityRepository: JpaRepository<ExerciseAbility, Long> {
|
||||
}
|
||||
@@ -10,6 +10,7 @@ interface ExerciseTreeRepository : JpaRepository<ExerciseTree, Long> {
|
||||
|
||||
@Query("FROM ExerciseTree as e " +
|
||||
"LEFT JOIN ExerciseTreeTranslation as t ON e.treeId = t.exerciseTree AND t.languageCode = 'hu' " +
|
||||
"LEFT JOIN ExerciseTreeAbility as t ON e.treeId = t.exerciseTree " +
|
||||
"WHERE e.active = 1 " +
|
||||
"ORDER BY e.treeId ")
|
||||
fun getActiveMenu(): List<ExerciseTree>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.aitrainer.api.repository
|
||||
|
||||
import com.aitrainer.api.model.Tracking
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
interface TrackingRepository: JpaRepository<Tracking, Long> {
|
||||
}
|
||||
Reference in New Issue
Block a user