in src/main/scala/ophan/google/index/checker/DataStore.scala [28:42]
def fetchExistingRecordsFor(capiIds: Set[String]): Future[Map[String,AvailabilityRecord]] = scanamoAsync.exec(
table.getAll("capiId" in capiIds)
).map(_.flatMap(_.toOption).map(record => record.capiId -> record).toMap)
def update(capiId: String, checkReport: CheckReport): Future[Option[AvailabilityRecord]] = {
import DataStore.instantAsISO8601StringFormat
checkReport.accessGoogleIndex.fold(_ => Future.successful(None), found => {
val fieldToUpdate = if (found) "found" else "missing"
scanamoAsync.exec(
table.update("capiId" === capiId, set(fieldToUpdate, checkReport.time))
).map(_.toOption)
}
)
}