Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
class ActiveStorage::SerializableAttachment < JSONAPI::Serializable::Resource
type 'active_storage_attachment'
attributes :content_type
attribute :filename do
@object.filename.to_s
end
attribute :url do
Rails.application.routes.url_helpers.rails_blob_url(@object, host: AppHost.new.domain_with_port)
end
attribute :thumbnail_url do
if @object.variable?
Rails.application.routes.url_helpers.rails_representation_url(@object.variant(resize: "150x150"), host: AppHost.new.domain_with_port)
end
end
end

View File

@@ -0,0 +1,14 @@
class DeserializableNote < JSONAPI::Deserializable::Resource
Note.new.attributes.keys.each do |attr|
attribute attr.to_sym
end
end
class SerializableNote < JSONAPI::Serializable::Resource
type 'note'
Note.new.attributes.keys.each do |attr|
attribute attr.to_sym
end
end

View File

@@ -0,0 +1,20 @@
class SerializableAcquiredMediaRelease < JSONAPI::Serializable::Resource
type 'acquired_media_release'
attributes :project_id, :contract_template_id, :tagging_status, :name, :person_name,
:person_address_street1, :person_address_street2, :person_address_city, :person_address_state,
:person_address_zip, :person_address_country, :person_phone, :person_email, :person_fax,
:person_title, :person_company, :created_at, :updated_at, :collection_uid, :territory_old, :term_old,
: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
data do
@object.file_infos
end
meta do
{ count: @object.file_infos.size }
end
end
end

View File

@@ -0,0 +1,18 @@
# frozen_string_literal: true
class SerializableBroadcast < JSONAPI::Serializable::Resource
type 'broadcast'
%i[name status stream_server_url stream_key project_id streamer_status created_at].each do |key|
attribute key
end
has_many :files do
data do
@object.files
end
meta do
{ count: @object.files.size }
end
end
end

View File

@@ -0,0 +1,7 @@
class SerializableContractTemplate < JSONAPI::Serializable::Resource
type 'contract_template'
ContractTemplate.new.attributes.keys.each do |attr|
attribute attr.to_sym
end
end

View File

@@ -0,0 +1,5 @@
class SerializableContractTemplateList < JSONAPI::Serializable::Resource
type 'contract_template'
attributes :name
end

View File

@@ -0,0 +1,5 @@
class SerializableFileInfo < JSONAPI::Serializable::Resource
type 'file_info'
attributes :filename, :content_type, :byte_size
end

View File

@@ -0,0 +1,9 @@
class SerializableNote < JSONAPI::Serializable::Resource
type 'note'
Note.new.attributes.keys.each do |attr|
attribute attr.to_sym
end
attribute :email
end

View File

@@ -0,0 +1,4 @@
class SerializableProject < JSONAPI::Serializable::Resource
type 'project'
attributes :name, :created_at, :updated_at
end

View File

@@ -0,0 +1,5 @@
class SerializableUser < JSONAPI::Serializable::Resource
type "user"
attributes :email
end