This repository was archived by the owner on Sep 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Scala 2.11 -> 2.12 - sbt 0.13 -> 1.2 - Play 2.4 -> 2.6
- Loading branch information
Showing
6 changed files
with
41 additions
and
80 deletions.
There are no files selected for viewing
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
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)) | ||
} | ||
|
||
} |
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
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
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
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> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=0.13.9 | ||
sbt.version=1.2.8 |
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
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") |