diff options
author | Pacien TRAN-GIRARD | 2015-02-08 17:06:58 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-02-08 17:06:58 +0100 |
commit | f90cd0da3eda7c1723ce4de439f64334c81db712 (patch) | |
tree | 700f4b04acf04f3cd39df94b3add1086a47f18a2 /app/controllers/Account.scala | |
parent | a022850963552096dab032fb57c16d3b1d3ac51a (diff) | |
download | minibay-f90cd0da3eda7c1723ce4de439f64334c81db712.tar.gz |
Implement account summary page
Diffstat (limited to 'app/controllers/Account.scala')
-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 | } |