package de.thpeetz.kontor.comics

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("api/")
class ComicsApiController(val artistRepository: ArtistRepository,
                          val publisherRepository: PublisherRepository,
                          val comicRepository: ComicRepository,
                          val issueRepository: IssueRepository) {

    @GetMapping("/artist")
    fun artistList()  = artistRepository.findAll()

    @GetMapping("/publisher")
    fun publisherList() = publisherRepository.findAll()

    @GetMapping("/comics")
    fun comicsList() = comicRepository.findAll()

    @GetMapping("/issues")
    fun issuesList() = issueRepository.findAll()
}
