my case domain classes below
case class account(randomid: string, accounts: list[string]) // each of accounts need accountprofiles. case class accountprofiles(actid: string, profiles: list[string], additionalinfo: map[string, string], ......) case class accountinfo(id: string, profiles:list[string]) // each of accountprofiles need construct accountinfo my access layer implementation signature extract above domain classes below
getlinked(): future[account] getaccountprofile(actid: string): future[accountprofiles] can have for comprehension construct future list of accountinfo domain object of getlinked , getaccountprofile methods ?
yes can. think you're looking assuming accountprofiles.actid , accountinfo.id supposed equivalent.
for { account <- getlinked() profiles <- future.sequence(account.accounts map { id => getaccountprofile(id) }) } yield profiles map { p => accountinfo(p.actid, p.profiles) }