Create java.util.Date TypeMapper. And add the currentDate method.

This commit is contained in:
shimamoto
2013-06-23 20:46:08 +09:00
parent 83ff171782
commit 4326f34ef5
12 changed files with 68 additions and 74 deletions

View File

@@ -1,6 +1,7 @@
package service
import model._
import Accounts._
import scala.slick.driver.H2Driver.simple._
import Database.threadLocalSession
@@ -11,7 +12,7 @@ trait AccountService {
def getAllUsers(): List[Account] = Query(Accounts) sortBy(_.userName) list
def createAccount(account: Account): Unit = Accounts.* insert account
def createAccount(account: Account): Unit = Accounts insert account
def updateAccount(account: Account): Unit =
Query(Accounts)
@@ -21,14 +22,13 @@ trait AccountService {
account.password,
account.mailAddress,
account.isAdmin,
account.url,
account.url,
account.registeredDate,
account.updatedDate,
currentDate,
account.lastLoginDate)
def updateLastLoginDate(userName: String): Unit =
// TODO make a common function to get the current timestamp.
Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate)
.update(new java.sql.Timestamp(System.currentTimeMillis))
.update(currentDate)
}