September 2018
Intermediate to advanced
398 pages
9h 43m
English
Something is missing from the implementation; indeed, we do not have a cartDao instance in our WebService class.
To add it, just add it as a new parameter; as all of the parameters are injected, Play will automatically do it for you. The WebService class definition becomes the following code:
class WebServices @Inject()(cc: ControllerComponents, productDao: ProductsDao, cartsDao: CartsDao) extends AbstractController(cc) with Circe {
The implementation to get all of the products is as follows:
def listCartProducts() = Action.async { request =>
val userOption = request.session.get("user")
userOption match {
case Some(user) => {
Logger.info(s"User '$user' is asking for the list of product in the cart") val futureInsert ...Read now
Unlock full access