Fixes #5452 -- Fix types on streamer broadcast download.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-06-01 22:33:10 -05:00
parent 7046e16458
commit d8becc0844
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
3 changed files with 12 additions and 12 deletions

View File

@ -553,19 +553,17 @@ return static function (RouteCollectorProxy $group) {
->add(new Middleware\Permissions(StationPermissions::Streamers, true));
$group->group(
'/streamer/{id}',
'/streamer/{streamer_id}',
function (RouteCollectorProxy $group) {
$group->get(
'/broadcasts',
Controller\Api\Stations\Streamers\BroadcastsController::class . ':listAction'
)
->setName('api:stations:streamer:broadcasts');
)->setName('api:stations:streamer:broadcasts');
$group->get(
'/broadcast/{broadcast_id}/download',
Controller\Api\Stations\Streamers\BroadcastsController::class . ':downloadAction'
)
->setName('api:stations:streamer:broadcast:download');
)->setName('api:stations:streamer:broadcast:download');
$group->delete(
'/broadcast/{broadcast_id}',

View File

@ -25,12 +25,12 @@ final class BroadcastsController extends AbstractApiCrudController
ServerRequest $request,
Response $response,
string $station_id,
?string $id = null
?string $streamer_id = null
): ResponseInterface {
$station = $request->getStation();
if (null !== $id) {
$streamer = $this->getStreamer($station, $id);
if (null !== $streamer_id) {
$streamer = $this->getStreamer($station, $streamer_id);
if (null === $streamer) {
return $response->withStatus(404)
@ -66,13 +66,13 @@ final class BroadcastsController extends AbstractApiCrudController
$fsRecordings = (new StationFilesystems($station))->getRecordingsFilesystem();
$paginator->setPostprocessor(
function ($row) use ($id, $is_bootgrid, $router, $fsRecordings) {
function ($row) use ($streamer_id, $is_bootgrid, $router, $fsRecordings) {
$return = $this->toArray($row);
unset($return['recordingPath']);
$recordingPath = $row->getRecordingPath();
if (null === $id) {
if (null === $streamer_id) {
$streamer = $row->getStreamer();
$return['streamer'] = [
'id' => $streamer->getId(),
@ -85,7 +85,7 @@ final class BroadcastsController extends AbstractApiCrudController
$routeParams = [
'broadcast_id' => $row->getId(),
];
if (null === $id) {
if (null === $streamer_id) {
$routeParams['id'] = $row->getStreamer()->getId();
}
@ -126,6 +126,7 @@ final class BroadcastsController extends AbstractApiCrudController
ServerRequest $request,
Response $response,
string $station_id,
string $streamer_id,
string $broadcast_id
): ResponseInterface {
$station = $request->getStation();
@ -158,6 +159,7 @@ final class BroadcastsController extends AbstractApiCrudController
ServerRequest $request,
Response $response,
string $station_id,
string $streamer_id,
string $broadcast_id
): ResponseInterface {
$station = $request->getStation();

View File

@ -291,7 +291,7 @@ final class StreamersController extends AbstractScheduledEntityController
$return['links']['broadcasts'] = (string)$router->fromHere(
route_name: 'api:stations:streamer:broadcasts',
route_params: ['id' => $record->getId()],
route_params: ['streamer_id' => $record->getId()],
absolute: !$isInternal
);
$return['links']['art'] = (string)$router->fromHere(