diff options
Diffstat (limited to 'src/main/scala/reading/models/Book.scala')
-rw-r--r-- | src/main/scala/reading/models/Book.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/scala/reading/models/Book.scala b/src/main/scala/reading/models/Book.scala new file mode 100644 index 0000000..1e4b81a --- /dev/null +++ b/src/main/scala/reading/models/Book.scala @@ -0,0 +1,21 @@ +package reading.models + +case class Book( + title: String, + author: String, + genres: Seq[Genre], + themes: Seq[Theme] +) + +object Book { + def all: Seq[Book] = Seq( + Book("Les dix petits nègres", "Agatha Christie", Seq(Genre.Detective), Seq(Theme.Fear)), + Book("Le joueur", "Fiódor Dostoyevski", Seq(Genre.Adventure), Seq(Theme.Fear)), + Book("Voyage au bout de la nuit", "Céline", Seq(Genre.Adventure), Seq(Theme.Fear)), + Book("Le petit prince", "Antoine de Saint Exupéry", Seq(Genre.Adventure), Seq(Theme.Friendship)), + Book("Les frères Karamazov", "Fiódor Dostoyevski", Seq(Genre.Adventure), Seq(Theme.Family)) + ) + + def filter(books: Seq[Book], filters: Seq[Filter]): Seq[Book] = + books.filter(b => filters.forall(_.filter(b))) +} |