Skip to content

Commit e077ed4

Browse files
committed
Add more data to dashboard_statistics
1 parent 97d5bbd commit e077ed4

1 file changed

Lines changed: 102 additions & 40 deletions

File tree

src/Statistics/Controller/AnalyticsController.php

Lines changed: 102 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -381,57 +381,115 @@ public function getTopLocalParts(Request $request): JsonResponse
381381
content: new OA\JsonContent(
382382
properties: [
383383
new OA\Property(
384-
property: 'total_subscribers',
384+
property: 'summary_statistics',
385385
properties: [
386-
new OA\Property(property: 'value', type: 'integer', example: 48294),
387386
new OA\Property(
388-
property: 'change_vs_last_month',
389-
type: 'number',
390-
format: 'float',
391-
example: 12.5
387+
property: 'total_subscribers',
388+
properties: [
389+
new OA\Property(property: 'value', type: 'integer', example: 48294),
390+
new OA\Property(
391+
property: 'change_vs_last_month',
392+
type: 'number',
393+
format: 'float',
394+
example: 12.5
395+
),
396+
],
397+
type: 'object'
392398
),
393-
],
394-
type: 'object'
395-
),
396-
new OA\Property(
397-
property: 'active_campaigns',
398-
properties: [
399-
new OA\Property(property: 'value', type: 'integer', example: 12),
400399
new OA\Property(
401-
property: 'change_vs_last_month',
402-
type: 'number',
403-
format: 'float',
404-
example: 0
400+
property: 'active_campaigns',
401+
properties: [
402+
new OA\Property(property: 'value', type: 'integer', example: 12),
403+
new OA\Property(
404+
property: 'change_vs_last_month',
405+
type: 'number',
406+
format: 'float',
407+
example: 0
408+
),
409+
],
410+
type: 'object'
405411
),
406-
],
407-
type: 'object'
408-
),
409-
new OA\Property(
410-
property: 'open_rate',
411-
properties: [
412-
new OA\Property(property: 'value', type: 'number', format: 'float', example: 12),
413412
new OA\Property(
414-
property: 'change_vs_last_month',
415-
type: 'number',
416-
format: 'float',
417-
example: 0
413+
property: 'open_rate',
414+
properties: [
415+
new OA\Property(
416+
property: 'value',
417+
type: 'number',
418+
format: 'float',
419+
example: 12
420+
),
421+
new OA\Property(
422+
property: 'change_vs_last_month',
423+
type: 'number',
424+
format: 'float',
425+
example: 0
426+
),
427+
],
428+
type: 'object'
418429
),
419-
],
420-
type: 'object'
421-
),
422-
new OA\Property(
423-
property: 'bounce_rate',
424-
properties: [
425-
new OA\Property(property: 'value', type: 'number', format: 'float', example: 12),
426430
new OA\Property(
427-
property: 'change_vs_last_month',
428-
type: 'number',
429-
format: 'float',
430-
example: 0
431+
property: 'bounce_rate',
432+
properties: [
433+
new OA\Property(
434+
property: 'value',
435+
type: 'number',
436+
format: 'float',
437+
example: 12
438+
),
439+
new OA\Property(
440+
property: 'change_vs_last_month',
441+
type: 'number',
442+
format: 'float',
443+
example: 0
444+
),
445+
],
446+
type: 'object'
431447
),
432448
],
433449
type: 'object'
434450
),
451+
new OA\Property(
452+
property: 'recent_campaigns',
453+
type: 'array',
454+
items: new OA\Items(
455+
properties: [
456+
new OA\Property(property: 'name', type: 'string', example: 'March Newsletter'),
457+
new OA\Property(
458+
property: 'status',
459+
type: 'string',
460+
example: 'sent',
461+
nullable: true
462+
),
463+
new OA\Property(
464+
property: 'date',
465+
type: 'string',
466+
format: 'date',
467+
example: '2026-03-15',
468+
nullable: true
469+
),
470+
new OA\Property(property: 'open_rate', type: 'string', example: '42.50%'),
471+
new OA\Property(property: 'click_rate', type: 'string', example: '8.10%'),
472+
],
473+
type: 'object'
474+
)
475+
),
476+
new OA\Property(
477+
property: 'campaign_performance',
478+
type: 'array',
479+
items: new OA\Items(
480+
properties: [
481+
new OA\Property(
482+
property: 'date',
483+
type: 'string',
484+
format: 'date',
485+
example: '2026-03-19'
486+
),
487+
new OA\Property(property: 'opens', type: 'integer', example: 234),
488+
new OA\Property(property: 'clicks', type: 'integer', example: 57),
489+
],
490+
type: 'object'
491+
)
492+
),
435493
],
436494
type: 'object'
437495
)
@@ -450,7 +508,11 @@ public function getDashboardStatistics(Request $request): JsonResponse
450508
throw $this->createAccessDeniedException('You are not allowed to access statistics.');
451509
}
452510

453-
$response = $this->analyticsService->getSummaryStatistics();
511+
$response = [
512+
'summary_statistics' => $this->analyticsService->getSummaryStatistics(),
513+
'recent_campaigns' => $this->analyticsService->getRecentCampaigns(),
514+
'campaign_performance' => $this->analyticsService->getCampaignPerformance(),
515+
];
454516

455517
return $this->json($response, Response::HTTP_OK);
456518
}

0 commit comments

Comments
 (0)