24 lines
1.3 KiB
Diff
24 lines
1.3 KiB
Diff
--- antes/app/Services/LegacyContent.php
|
|
+++ candidata/app/Services/LegacyContent.php
|
|
@@ -169,6 +169,10 @@
|
|
$payload = $desk->decode($case->payload);
|
|
foreach ($payload['investor_path']['content_sources'] ?? [] as $existing) {
|
|
if ($existing['resource_id'] === $article['id'] && $existing['sha256'] === $article['sha256']) {
|
|
+ if ($article['sector']) {
|
|
+ app(SectorInvestment::class)->attach($actor, $caseId, ['version' => $data['version'], 'sector_slug' => $article['sector']['slug']]);
|
|
+ }
|
|
+
|
|
return; // Same source/version replay: neither another reference nor another event.
|
|
}
|
|
}
|
|
@@ -179,6 +183,9 @@
|
|
'saved_at' => now()->toIso8601String()];
|
|
DB::table('desk_cases')->where('id', $caseId)->update(['payload' => $desk->encode($payload), 'version' => $case->version + 1, 'updated_at' => now()]);
|
|
$desk->event($desk->case($actor, $caseId), $actor, 'legacy_content_referenced', ['resource_id' => $article['id'], 'sha256' => $article['sha256']]);
|
|
+ if ($article['sector']) {
|
|
+ app(SectorInvestment::class)->attach($actor, $caseId, ['version' => $case->version + 1, 'sector_slug' => $article['sector']['slug']]);
|
|
+ }
|
|
});
|
|
}
|
|
|