memEx/lib/memex/email_worker.ex
shibao eeef7c94cd
All checks were successful
continuous-integration/drone/push Build is passing
fix emails
2024-07-28 13:35:34 -04:00

14 lines
402 B
Elixir

defmodule Memex.EmailWorker do
@moduledoc """
Oban worker that dispatches emails
"""
use Oban.Worker, queue: :mailers, tags: ["email"]
alias Memex.{Accounts, Email, Mailer}
@impl Oban.Worker
def perform(%Oban.Job{args: %{"email" => email, "user_id" => user_id, "attrs" => attrs}}) do
Email.generate_email(email, user_id |> Accounts.get_user!(), attrs) |> Mailer.deliver()
end
end