Refactor modules into contexts (#78)
* [WIP] break out a few contexts, start refactoring fast index modules * [WIP] more contexts, this time around slow indexing and downloads * [WIP] got all tests passing * [WIP] Added moduledocs * Built a genserver to rename old jobs on boot * Added a module naming check; moved things around * Fixed specs
This commit is contained in:
1 parent
c0885cfaf2
commit
3c897e96e6
66 files changed
+1092
-568
No files matched your search
@@ -0,0 +1,37 @@
|
||||
defmodule Pinchflat.Metadata.MediaMetadata do
|
||||
@moduledoc """
|
||||
The MediaMetadata schema.
|
||||
|
||||
Look. Don't @ me about Metadata vs. Metadatum. I'm very sensitive.
|
||||
"""
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
alias Pinchflat.Media.MediaItem
|
||||
|
||||
@allowed_fields ~w(metadata_filepath thumbnail_filepath)a
|
||||
@required_fields ~w(metadata_filepath thumbnail_filepath)a
|
||||
|
||||
schema "media_metadata" do
|
||||
field :metadata_filepath, :string
|
||||
field :thumbnail_filepath, :string
|
||||
|
||||
belongs_to :media_item, MediaItem
|
||||
|
||||
timestamps(type: :utc_datetime)
|
||||
end
|
||||
|
||||
@doc false
|
||||
def changeset(media_metadata, attrs) do
|
||||
media_metadata
|
||||
|> cast(attrs, @allowed_fields)
|
||||
|> validate_required(@required_fields)
|
||||
|> unique_constraint([:media_item_id])
|
||||
end
|
||||
|
||||
@doc false
|
||||
def filepath_attributes do
|
||||
~w(metadata_filepath thumbnail_filepath)a
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user