mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
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:
+14
-4
@@ -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
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user