Permalink
Browse files

Started working on the repository structure and injection

  • Loading branch information...
1 parent 0fa30e4 commit d58d681c07b9aec98a96a568b7d2a8f48b6954ab @manuelkiessling committed Jan 18, 2016
Showing with 11 additions and 1 deletion.
  1. +3 −1 app/controllers/Application.scala
  2. +3 −0 app/models/ProductModel.scala
  3. +5 −0 app/repositories/Repository.scala
@@ -1,9 +1,11 @@
package controllers package controllers
+import models.ProductModel
import play.api._ import play.api._
import play.api.mvc._ import play.api.mvc._
+import repositories.Repository
-class Application extends Controller { +class Application(productsRepository: Repository[ProductModel, Int]) extends Controller {
def index = Action { def index = Action {
Ok(views.html.index("Your new application is ready.")) Ok(views.html.index("Your new application is ready."))
@@ -0,0 +1,3 @@
+package models
+
+case class ProductModel(id: Int, name: String)
@@ -0,0 +1,5 @@
+package repositories
+
+abstract trait Repository[M, I] {
+ def getOneById(id: I): M
+}

0 comments on commit d58d681

Please sign in to comment.