show files attachments instead of file infos in API for acq.media release
This commit is contained in:
@@ -45,13 +45,13 @@ class Api::ReleasesController < Api::ApiController
|
||||
if model_name == "acquired_media_release"
|
||||
mapping = {
|
||||
"#{model_name.camelize}": SerializableAcquiredMediaRelease,
|
||||
FileInfo: SerializableFileInfo
|
||||
"ActiveStorage::Attachment".to_sym => ActiveStorage::SerializableAttachment,
|
||||
}
|
||||
|
||||
render jsonapi: release,
|
||||
status: status,
|
||||
class: mapping,
|
||||
include: [:file_infos]
|
||||
include: [:files]
|
||||
else
|
||||
mapping = {
|
||||
"#{model_name.camelize}": show_serializable,
|
||||
|
||||
@@ -8,13 +8,13 @@ class SerializableAcquiredMediaRelease < JSONAPI::Serializable::Resource
|
||||
:applicable_medium_id, :applicable_medium_text, :territory_id, :territory_text, :term_id, :term_text,
|
||||
:restriction_id, :restriction_text, :categories, :description, :tag_list
|
||||
|
||||
has_many :file_infos do
|
||||
has_many :files do
|
||||
data do
|
||||
@object.file_infos
|
||||
@object.files
|
||||
end
|
||||
|
||||
meta do
|
||||
{ count: @object.file_infos.size }
|
||||
{ count: @object.files.size }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user