Compare commits
2 Commits
change-api
...
use-full-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b03026f19c | ||
|
|
3cbff1b0f1 |
@@ -45,14 +45,13 @@ class Api::ReleasesController < Api::ApiController
|
|||||||
if model_name == "acquired_media_release"
|
if model_name == "acquired_media_release"
|
||||||
mapping = {
|
mapping = {
|
||||||
"#{model_name.camelize}": SerializableAcquiredMediaRelease,
|
"#{model_name.camelize}": SerializableAcquiredMediaRelease,
|
||||||
FileInfo: SerializableFileInfo,
|
FileInfo: SerializableFileInfo
|
||||||
"ActiveStorage::Attachment".to_sym => ActiveStorage::SerializableAttachment,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render jsonapi: release,
|
render jsonapi: release,
|
||||||
status: status,
|
status: status,
|
||||||
class: mapping,
|
class: mapping,
|
||||||
include: [:files, :file_infos]
|
include: [:file_infos]
|
||||||
else
|
else
|
||||||
mapping = {
|
mapping = {
|
||||||
"#{model_name.camelize}": show_serializable,
|
"#{model_name.camelize}": show_serializable,
|
||||||
|
|||||||
@@ -17,14 +17,4 @@ class SerializableAcquiredMediaRelease < JSONAPI::Serializable::Resource
|
|||||||
{ count: @object.file_infos.size }
|
{ count: @object.file_infos.size }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
has_many :files do
|
|
||||||
data do
|
|
||||||
@object.files
|
|
||||||
end
|
|
||||||
|
|
||||||
meta do
|
|
||||||
{ count: @object.files.size }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -542,9 +542,9 @@ CREATE TABLE public.broadcast_recordings (
|
|||||||
updated_at timestamp(6) without time zone NOT NULL,
|
updated_at timestamp(6) without time zone NOT NULL,
|
||||||
duration double precision,
|
duration double precision,
|
||||||
hidden boolean DEFAULT false,
|
hidden boolean DEFAULT false,
|
||||||
starred boolean DEFAULT false,
|
|
||||||
name character varying,
|
name character varying,
|
||||||
description text
|
description text,
|
||||||
|
starred boolean DEFAULT false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -1492,6 +1492,7 @@ CREATE TABLE public.settings (
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE public.settings_id_seq
|
CREATE SEQUENCE public.settings_id_seq
|
||||||
|
AS integer
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
NO MINVALUE
|
NO MINVALUE
|
||||||
@@ -1527,6 +1528,7 @@ CREATE TABLE public.taggings (
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE public.taggings_id_seq
|
CREATE SEQUENCE public.taggings_id_seq
|
||||||
|
AS integer
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
NO MINVALUE
|
NO MINVALUE
|
||||||
@@ -1557,6 +1559,7 @@ CREATE TABLE public.tags (
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE public.tags_id_seq
|
CREATE SEQUENCE public.tags_id_seq
|
||||||
|
AS integer
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
NO MINVALUE
|
NO MINVALUE
|
||||||
|
|||||||
@@ -30,16 +30,6 @@ RSpec.describe Api::AcquiredMediaReleasesController, type: :controller do
|
|||||||
|
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'contains files attachment data' do
|
|
||||||
tested_release = create(:acquired_media_release, name: 'ct1', project_id: project.id)
|
|
||||||
|
|
||||||
sign_in_to_api(current_user)
|
|
||||||
get :show, params: { id: tested_release.id }
|
|
||||||
|
|
||||||
expect(response.body).to match /file_infos/
|
|
||||||
expect(response.body).to match /files/
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
|
|||||||
Reference in New Issue
Block a user