Created
October 6, 2020 22:28
-
-
Save hanishi/bb8e8848d04b6c4772ac94cf4bc1cec8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def updateCriteria( | |
id: String, | |
adAccount: AdAccount, | |
criteria: Option[Criteria], | |
activate: Boolean | |
): Future[ | |
( | |
AdAccount, | |
Criteria, | |
Seq[(Campaign, Criteria, Seq[(AdSet, Criteria)])] | |
) | |
] = | |
for { | |
(id, active) <- | |
userManager | |
.askWithStatus(ref => | |
UserManager.UpdateCriteria(id, adAccount, criteria, activate, ref) | |
) | |
.map { | |
case (AdAccount(id, _), _, active, _) => (id, active) | |
} | |
result <- | |
if (active) | |
systemUser.askWithStatus(ref => | |
SystemUser | |
.Enable(AdAccount(id), ref) | |
) | |
else | |
systemUser.askWithStatus(ref => | |
SystemUser.Disable(AdAccount(id), ref) | |
) | |
} yield result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment