title: play-slick scala many to many
body: <p>I have an endpoint lets say /order/ where i can send json object(my order), which contains some products etc, so my problem is i have to first save the order and wait for the order id back from the db and then save my products with this new order id( we are talking many to many relation thats why theres another table)</p>
  
  <p>Consider this controller method </p>
  
  <pre><code>def postOrder = Action(parse.json[OrderRest]) { req =&gt; {
  
      Created(Json.toJson(manageOrderService.insertOrder(req.body)))
    }
  }
  </code></pre>
  
  <p>this is how my repo methods look like</p>
  
  <pre><code>  def addOrder(order: Order) = db.run {
      (orders returning orders) += order
    }
  </code></pre>
  
  <p>how can i chain  db.runs to first insert order, get order id and then insert my products with this order id i just got?</p>
  
  <p>im thinking about putting some service between my controller and repo, and managing those actions there, but i have no idea where to start</p>