diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/Account.scala | 17 |
1 files changed, 16 insertions, 1 deletions
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 | |||
14 | import models._ | 14 | import models._ |
15 | 15 | ||
16 | 16 | ||
17 | object Account { | 17 | object Account extends Controller { |
18 | |||
19 | def summary = Auth { implicit request => | ||
20 | if (request.account.isEmpty) { | ||
21 | Redirect(routes.Authentication.login()) | ||
22 | .flashing("error" -> "Authentication required") | ||
23 | } else { | ||
24 | |||
25 | DB.withSession { implicit session => | ||
26 | val userUuid = request.account.get.userUuid | ||
27 | val transactions = Tables.Transactions.filter(_.userUuid === userUuid).sortBy(_.transactionDate.desc).run | ||
28 | |||
29 | Ok(views.html.pages.accountSummary(transactions)) | ||
30 | } | ||
31 | } | ||
32 | } | ||
18 | 33 | ||
19 | } | 34 | } |