Customer: trainer, trainerId
This commit is contained in:
@@ -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>
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ logging.config=classpath:logback-spring.xml
|
||||
logging.file=logs
|
||||
|
||||
# if the database structure has been changed, increment this version number
|
||||
application.version=1.0.5
|
||||
application.version=1.0.6
|
||||
|
||||
jwt.secret=aitrainer
|
||||
@@ -16,6 +16,6 @@ logging.config=classpath:logback-spring.xml
|
||||
logging.file=logs
|
||||
|
||||
# if the database structure has been changed, increment this version number
|
||||
application.version=1.0.5application-prod.properties
|
||||
application.version=1.0.6
|
||||
|
||||
jwt.secret=aitrainer
|
||||
@@ -1,4 +1,4 @@
|
||||
spring.profiles.active=dev,test,prod
|
||||
spring.profiles.active=dev,test,prod,prodtest
|
||||
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
|
||||
#spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false
|
||||
spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true
|
||||
@@ -16,6 +16,6 @@ logging.config=classpath:logback-spring.xml
|
||||
logging.file=logs
|
||||
|
||||
# if the database structure has been changed, increment this version number
|
||||
application.version=1.0.5
|
||||
application.version=1.0.6
|
||||
|
||||
jwt.secret=aitrainer
|
||||
@@ -39,6 +39,14 @@ class CustomerTests {
|
||||
assertEquals( customer.name, "Átlag 18 éves fiú")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testTrainer() {
|
||||
val id: Long = 137
|
||||
val customers: List<Customer> = customerRepository.findByTrainerId( id );
|
||||
assertEquals(customers.count(), 3)
|
||||
assertEquals( customers[0].name, "Átlag 13 éves fiú")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testInsert() {
|
||||
val newCustomer = Customer("Bossanyi", "Tibor", "", 48, "m")
|
||||
|
||||
Reference in New Issue
Block a user