mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-25 21:11:31 +01:00
25 lines
610 B
Elixir
25 lines
610 B
Elixir
defmodule Philomena.Forums.Polls do
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
schema "polls" do
|
|
belongs_to :topic, Philomena.Forums.Topic
|
|
belongs_to :deleted_by, Philomena.Users.User
|
|
|
|
field :title, :string
|
|
field :vote_method, :string
|
|
field :active_until, :naive_datetime
|
|
field :total_votes, :integer, default: 0
|
|
field :hidden_from_users, :boolean, default: false
|
|
field :deletion_reason, :string, default: ""
|
|
|
|
timestamps(inserted_at: :created_at)
|
|
end
|
|
|
|
@doc false
|
|
def changeset(polls, attrs) do
|
|
polls
|
|
|> cast(attrs, [])
|
|
|> validate_required([])
|
|
end
|
|
end
|