You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
641 B

  1. package com.example.services
  2. import monix.eval.Task
  3. import com.example.models.Book
  4. import com.example.models.Author
  5. import com.example.models.NewAuthor
  6. import com.example.models.NewBook
  7. trait TaskLibraryService {
  8. // Simple function that returns a book
  9. def findBookById(id: Long): Task[Option[Book]]
  10. // Simple function that returns a list of books with it's author
  11. def findBooksWithAuthor: Task[Seq[(Book, Author)]]
  12. // Insert a book and an author composing two DBIOs in a transaction
  13. def insertBookAndAuthor(book: NewBook, author: NewAuthor): Task[(Long, Long)]
  14. def getAuthorsForBook(id: Long): Task[Seq[(Author, Book)]]
  15. }