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.
25 lines
624 B
25 lines
624 B
package com.example.models
|
|
|
|
import play.api.libs.json.Json
|
|
import java.time.Instant
|
|
|
|
final case class Book(
|
|
id: Long,
|
|
title: String,
|
|
authorId: Long,
|
|
createdAt: Instant
|
|
)
|
|
final case class NewBook(title: String, authorId: Long)
|
|
final case class BookDTO(title: String, authorId: Long, createdAt: Instant)
|
|
final case class Author(id: Long, name: String)
|
|
final case class NewAuthor(name: String)
|
|
|
|
object Book {
|
|
def tupled = (Book.apply _).tupled
|
|
implicit val bookJsonFormat = Json.format[Book]
|
|
}
|
|
|
|
object Author {
|
|
def tupled = (Author.apply _).tupled
|
|
implicit val authorsJsonFormat = Json.format[Author]
|
|
}
|