mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
ef4c5eb65e
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
21 lines
800 B
Scala
21 lines
800 B
Scala
package com.twitter.follow_recommendations.common.transforms.recommendation_flow_identifier
|
|
|
|
import com.google.inject.Inject
|
|
import com.twitter.follow_recommendations.common.base.Transform
|
|
import com.twitter.follow_recommendations.common.models.CandidateUser
|
|
import com.twitter.follow_recommendations.common.models.HasRecommendationFlowIdentifier
|
|
import com.twitter.stitch.Stitch
|
|
|
|
class AddRecommendationFlowIdentifierTransform @Inject()
|
|
extends Transform[HasRecommendationFlowIdentifier, CandidateUser] {
|
|
|
|
override def transform(
|
|
target: HasRecommendationFlowIdentifier,
|
|
items: Seq[CandidateUser]
|
|
): Stitch[Seq[CandidateUser]] = {
|
|
Stitch.value(items.map { candidateUser =>
|
|
candidateUser.copy(recommendationFlowIdentifier = target.recommendationFlowIdentifier)
|
|
})
|
|
}
|
|
}
|