1
0
mirror of https://github.com/algora-io/tv.git synced 2025-03-17 20:17:45 +02:00
algora-tv/lib/algora/chat/message.ex

23 lines
450 B
Elixir
Raw Normal View History

2024-02-29 22:31:42 +03:00
defmodule Algora.Chat.Message do
use Ecto.Schema
alias Algora.Accounts
alias Algora.Library
import Ecto.Changeset
schema "messages" do
field :body, :string
field :sender_handle, :string, virtual: true
belongs_to :user, Accounts.User
belongs_to :video, Library.Video
timestamps()
end
@doc false
def changeset(message, attrs) do
message
|> cast(attrs, [:body])
|> validate_required([:body])
end
end