bump_server/lib/bump/messages.ex
raphael 4e607a7e45 adds phoenix boilerplate and database api
- message communication added
- database migration added
- initial commit
2021-12-05 00:36:13 +01:00

28 lines
517 B
Elixir

defmodule Bump.Messages do
alias Bump.Repo
import Ecto.Query
def get_newest_message(_sender) do
end
def get_all_messages_since(sender, minutes) do
ago = DateTime.utc_now
|> Timex.shift(minutes: -minutes)
|> DateTime.truncate(:second)
query = from m in "messages",
where: m.sender == ^sender and
m.timestamp >= ^ago,
select: m.data
Repo.all(query)
end
def remove_sender(_sender) do
end
def add_message(_sender, _message) do
end
end