Skip to content

Instantly share code, notes, and snippets.

@nitindhar7
Last active August 29, 2015 14:14
Show Gist options
  • Save nitindhar7/2fb7c316c52243178025 to your computer and use it in GitHub Desktop.
Save nitindhar7/2fb7c316c52243178025 to your computer and use it in GitHub Desktop.
object FetchNotifications
extends ActionTransformer[AuthRequest, NotificationRequest] {
def transform[A](request: AuthRequest[A]) = Future {
request.user.map { user =>
NotificationRequest[A](Some(user), findNotificationsByUser(user), request)
} getOrElse {
NotificationRequest[A](None, None, request)
}
}
}
case class NotificationRequest[A](
val user: Option[User],
val notifications: Option[List[Notification]],
request: Request[A]
) extends WrappedRequest(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment