22 lines
388 B
Elixir
22 lines
388 B
Elixir
defmodule Aggiedit.Rooms.Post do
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
schema "posts" do
|
|
field :body, :string
|
|
field :title, :string
|
|
field :user_id, :id
|
|
field :upload_id, :id
|
|
field :room_id, :id
|
|
|
|
timestamps()
|
|
end
|
|
|
|
@doc false
|
|
def changeset(post, attrs) do
|
|
post
|
|
|> cast(attrs, [:title, :body])
|
|
|> validate_required([:title, :body])
|
|
end
|
|
end
|