CJ_Clippy aa75c224fc
Some checks failed
ci / build (push) Failing after 23m29s
ci / Tests & Checks (push) Failing after 3m32s
move services/bright to apps/bright
2025-02-10 08:16:50 -08:00

29 lines
689 B
Elixir

defmodule Bright.Torrents.Torrent do
use Ecto.Schema
import Ecto.Changeset
schema "torrents" do
field :info_hash_v1, :string
field :info_hash_v2, :string
field :cdn_url, :string
field :magnet, :string
belongs_to :vod, Bright.Streams.Vod
timestamps(type: :utc_datetime)
end
@doc false
def changeset(torrent, attrs) do
torrent
|> cast(attrs, [:vod_id, :info_hash_v1, :info_hash_v2, :cdn_url, :magnet])
|> validate_required([:info_hash_v1, :info_hash_v2, :cdn_url, :magnet])
end
end
defimpl Phoenix.HTML.Safe, for: Bright.Torrents.Torrent do
def to_iodata(torrent) do
Phoenix.HTML.Safe.to_iodata("Torrent #{torrent.id}")
end
end