Commit 3ae24ff5 authored by Guy Thouret's avatar Guy Thouret

Deduplicate Boost data export in CassandraRepository - #1201

1 merge request!417WIP: Boost Campaigns
Pipeline #102362013 failed with stages
in 45 seconds
......@@ -54,7 +54,7 @@ use Minds\Traits\MagicAttributes;
* @method string getChecksum()
* @method Boost setChecksum(string $checksum)
* @method string getBoostType()
* @method Boost setBoostType()
* @method Boost setBoostType(string $boostType)
*/
class Boost
{
......@@ -201,6 +201,8 @@ class Boost
'checksum' => $this->checksum,
'state' => $this->getState(),
'transaction_id' => $this->transactionId,
'type' => $this->type,
'rejection_reason' => $this->rejectedReason,
'boost_type' => $this->boostType,
];
}
......
......@@ -187,32 +187,12 @@ class CassandraRepository
(?, ?, ?, ?, ?)
";
$data = [
'guid' => $boost->getGuid(),
'schema' => '04-2019',
'entity_guid' => $boost->getEntityGuid(),
'entity' => $boost->getEntity() ? $boost->getEntity()->export() : null, //TODO: remove once on production
'bid' => $boost->getBid(),
'impressions' => $boost->getImpressions(),
'bidType' => in_array($boost->getBidType(), [ 'onchain', 'offchain' ], true) ? 'tokens' : $boost->getBidType(), //TODO: remove once on production
'owner_guid' => $boost->getOwnerGuid(),
'owner' => $boost->getOwner() ? $boost->getOwner()->export() : null, //TODO: remove once on production
'@created' => $boost->getCreatedTimestamp(),
'@reviewed' => $boost->getReviewedTimestamp(),
'@rejected' => $boost->getRejectedTimestamp(),
'@revoked' => $boost->getRevokedTimestamp(),
'@completed' => $boost->getCompletedTimestamp(),
'transactionId' => $boost->getTransactionId(),
'type' => $boost->getType(),
'handler' => $boost->getType(), //TODO: remove once on production
'state' => $boost->getState(), //TODO: remove once on production
'priority' => $boost->getPriority(),
'rating' => $boost->getRating(),
'tags' => $boost->getTags(),
'nsfw' => $boost->getNsfw(),
'rejection_reason'=> $boost->getRejectedReason(),
'checksum' => $boost->getChecksum(),
];
$data = $boost->export();
/* Additional parameters that differ from boost export */
$data['schema'] = '04-2019';
$data['bidType'] = in_array($boost->getBidType(), ['onchain', 'offchain'], true) ? 'tokens' : $boost->getBidType();
$data['handler'] = $boost->getType();
$values = [
(string) $boost->getType(),
......
Please register or to comment