Skip to content

Commit e2245aa

Browse files
committed
ISSUE-345: refactor
1 parent cceadfc commit e2245aa

File tree

2 files changed

+73
-67
lines changed

2 files changed

+73
-67
lines changed

src/Statistics/Controller/AnalyticsController.php

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -225,23 +225,7 @@ public function getViewOpensStatistics(Request $request): JsonResponse
225225
new OA\Response(
226226
response: 200,
227227
description: 'Success',
228-
content: new OA\JsonContent(
229-
properties: [
230-
new OA\Property(
231-
property: 'domains',
232-
type: 'array',
233-
items: new OA\Items(
234-
properties: [
235-
new OA\Property(property: 'domain', type: 'string'),
236-
new OA\Property(property: 'subscribers', type: 'integer'),
237-
],
238-
type: 'object'
239-
)
240-
),
241-
new OA\Property(property: 'total', type: 'integer'),
242-
],
243-
type: 'object'
244-
)
228+
content: new OA\JsonContent(ref: '#/components/schemas/TopDomainStats')
245229
),
246230
new OA\Response(
247231
response: 403,
@@ -294,54 +278,7 @@ public function getTopDomains(Request $request): JsonResponse
294278
new OA\Response(
295279
response: 200,
296280
description: 'Success',
297-
content: new OA\JsonContent(
298-
properties: [
299-
new OA\Property(
300-
property: 'domains',
301-
type: 'array',
302-
items: new OA\Items(
303-
properties: [
304-
new OA\Property(property: 'domain', type: 'string'),
305-
new OA\Property(
306-
property: 'confirmed',
307-
properties: [
308-
new OA\Property(property: 'count', type: 'integer'),
309-
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
310-
],
311-
type: 'object'
312-
),
313-
new OA\Property(
314-
property: 'unconfirmed',
315-
properties: [
316-
new OA\Property(property: 'count', type: 'integer'),
317-
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
318-
],
319-
type: 'object'
320-
),
321-
new OA\Property(
322-
property: 'blacklisted',
323-
properties: [
324-
new OA\Property(property: 'count', type: 'integer'),
325-
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
326-
],
327-
type: 'object'
328-
),
329-
new OA\Property(
330-
property: 'total',
331-
properties: [
332-
new OA\Property(property: 'count', type: 'integer'),
333-
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
334-
],
335-
type: 'object'
336-
),
337-
],
338-
type: 'object'
339-
)
340-
),
341-
new OA\Property(property: 'total', type: 'integer'),
342-
],
343-
type: 'object'
344-
)
281+
content: new OA\JsonContent(ref: '#/components/schemas/DetailedDomainStats')
345282
),
346283
new OA\Response(
347284
response: 403,
@@ -396,11 +333,11 @@ public function getDomainConfirmationStatistics(Request $request): JsonResponse
396333
content: new OA\JsonContent(
397334
properties: [
398335
new OA\Property(
399-
property: 'localParts',
336+
property: 'local_parts',
400337
type: 'array',
401338
items: new OA\Items(
402339
properties: [
403-
new OA\Property(property: 'localPart', type: 'string'),
340+
new OA\Property(property: 'local_part', type: 'string'),
404341
new OA\Property(property: 'count', type: 'integer'),
405342
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
406343
],

src/Statistics/OpenApi/SwaggerSchemasResponse.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,75 @@
3434
type: 'object',
3535
nullable: true
3636
)]
37+
#[OA\Schema(
38+
schema: 'TopDomainStats',
39+
properties: [
40+
new OA\Property(
41+
property: 'domains',
42+
type: 'array',
43+
items: new OA\Items(
44+
properties: [
45+
new OA\Property(property: 'domain', type: 'string'),
46+
new OA\Property(property: 'subscribers', type: 'integer'),
47+
],
48+
type: 'object'
49+
)
50+
),
51+
new OA\Property(property: 'total', type: 'integer'),
52+
],
53+
type: 'object',
54+
nullable: true
55+
)]
56+
#[OA\Schema(
57+
schema: 'DetailedDomainStats',
58+
properties: [
59+
new OA\Property(
60+
property: 'domains',
61+
type: 'array',
62+
items: new OA\Items(
63+
properties: [
64+
new OA\Property(property: 'domain', type: 'string'),
65+
new OA\Property(
66+
property: 'confirmed',
67+
properties: [
68+
new OA\Property(property: 'count', type: 'integer'),
69+
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
70+
],
71+
type: 'object'
72+
),
73+
new OA\Property(
74+
property: 'unconfirmed',
75+
properties: [
76+
new OA\Property(property: 'count', type: 'integer'),
77+
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
78+
],
79+
type: 'object'
80+
),
81+
new OA\Property(
82+
property: 'blacklisted',
83+
properties: [
84+
new OA\Property(property: 'count', type: 'integer'),
85+
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
86+
],
87+
type: 'object'
88+
),
89+
new OA\Property(
90+
property: 'total',
91+
properties: [
92+
new OA\Property(property: 'count', type: 'integer'),
93+
new OA\Property(property: 'percentage', type: 'number', format: 'float'),
94+
],
95+
type: 'object'
96+
),
97+
],
98+
type: 'object'
99+
)
100+
),
101+
new OA\Property(property: 'total', type: 'integer'),
102+
],
103+
type: 'object',
104+
nullable: true
105+
)]
37106
class SwaggerSchemasResponse
38107
{
39108
}

0 commit comments

Comments
 (0)