Loading app/dao/RestHistoryDAO.scala +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ class RestHistoryDAOImpl @Inject()(dbConfigProvider: DatabaseConfigProvider) ext val requests = TableQuery[RestRequests] def all(username: String): Future[Seq[RestRequest]] = { dbConfig.db.run(requests.filter(_.username === username).result).map { reqs => dbConfig.db.run(requests.filter(_.username === username).sortBy(_.createdAt.desc).take(50).result).map { reqs => reqs.map { r => RestRequest(r.path, r.method, r.body, r.username, new Date(r.createdAt)) } } } Loading test/dao/RestRequestDAOSpec.scala +2 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ class RestRequestDAOSpec(implicit ee: ExecutionEnv) extends Specification { val dao: RestHistoryDAO = app.injector.instanceOf(classOf[RestHistoryDAO]) val entries: Future[Seq[RestRequest]] = dao.all("admin") val expected: Seq[RestRequest] = Seq( RestRequest("somePath", "someMethod", "theBody", "admin", new Date(123)), RestRequest("otherPath", "otherMethod", "otherBody", "admin", new Date(currentTime + 100)) RestRequest("otherPath", "otherMethod", "otherBody", "admin", new Date(currentTime + 100)), RestRequest("somePath", "someMethod", "theBody", "admin", new Date(123)) ) entries must beEqualTo(expected).await } Loading Loading
app/dao/RestHistoryDAO.scala +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ class RestHistoryDAOImpl @Inject()(dbConfigProvider: DatabaseConfigProvider) ext val requests = TableQuery[RestRequests] def all(username: String): Future[Seq[RestRequest]] = { dbConfig.db.run(requests.filter(_.username === username).result).map { reqs => dbConfig.db.run(requests.filter(_.username === username).sortBy(_.createdAt.desc).take(50).result).map { reqs => reqs.map { r => RestRequest(r.path, r.method, r.body, r.username, new Date(r.createdAt)) } } } Loading
test/dao/RestRequestDAOSpec.scala +2 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ class RestRequestDAOSpec(implicit ee: ExecutionEnv) extends Specification { val dao: RestHistoryDAO = app.injector.instanceOf(classOf[RestHistoryDAO]) val entries: Future[Seq[RestRequest]] = dao.all("admin") val expected: Seq[RestRequest] = Seq( RestRequest("somePath", "someMethod", "theBody", "admin", new Date(123)), RestRequest("otherPath", "otherMethod", "otherBody", "admin", new Date(currentTime + 100)) RestRequest("otherPath", "otherMethod", "otherBody", "admin", new Date(currentTime + 100)), RestRequest("somePath", "someMethod", "theBody", "admin", new Date(123)) ) entries must beEqualTo(expected).await } Loading