adds phoenix boilerplate and database api
- message communication added - database migration added - initial commit
This commit is contained in:
27
lib/bump/messages.ex
Normal file
27
lib/bump/messages.ex
Normal file
@ -0,0 +1,27 @@
|
||||
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
|
Reference in New Issue
Block a user