2021-12-05 00:36:13 +01:00
|
|
|
defmodule Bump.Messages.Message do
|
|
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
|
|
|
|
|
|
|
schema "messages" do
|
|
|
|
field :sender, :string
|
2022-01-03 13:07:33 +01:00
|
|
|
field :title, :string, default: ""
|
2021-12-05 00:36:13 +01:00
|
|
|
field :data, :string, default: ""
|
2021-12-10 12:46:34 +01:00
|
|
|
field :timestamp, :utc_datetime
|
2021-12-05 00:36:13 +01:00
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
def changeset(message, params) do
|
|
|
|
message
|
|
|
|
|> cast(params, [:sender, :data, :timestamp])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|