Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. trait StorageService extends unfiltered.filter.Plan {
  2.   implicit val formats = DefaultFormats
  3.   val identityFunction = SimpleFunction.nullary[Int]("identity")
  4.  
  5.   override def intent = {
  6.     ...
  7.     case req @ PUT(Path(Seg("rest" :: "products" :: Nil))) =>
  8.       ResponseString(
  9.         write(ProductDb.database withSession {
  10.           session: Session =>
  11.             implicit val s = session
  12.             Products insertValue(read[Product](Body.string(req)))
  13.             Query(Products).where(_.id === Query(identityFunction).first).list.head
  14.         })
  15.       )
  16.     ...
  17.   }
  18. }