|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the Superdesk Web Publisher Core Bundle. |
|
7
|
|
|
* |
|
8
|
|
|
* Copyright 2020 Sourcefabric z.ú. and contributors. |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please see the |
|
11
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
|
12
|
|
|
* |
|
13
|
|
|
* @copyright 2020 Sourcefabric z.ú |
|
14
|
|
|
* @license http://www.superdesk.org/license |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
namespace SWP\Bundle\CoreBundle\Controller; |
|
18
|
|
|
|
|
19
|
|
|
use Nelmio\ApiDocBundle\Annotation\Operation; |
|
20
|
|
|
use Nelmio\ApiDocBundle\Annotation\Model; |
|
21
|
|
|
use Swagger\Annotations as SWG; |
|
22
|
|
|
use SWP\Bundle\CoreBundle\Provider\FailedEntriesProvider; |
|
23
|
|
|
use SWP\Component\Common\Response\SingleResourceResponse; |
|
24
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
25
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
26
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
27
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
28
|
|
|
|
|
29
|
|
|
class FailedQueueController extends AbstractController |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @Operation( |
|
33
|
|
|
* tags={"failed_queue"}, |
|
34
|
|
|
* summary="Lists analytics reports", |
|
35
|
|
|
* @SWG\Parameter( |
|
36
|
|
|
* name="limit", |
|
37
|
|
|
* in="query", |
|
38
|
|
|
* description="example: limit=5", |
|
39
|
|
|
* default=50, |
|
40
|
|
|
* required=false, |
|
41
|
|
|
* type="integer" |
|
42
|
|
|
* ), |
|
43
|
|
|
* @SWG\Response( |
|
44
|
|
|
* response="200", |
|
45
|
|
|
* description="Returned on success.", |
|
46
|
|
|
* @SWG\Schema( |
|
47
|
|
|
* type="array", |
|
48
|
|
|
* @SWG\Items(ref=@Model(type=\SWP\Bundle\CoreRoute\Model\FailedEntry::class, groups={"api"})) |
|
49
|
|
|
* ) |
|
50
|
|
|
* ) |
|
51
|
|
|
* ) |
|
52
|
|
|
* |
|
53
|
|
|
* @Route("/api/{version}/failed_queue/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_list_failed_queue") |
|
54
|
|
|
*/ |
|
55
|
|
|
public function listAction(Request $request, FailedEntriesProvider $failedEntriesProvider) |
|
56
|
|
|
{ |
|
57
|
|
|
$max = (int) $request->query->get('limit', 50); |
|
58
|
|
|
|
|
59
|
|
|
return new SingleResourceResponse($failedEntriesProvider->getFailedEntries($max)); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|