-
Notifications
You must be signed in to change notification settings - Fork 13
/
BaseAppController.scala
38 lines (28 loc) · 1.17 KB
/
BaseAppController.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package controllers
import com.madgag.playgithub.auth.GHRequest
import com.madgag.scalagithub.model.RepoId
import lib.actions.Actions
import play.api.Logging
import play.api.http.FileMimeTypes
import play.api.i18n.{Langs, MessagesApi}
import play.api.mvc._
import scala.concurrent.ExecutionContext
case class ControllerAppComponents(
actions: Actions,
actionBuilder: DefaultActionBuilder,
parsers: PlayBodyParsers,
messagesApi: MessagesApi,
langs: Langs,
fileMimeTypes: FileMimeTypes,
executionContext: scala.concurrent.ExecutionContext
) extends ControllerComponents
trait BaseAppController extends BaseController with Logging {
val controllerAppComponents: ControllerAppComponents
override val controllerComponents = controllerAppComponents
implicit val ec: ExecutionContext = controllerAppComponents.executionContext // Controversial? https://www.playframework.com/documentation/2.6.x/ThreadPools
def repoAuthenticated(repoId: RepoId): ActionBuilder[GHRequest, AnyContent] =
controllerAppComponents.actions.repoAuthenticated(repoId)
}
abstract class AbstractAppController(
val controllerAppComponents: ControllerAppComponents
) extends BaseAppController