mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-24 00:43:02 +00:00
1217361b6c
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
25 lines
527 B
Elixir
25 lines
527 B
Elixir
defmodule Eventos.Events.Category do
|
|
@moduledoc """
|
|
Represents a category for events
|
|
"""
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
alias Eventos.Events.Category
|
|
|
|
|
|
schema "categories" do
|
|
field :description, :string
|
|
field :picture, :string
|
|
field :title, :string, null: false
|
|
|
|
timestamps()
|
|
end
|
|
|
|
@doc false
|
|
def changeset(%Category{} = category, attrs) do
|
|
category
|
|
|> cast(attrs, [:title, :description, :picture])
|
|
|> validate_required([:title])
|
|
|> unique_constraint(:title)
|
|
end
|
|
end
|