refactor(insights): rename ctas collection to insightCTAs

Disambiguate the platform-level collection name. Field/request-param
remains `ctas` (the embedded array on the insight response).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-05-06 18:12:17 +12:00
parent 5404bfec75
commit c5dfc42a60
5 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -2369,9 +2369,9 @@ $platformCollections = [
],
],
'ctas' => [
'insightCTAs' => [
'$collection' => ID::custom(Database::METADATA),
'$id' => ID::custom('ctas'),
'$id' => ID::custom('insightCTAs'),
'name' => 'Insight CTAs',
'attributes' => [
[
+1 -1
View File
@@ -483,7 +483,7 @@ Database::addFilter(
},
function (mixed $value, Document $document, Database $database) {
return $database->getAuthorization()->skip(fn () => $database
->find('ctas', [
->find('insightCTAs', [
Query::equal('insightInternalId', [$document->getSequence()]),
Query::limit(APP_LIMIT_SUBQUERY),
]));
@@ -78,13 +78,13 @@ class Delete extends Action
}
// Cascade delete child CTAs first.
$childCTAs = $dbForPlatform->find('ctas', [
$childCTAs = $dbForPlatform->find('insightCTAs', [
Query::equal('insightInternalId', [$insight->getSequence()]),
Query::limit(APP_LIMIT_COUNT),
]);
foreach ($childCTAs as $cta) {
$dbForPlatform->deleteDocument('ctas', $cta->getId());
$dbForPlatform->deleteDocument('insightCTAs', $cta->getId());
}
if (!$dbForPlatform->deleteDocument('insights', $insight->getId())) {
@@ -176,7 +176,7 @@ class Create extends Action
}
foreach ($normalizedCTAs as $cta) {
$dbForPlatform->createDocument('ctas', new Document([
$dbForPlatform->createDocument('insightCTAs', new Document([
'$id' => ID::unique(),
'projectInternalId' => $project->getSequence(),
'projectId' => $project->getId(),
@@ -85,12 +85,12 @@ class Delete extends Action
foreach ($childInsights as $insight) {
// Cascade through CTAs first.
$childCTAs = $dbForPlatform->find('ctas', [
$childCTAs = $dbForPlatform->find('insightCTAs', [
Query::equal('insightInternalId', [$insight->getSequence()]),
Query::limit(APP_LIMIT_COUNT),
]);
foreach ($childCTAs as $cta) {
$dbForPlatform->deleteDocument('ctas', $cta->getId());
$dbForPlatform->deleteDocument('insightCTAs', $cta->getId());
}
$dbForPlatform->deleteDocument('insights', $insight->getId());