32 lines
497 B
Elixir
32 lines
497 B
Elixir
defmodule Bump.Messages do
|
|
alias Bump.Database
|
|
alias Bump.Firebase
|
|
|
|
def pop(sender) do
|
|
Database.pop(sender)
|
|
end
|
|
|
|
def peek(sender) do
|
|
Database.peek(sender)
|
|
end
|
|
|
|
def list(sender, minutes) do
|
|
Database.list(sender, minutes)
|
|
end
|
|
|
|
def clear(sender) do
|
|
Database.clear(sender)
|
|
end
|
|
|
|
def push(sender, message) do
|
|
Database.push(sender, message)
|
|
tokens = Database.tokens(sender)
|
|
|
|
for token <- tokens do
|
|
Firebase.push(token, message)
|
|
end
|
|
end
|
|
|
|
|
|
end
|