I have case class
case class User (
id: Option[Long] = None,
username: String,
password: Option[String] = None,
)
And here is json serialiser for this case class
object User {
implicit val userWrites: Writes[User] = (
(JsPath \ "id").write[Option[Long]] and
(JsPath \ "username").write[String] and
(JsPath \ "password").write[Option[String]] and
)(unlift(User.unapply))
}
But I don't want to expose password field in api response. How can I achieve it?
I use also use this for Slick to read/write data in appropriate table, I'm using it in many places, service layer, controller layer, and I don't want to create separate class for api response (without password).