Add numbers writeables and content types
This commit is contained in:
parent
789588db00
commit
a81fd1e45a
|
@ -37,11 +37,11 @@ object AppApiC extends LilaController {
|
|||
}
|
||||
|
||||
def activity(gameId: String, color: String) = Action {
|
||||
Ok(api.activity(gameId, color).toString)
|
||||
Ok(api.activity(gameId, color))
|
||||
}
|
||||
|
||||
def playerVersion(gameId: String, color: String) = Action {
|
||||
Ok(api.playerVersion(gameId, color).unsafePerformIO.toString)
|
||||
Ok(api.playerVersion(gameId, color).unsafePerformIO)
|
||||
}
|
||||
|
||||
def rematchAccept(gameId: String, color: String, newGameId: String) = Action { implicit request ⇒
|
||||
|
|
|
@ -52,6 +52,21 @@ trait LilaController extends Controller with ContentTypes with RequestGetter {
|
|||
implicit def ctoUnit: ContentTypeOf[Unit] =
|
||||
ContentTypeOf[Unit](Some(ContentTypes.TEXT))
|
||||
|
||||
implicit def wFloat: Writeable[Float] =
|
||||
Writeable[Float](f ⇒ Codec toUTF8 f.toString)
|
||||
implicit def ctoFloat: ContentTypeOf[Float] =
|
||||
ContentTypeOf[Float](Some(ContentTypes.TEXT))
|
||||
|
||||
implicit def wLong: Writeable[Long] =
|
||||
Writeable[Long](a ⇒ Codec toUTF8 a.toString)
|
||||
implicit def ctoLong: ContentTypeOf[Long] =
|
||||
ContentTypeOf[Long](Some(ContentTypes.TEXT))
|
||||
|
||||
implicit def wInt: Writeable[Int] =
|
||||
Writeable[Int](i ⇒ Codec toUTF8 i.toString)
|
||||
implicit def ctoInt: ContentTypeOf[Int] =
|
||||
ContentTypeOf[Int](Some(ContentTypes.TEXT))
|
||||
|
||||
implicit def richForm[A](form: Form[A]) = new {
|
||||
def toValid: Valid[A] = form.fold(
|
||||
form ⇒ failure(nel("Invalid form", form.errors.map(_.toString): _*)),
|
||||
|
|
Loading…
Reference in a new issue