aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/Account.scala
blob: b705653547f70e290f317a21f0092291aed48467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package controllers

import play.api._
import play.api.data._
import play.api.data.Forms._
import play.api.mvc._

import play.api.db.slick._
import play.api.db.slick.Config.driver.simple._
import play.api.Play.current

import scala.concurrent.Future

import models._


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.account.accountSummary(transactions))
      }
    }
  }

  def deposit = TODO

  def withdraw = TODO

  def transfer = TODO

}