Make upload_media_assets.media_asset_id nullable in order to support multi-file uploads. The media asset will be null while the image is still being downloaded from the source.
19 lines
419 B
Ruby
19 lines
419 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UploadMediaAsset < ApplicationRecord
|
|
belongs_to :upload
|
|
belongs_to :media_asset, optional: true
|
|
|
|
enum status: {
|
|
pending: 0,
|
|
processing: 100,
|
|
active: 200,
|
|
failed: 300,
|
|
}
|
|
|
|
def self.search(params)
|
|
q = search_attributes(params, :id, :created_at, :updated_at, :status, :source_url, :error, :upload, :media_asset)
|
|
q.apply_default_order(params)
|
|
end
|
|
end
|