V1.0.24+2 CustomerProperty actual into the app-package
This commit is contained in:
parent
c7d5831df9
commit
41b10c4268
@ -47,9 +47,12 @@ class CustomerPackageController( private val customerRepository: CustomerReposit
|
||||
val listPurchase = purchaseRepository.findByCustomerId(customerId)
|
||||
val listPurchaseJson = gson.toJson(listPurchase)
|
||||
|
||||
val listCustomerProperty = customerPropertyRepository.findAllByCustomerId(customerId)
|
||||
val listCustomerPropertyAll = customerPropertyRepository.findAllByCustomerId(customerId)
|
||||
val listCustomerPropertyAllJson = gson.toJson(listCustomerPropertyAll)
|
||||
val listCustomerProperty = customerPropertyRepository.findLastPropertiesByCustomerId(customerId)
|
||||
val listCustomerPropertyJson = gson.toJson(listCustomerProperty)
|
||||
|
||||
|
||||
val listExerciseResult = exerciseResultRepository.getAllByCustomerId(customerId)
|
||||
val listExerciseResultJson = gson.toJson(listExerciseResult)
|
||||
|
||||
@ -59,6 +62,7 @@ class CustomerPackageController( private val customerRepository: CustomerReposit
|
||||
"|||" + getClassRecord(Exercises::class.simpleName, listExercisesJson) +
|
||||
"|||" + getClassRecord(ProductTest::class.simpleName, listProductTestJson) +
|
||||
"|||" + getClassRecord(Purchase::class.simpleName, listPurchaseJson) +
|
||||
"|||" + getClassRecord(CustomerProperty::class.simpleName+"All", listCustomerPropertyAllJson) +
|
||||
"|||" + getClassRecord(CustomerProperty::class.simpleName, listCustomerPropertyJson) +
|
||||
"|||" + getClassRecord(ExerciseResult::class.simpleName, listExerciseResultJson)
|
||||
|
||||
|
@ -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,15 +9,13 @@ import javax.persistence.Id
|
||||
|
||||
@Entity
|
||||
data class ExerciseResult(
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val exerciseResultId: Long = 0,
|
||||
|
||||
@get: NonNull var customerId: Long = 0,
|
||||
@get: NonNull var exerciseId: Long = 0,
|
||||
@get: NonNull var exercisePlanId: Long? = null,
|
||||
@get: NonNull var resultType: String? = null,
|
||||
@get: NonNull var value: Double? = null,
|
||||
@get: NonNull var dateFrom: String? = null,
|
||||
@get: NonNull var dateTo: String? = null
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val exerciseResultId: Long = 0,
|
||||
@Expose @get: NonNull var customerId: Long = 0,
|
||||
@Expose @get: NonNull var exerciseId: Long = 0,
|
||||
@Expose @get: NonNull var exercisePlanId: Long? = null,
|
||||
@Expose @get: NonNull var resultType: String? = null,
|
||||
@Expose @get: NonNull var value: Double? = null,
|
||||
@Expose @get: NonNull var dateFrom: String? = null,
|
||||
@Expose @get: NonNull var dateTo: String? = null
|
||||
|
||||
)
|
@ -87,6 +87,14 @@ class AppCustomerPackageTest {
|
||||
assertTrue(productTestList.isNotEmpty())
|
||||
assertEquals(productTestList[0].productId,1)
|
||||
} else if (record[0] == CustomerProperty::class.simpleName) {
|
||||
//actual values
|
||||
val propertyJson: String = record[1]
|
||||
val type = object : TypeToken<List<CustomerProperty?>?>() {}.type
|
||||
val propertyList: List<CustomerProperty> = gson.fromJson(propertyJson, type)
|
||||
assertTrue(propertyList.isNotEmpty())
|
||||
assertEquals(propertyList[1].propertyId,4)
|
||||
assertEquals(propertyList[1].propertyValue,37.0)
|
||||
} else if (record[0] == CustomerProperty::class.simpleName+"All") {
|
||||
val propertyJson: String = record[1]
|
||||
val type = object : TypeToken<List<CustomerProperty?>?>() {}.type
|
||||
val propertyList: List<CustomerProperty> = gson.fromJson(propertyJson, type)
|
||||
|
Loading…
Reference in New Issue
Block a user