Customer: trainer, trainerId

This commit is contained in:
Bossanyi Tibor
2020-09-04 15:58:30 +02:00
parent a341f2cdbe
commit 2efb3cb18f
9 changed files with 45 additions and 19 deletions
@@ -44,6 +44,11 @@ class CustomerController ( private val customerRepository: CustomerRepository )
fun getRealCustomers(active: String, @RequestHeader headers: HttpHeaders): List<Customer> =
customerRepository.findByActive(active)
@Secured
@GetMapping("/customers/trainees/{id}")
fun getCustomerListByTrainerId(@PathVariable(value = "id") trainerId: Long, @RequestHeader headers: HttpHeaders): List<Customer> =
customerRepository.findByTrainerId(trainerId)
@Secured
@PostMapping("/customers/{id}")
fun updateCustomerById(@PathVariable(value = "id") customerId: Long,
@@ -17,6 +17,8 @@ data class Customer (
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 weight: Int = 0,
@@ -9,4 +9,6 @@ interface CustomerRepository : JpaRepository<Customer, Long> {
fun findByActive( active: String? ): List<Customer>
fun findByEmail(email: String?): Customer?
fun findByTrainerId( trainerId: Long ): List<Customer>
}