2023-03-23 17:37:53 +00:00
|
|
|
defmodule Mobilizon.Service.Workers.CleanApplicationData do
|
|
|
|
@moduledoc """
|
|
|
|
Worker to send activity recaps
|
|
|
|
"""
|
|
|
|
|
|
|
|
use Oban.Worker, queue: "background"
|
|
|
|
alias Mobilizon.Service.Auth.Applications
|
|
|
|
require Logger
|
|
|
|
|
|
|
|
@impl Oban.Worker
|
2023-05-03 10:08:20 +00:00
|
|
|
def perform(%Job{args: %{"type" => "application"}}) do
|
2023-03-23 17:37:53 +00:00
|
|
|
Logger.info("Cleaning expired applications data")
|
|
|
|
|
|
|
|
# TODO: Clear unused applications after a while
|
|
|
|
end
|
|
|
|
|
|
|
|
@impl Oban.Worker
|
2023-05-03 10:08:20 +00:00
|
|
|
def perform(%Job{args: %{"type" => "application_token"}}) do
|
2023-03-23 17:37:53 +00:00
|
|
|
Logger.info("Cleaning expired application tokens data")
|
|
|
|
|
|
|
|
Applications.prune_old_tokens()
|
|
|
|
:ok
|
|
|
|
end
|
|
|
|
|
|
|
|
@impl Oban.Worker
|
2023-05-03 10:08:20 +00:00
|
|
|
def perform(%Job{args: %{"type" => "application_device_activation"}}) do
|
2023-03-23 17:37:53 +00:00
|
|
|
Logger.info("Cleaning expired application device activation data")
|
|
|
|
|
|
|
|
Applications.prune_old_application_device_activations()
|
|
|
|
:ok
|
|
|
|
end
|
|
|
|
end
|