Completed for api queries

This commit is contained in:
Sambo Chea 2020-08-21 11:32:16 +07:00
parent d3e8d63287
commit 652355f486

View File

@ -1,18 +1,28 @@
package com.cubetiqs.demo.axon.api
import com.cubetiqs.demo.axon.entity.BankAccount
import com.cubetiqs.demo.axon.service.AccountQueryService
import io.swagger.annotations.Api
import org.springframework.beans.factory.annotation.Autowired
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
import java.util.concurrent.CompletableFuture
class AccountQueryController {
@RestController
@RequestMapping(path = ["/accounts"])
@Api(value = "Bank Account Queries", description = "Bank Account Query Events API")
class AccountQueryController @Autowired constructor(
private val accountQueryService: AccountQueryService
) {
@GetMapping("/{accountId}")
fun findById(@PathVariable("accountId") accountId: String?): CompletableFuture<BankAccount?>? {
fun findById(@PathVariable("accountId") accountId: String?): CompletableFuture<BankAccount?> {
return this.accountQueryService.findById(accountId)
}
@GetMapping("/{accountId}/events")
fun listEventsForAccount(@PathVariable(value = "accountId") accountId: String?): List<Any?>? {
fun listEventsForAccount(@PathVariable(value = "accountId") accountId: String?): List<Any?> {
return this.accountQueryService.listEventsForAccount(accountId)
}
}