I am having following Case class
case class BIC( id: Option[Int], name: String, description: Option[String], bId: Option[Int], amount: BigDecimal, createdBy: Option[Int], createdAt: Option[DateTime] ) my REST-API url is like following
POST /api/v3/user/2/bid/23/create Now userId = 2 and bId = 23 are coming From URL path params I am also having List of BIC incoming from POST Request JSON which does not contain userId and bId
I am directly injecting incoming JSON to List[BIC], but all the objects in this list doesn't have createdBy (userId) and bId set.
if I want to set these 2 parameters in each BIC objects of List[BIC] what is the approach I should follow?
val lsttemp:List[BIC] = bicList val lst:List[BIC] lsttemp.foreach(x=>{ x.bId=inId x.createdBy = userId lst.add(x) }) I am trying above code but its not working.