Skip to content
This repository was archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Update dependencies (#1)
Browse files Browse the repository at this point in the history
- Scala 2.11 -> 2.12
- sbt 0.13 -> 1.2
- Play 2.4 -> 2.6
  • Loading branch information
yoskhdia authored Jan 19, 2019
1 parent 64df5aa commit ef7e98f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 80 deletions.
22 changes: 11 additions & 11 deletions app/adapter/GroupController.scala
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package adapter

import javax.inject.Inject

import contract.usecase.PickLeaderUseCase
import domain.GroupId
import javax.inject.{Inject, Singleton}
import play.api.data.Forms._
import play.api.data._
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.mvc.{Action, Controller}
import play.api.mvc.{AbstractController, ControllerComponents}

import scala.concurrent.ExecutionContext

import scala.concurrent.Future
@Singleton
class GroupController @Inject()(useCase: PickLeaderUseCase, presenter: PickedLeaderPresenter, controllerComponents: ControllerComponents) extends AbstractController(controllerComponents) {

class GroupController @Inject()(useCase: PickLeaderUseCase, presenter: PickedLeaderPresenter) extends Controller {
private implicit lazy val ec: ExecutionContext = defaultExecutionContext

val form = Form(
private val form = Form(
mapping(
"groupId" -> number
)(GroupId.apply)(GroupId.unapply)
)

def pickLeader = Action.async { implicit request =>
form.bindFromRequest.fold(_ => Future.successful(BadRequest("not found query parameter: `groupId`")), (groupId: GroupId) =>
presenter.response(useCase.execute(groupId))
)
def pickLeader = Action.async(parse.form(form)) { implicit request =>
val groupId = request.body
presenter.response(useCase.execute(groupId))
}

}
21 changes: 4 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name := "cleanArchSample"
version := "1.0"

lazy val scalacSettings = Seq(
scalaVersion := "2.11.7",
scalaVersion := "2.12.8",
scalacOptions := Seq(
"-feature",
"-language:implicitConversions",
Expand All @@ -15,24 +15,11 @@ lazy val scalacSettings = Seq(
)
)

lazy val playResolvers = Seq(
"scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"
)

lazy val playDependencies = Seq(
jdbc,
cache,
ws,
specs2 % Test
)

lazy val playSettings = Seq(
routesGenerator := InjectedRoutesGenerator,
unmanagedResourceDirectories in Test <+= baseDirectory ( _ /"target/web/public/test" )
guice,
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
)

lazy val `cleanarchsample` = (project in file("."))
.settings(scalacSettings ++ playSettings: _*)
.settings(resolvers ++= playResolvers)
.settings(libraryDependencies ++= playDependencies)
.enablePlugins(PlayScala)
.settings(libraryDependencies ++= playDependencies)
50 changes: 2 additions & 48 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,11 @@
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="%APPLICATION_SECRET%"
play.http.secret.key="%APPLICATION_SECRET%"

# The application languages
# ~~~~~
application.langs="en"

# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# application.global=Global

# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `my.application.Router`,
# you may need to define a router file `conf/my.application.routes`.
# Default to Routes in the root package (and conf/routes)
# application.router=my.application.Routes

# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=""

# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled

# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/),
# by providing an application-logger.xml file in the conf directory.

# Root logger:
logger.root=ERROR

# Logger used by the framework:
logger.play=INFO

# Logger provided to your application:
logger.application=DEBUG
play.i18n.langs=["en"]

play.modules.enabled += "adapter.AdapterModule"
play.modules.enabled += "usecase.UseCaseModule"
22 changes: 22 additions & 0 deletions conf/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<configuration>

<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" />

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%coloredLevel %logger{15} - %message%n%xException{10}</pattern>
</encoder>
</appender>

<appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT" />
</appender>

<logger name="play" level="INFO" />
<logger name="application" level="DEBUG" />

<root level="WARN">
<appender-ref ref="ASYNCSTDOUT" />
</root>

</configuration>
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.9
sbt.version=1.2.8
4 changes: 1 addition & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
logLevel := Level.Warn

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.6")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.21")

0 comments on commit ef7e98f

Please sign in to comment.