bump_server/lib/bump/messages/message.ex
raphael 3b1657e18a adds api calls for getting, setting, removing
- using Ecto queries, the api can now get newest
  message or get the last message
- delete all messages of a sender id
- add a message (auto adding a time stamp)
2021-12-10 12:46:34 +01:00

20 lines
337 B
Elixir

defmodule Bump.Messages.Message do
use Ecto.Schema
import Ecto.Changeset
schema "messages" do
field :sender, :string
field :data, :string, default: ""
field :timestamp, :utc_datetime
timestamps()
end
def changeset(message, params) do
message
|> cast(params, [:sender, :data, :timestamp])
end
end