This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Activator-generated Properties | |
#Tue Jun 03 22:05:15 SGT 2014 | |
template.uuid=9560810c-a944-4333-9041-0d52047c1a48 | |
sbt.version=0.13.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<persistence xmlns="http://java.sun.com/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" | |
version="2.0"> | |
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL"> | |
<provider>org.hibernate.ejb.HibernatePersistence</provider> | |
<non-jta-data-source>DefaultDS</non-jta-data-source> | |
<properties> | |
<property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect" /> | |
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libraryDependencies ++= Seq( | |
javaCore, | |
javaJpa, | |
"org.springframework" % "spring-context" % "3.2.2.RELEASE", | |
"javax.inject" % "javax.inject" % "1", | |
"org.springframework.data" % "spring-data-jpa" % "1.3.2.RELEASE", | |
"org.springframework" % "spring-expression" % "3.2.2.RELEASE", | |
"org.hibernate" % "hibernate-entitymanager" % "3.6.10.Final", | |
"org.mockito" % "mockito-core" % "1.9.5" % "test", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object UserAPI extends Controller with Secured { | |
/** | |
* Get the profile | |
*/ | |
def getProfile = withApiAuthToken() { implicit request => | |
val currentUser = request.user | |
Future(Ok(Json.obj( | |
"success" -> true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package traits | |
import play.api._ | |
import play.api.mvc._ | |
import controllers.routes | |
import models._ | |
import play.api.libs.concurrent.Execution.Implicits._ | |
import helpers._ | |
import play.api.mvc.AnyContent | |
import play.api.mvc.BodyParsers._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Count records | |
*/ | |
def count(query: BSONDocument) = { | |
val db = collection.db | |
val futureCount = db.command(Count(collection.name, Some(query))) | |
futureCount.map { totalCount => | |
totalCount | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
futureUser.flatMap { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
futureUser.flatMap { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
futureUser.flatMap[SimpleResult] { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
futureUser.flatMap[SimpleResult] { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
NewerOlder