18 lines
657 B
Kotlin
18 lines
657 B
Kotlin
|
package com.cubetiqs.graphql.demo.query
|
||
|
|
||
|
import com.cubetiqs.graphql.demo.context.GQuery
|
||
|
import com.cubetiqs.graphql.demo.domain.account.Account
|
||
|
import com.cubetiqs.graphql.demo.repository.AccountRepository
|
||
|
import graphql.kickstart.tools.GraphQLQueryResolver
|
||
|
import org.springframework.beans.factory.annotation.Autowired
|
||
|
import org.springframework.data.domain.Pageable
|
||
|
|
||
|
@GQuery
|
||
|
class AccountQuery @Autowired constructor(
|
||
|
private val accountRepository: AccountRepository,
|
||
|
) : GraphQLQueryResolver {
|
||
|
fun fetchAccounts(): Collection<Account> {
|
||
|
val accounts = accountRepository.findAll(Pageable.unpaged())
|
||
|
return accounts.content
|
||
|
}
|
||
|
}
|