From f90cd0da3eda7c1723ce4de439f64334c81db712 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 8 Feb 2015 17:06:58 +0100 Subject: Implement account summary page --- app/controllers/Account.scala | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/Account.scala b/app/controllers/Account.scala index ff1d44d..7557ef1 100644 --- a/app/controllers/Account.scala +++ b/app/controllers/Account.scala @@ -14,6 +14,21 @@ import scala.concurrent.Future import models._ -object Account { +object Account extends Controller { + + def summary = Auth { implicit request => + if (request.account.isEmpty) { + Redirect(routes.Authentication.login()) + .flashing("error" -> "Authentication required") + } else { + + DB.withSession { implicit session => + val userUuid = request.account.get.userUuid + val transactions = Tables.Transactions.filter(_.userUuid === userUuid).sortBy(_.transactionDate.desc).run + + Ok(views.html.pages.accountSummary(transactions)) + } + } + } } -- cgit v1.2.3