mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 19:50:40 -05:00
Merge pull request #3125 from Roardom/fix-extra-movie-api-call
(Fix) Redundant movie db query for tv api calls
This commit is contained in:
@@ -459,11 +459,11 @@ class TorrentController extends BaseController
|
||||
$torrents = $torrents->through(function ($torrent) use ($movies, $tv) {
|
||||
switch ($torrent->meta) {
|
||||
case 'movie':
|
||||
$torrent->setRelation('movie', $movies[$torrent->tmdb] ?? collect());
|
||||
$torrent->setRelation('work', $movies[$torrent->tmdb] ?? collect());
|
||||
|
||||
break;
|
||||
case 'tv':
|
||||
$torrent->setRelation('tv', $tv[$torrent->tmdb] ?? collect());
|
||||
$torrent->setRelation('work', $tv[$torrent->tmdb] ?? collect());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ class TorrentResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request): array
|
||||
{
|
||||
$meta = $this->movie ?? $this->tv;
|
||||
/** @phpstan-ignore-next-line */
|
||||
$meta = $this->work;
|
||||
|
||||
return [
|
||||
'type' => 'torrent',
|
||||
|
||||
Reference in New Issue
Block a user