Skip to content

A self-hosted media server and file management system

remove attributes and relationships containers on data

aminnausin7d7ae8f01db5
diff --git a/app/Http/Resources/SeriesResource.php b/app/Http/Resources/SeriesResource.php
index b9aa28e4..5c8047bd 100644
--- a/app/Http/Resources/SeriesResource.php
+++ b/app/Http/Resources/SeriesResource.php
@@ -16,22 +16,20 @@ class SeriesResource extends JsonResource
{
return [
'id' => $this->id,
+ 'folder_id' => $this->folder ? (string)$this->folder->id : null,
+ 'editor_id' => $this->editor ? $this->editor->id : null,
+ 'editor_name' => $this->editor ? $this->editor->name : '',
'title' => $this->title ?? $this->folder->name,
'description' => $this->description,
'studio' => $this->studio,
'rating' => $this->rating,
'seasons' => $this->seasons,
- 'episodes' => $this->episodes,
+ 'episodes' => $this->episodes,
'films' => $this->films,
'date_start' => $this->date_start,
'date_end' => $this->date_end,
'thumbnail_url' => $this->thumbnail_url,
'date_updated' => $this->updated_at,
- 'relationships' => [
- 'folder_id' => $this->folder ? (string)$this->folder->id : null,
- 'editor_id' => $this->editor ? $this->editor->id : null,
- 'editor_name' => $this->editor ? $this->editor->name : ''
- ]
];
}
}
diff --git a/app/Http/Resources/VideoResource.php b/app/Http/Resources/VideoResource.php
index f3222a82..ee81032f 100755
--- a/app/Http/Resources/VideoResource.php
+++ b/app/Http/Resources/VideoResource.php
@@ -17,24 +17,24 @@ class VideoResource extends JsonResource
$metadata = $this->metadata;
return [
'id' => (string)$this->id,
- 'attributes' => [
- 'name' => $this->name,
- 'path' => $this->path,
- 'date' => $this->date,
- 'date_raw' => $this->date_raw,
- 'title' => ($metadata ? $this->metadata->title : $this->title) ?? $this->name,
- 'description' => $metadata ? $this->metadata->description : $this->description, // ?? $this->folder->series->description
- 'duration' => $metadata ? $this->metadata->duration : $this->duration,
- 'episode' => $metadata ? $this->metadata->episode : $this->episode,
- 'season' => $metadata ? $this->metadata->season : $this->season,
- 'view_count' => $metadata ? $this->metadata->view_count : $this->view_count,
- 'tags' => $this->metadata->tags ?? '',
- ],
- 'relationships' => [
- 'folder_id' => (string)$this->folder->id,
- 'metadata' => $this->metadata,
- 'editor' => $metadata ? $this->metadata->editor : null
- ]
+ // 'attributes' => [
+ 'name' => $this->name,
+ 'path' => $this->path,
+ 'date' => $this->date,
+ 'date_raw' => $this->date_raw,
+ 'title' => ($metadata ? $this->metadata->title : $this->title) ?? $this->name,
+ 'description' => $metadata ? $this->metadata->description : $this->description, // ?? $this->folder->series->description
+ 'duration' => $metadata ? $this->metadata->duration : $this->duration,
+ 'episode' => $metadata ? $this->metadata->episode : $this->episode,
+ 'season' => $metadata ? $this->metadata->season : $this->season,
+ 'view_count' => $metadata ? $this->metadata->view_count : $this->view_count,
+ 'tags' => $this->metadata->tags ?? '',
+ // ],
+ // 'relationships' => [
+ 'folder_id' => (string)$this->folder->id,
+ 'metadata' => $this->metadata,
+ 'editor' => $metadata ? $this->metadata->editor : null
+ // ]
];
}
}