refactor(insights): nest CTA execution and dismissal as sub-resources

Move POST /v1/insights/:id/dismiss to /v1/insights/:id/dismissals
and POST /v1/insights/:id/ctas/:ctaId/trigger to
/v1/insights/:id/ctas/:ctaId/executions, with the corresponding
class moves into Http/Insights/Dismissal/Create.php and
Http/CTA/Execution/Create.php. Rename the response model to
InsightCtaExecution and update events.php to surface dismissal
and execution as resource events with create verbs. The reshape
matches the rest of the API where verbs hang off plural sub-resources.
This commit is contained in:
Jake Barnby
2026-05-01 14:04:31 +12:00
parent d15be21923
commit da5a137b98
7 changed files with 45 additions and 36 deletions
+14 -4
View File
@@ -440,15 +440,25 @@ return [
'delete' => [
'$description' => 'This event triggers when an insight is deleted.',
],
'dismiss' => [
'$description' => 'This event triggers when an insight is dismissed.',
'dismissals' => [
'$model' => Response::MODEL_INSIGHT,
'$resource' => true,
'$description' => 'This event triggers on any insight dismissal event.',
'create' => [
'$description' => 'This event triggers when an insight is dismissed.',
],
],
'ctas' => [
'$model' => Response::MODEL_INSIGHT_CTA,
'$resource' => true,
'$description' => 'This event triggers on any insight CTA event.',
'trigger' => [
'$description' => 'This event triggers when an insight CTA is executed.',
'executions' => [
'$model' => Response::MODEL_INSIGHT_CTA_EXECUTION,
'$resource' => true,
'$description' => 'This event triggers on any insight CTA execution event.',
'create' => [
'$description' => 'This event triggers when an insight CTA is executed.',
],
],
],
],
+2 -2
View File
@@ -92,7 +92,7 @@ use Appwrite\Utopia\Response\Model\Identity;
use Appwrite\Utopia\Response\Model\Index;
use Appwrite\Utopia\Response\Model\Insight;
use Appwrite\Utopia\Response\Model\InsightCta;
use Appwrite\Utopia\Response\Model\InsightCtaResult;
use Appwrite\Utopia\Response\Model\InsightCtaExecution;
use Appwrite\Utopia\Response\Model\Installation;
use Appwrite\Utopia\Response\Model\JWT;
use Appwrite\Utopia\Response\Model\Key;
@@ -511,7 +511,7 @@ Response::setModel(new MigrationReport());
Response::setModel(new MigrationFirebaseProject());
Response::setModel(new Insight());
Response::setModel(new InsightCta());
Response::setModel(new InsightCtaResult());
Response::setModel(new InsightCtaExecution());
// Tests (keep last)
Response::setModel(new Mock());