diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-15 13:00:42 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-15 13:00:42 -0600 |
commit | 3cf9f4a364ac91cca30799c8379a682139425e71 (patch) | |
tree | db94f64634e0a840b0a5d1eeef43460ef4e8dd21 /lib/aggiedit/rooms/post.ex | |
parent | db7c2321cd0af59f9e810e84c7d4eb83ec416458 (diff) | |
download | aggiedit-3cf9f4a364ac91cca30799c8379a682139425e71.tar.gz aggiedit-3cf9f4a364ac91cca30799c8379a682139425e71.zip |
Add comments and vote models; pub/sub voting on posts
Diffstat (limited to 'lib/aggiedit/rooms/post.ex')
-rw-r--r-- | lib/aggiedit/rooms/post.ex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/aggiedit/rooms/post.ex b/lib/aggiedit/rooms/post.ex index ee9450d..e1aa59a 100644 --- a/lib/aggiedit/rooms/post.ex +++ b/lib/aggiedit/rooms/post.ex @@ -5,18 +5,22 @@ defmodule Aggiedit.Rooms.Post do schema "posts" do field :body, :string field :title, :string + field :score, :integer belongs_to :room, Aggiedit.Rooms.Room belongs_to :user, Aggiedit.Accounts.User belongs_to :upload, Aggiedit.Uploads.Upload + has_many :votes, Aggiedit.Post.Vote + has_many :comments, Aggiedit.Post.Comment + timestamps() end @doc false def changeset(post, attrs) do post - |> cast(attrs, [:title, :body]) + |> cast(attrs, [:title, :body, :score]) |> validate_required([:title, :body]) end |