Skip to content

Instantly share code, notes, and snippets.

View julienlafont-tabmo's full-sized avatar

Julien Lafont julienlafont-tabmo

View GitHub Profile
trait Shortcut { self: Controller =>
def withEvent[T](eventId: String)(block: Event => Future[T]): Future[T] = {
EventRepository.getByUuid(eventId).flatMap {
case Some(event) => block(event)
case None => Future.successful(NotFound("event not found"))
}
}
def withSession[T](sessionId: String)(block: Session => Future[T]): Future[T] = {