summaryrefslogtreecommitdiff
path: root/lib/aggiedit/rooms/post.ex
blob: c6ca24afb47030d3ba0b019b9e1bdba07d94ba83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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