mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
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:
@@ -2369,9 +2369,9 @@ $platformCollections = [
|
||||
],
|
||||
],
|
||||
|
||||
'ctas' => [
|
||||
'insightCTAs' => [
|
||||
'$collection' => ID::custom(Database::METADATA),
|
||||
'$id' => ID::custom('ctas'),
|
||||
'$id' => ID::custom('insightCTAs'),
|
||||
'name' => 'Insight CTAs',
|
||||
'attributes' => [
|
||||
[
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user