Separating of Storage context

This commit is contained in:
miffy
2019-09-08 01:49:56 +02:00
parent 86a0630a7d
commit fa037fd683
34 changed files with 167 additions and 180 deletions

View File

@@ -26,25 +26,24 @@ defmodule Mobilizon.Actors.Actor do
@moduledoc """
Represents an actor (local and remote actors)
"""
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias Mobilizon.Actors
alias Mobilizon.Actors.{Actor, Follower, Member}
alias Mobilizon.Config
alias Mobilizon.Events.{Event, FeedToken}
alias Mobilizon.Media.File
alias Mobilizon.Users.User
alias Mobilizon.Reports.{Report, Note}
alias Mobilizon.Storage.{Page, Repo}
alias Mobilizon.Users.User
alias MobilizonWeb.Router.Helpers, as: Routes
alias MobilizonWeb.Endpoint
import Ecto.Query
import Mobilizon.Ecto
alias Mobilizon.Repo
require Logger
# @type t :: %Actor{description: String.t, id: integer(), inserted_at: DateTime.t, updated_at: DateTime.t, display_name: String.t, domain: String.t, keys: String.t, suspended: boolean(), url: String.t, username: String.t, organized_events: list(), groups: list(), group_request: list(), user: User.t, field: ActorTypeEnum.t}
@@ -383,7 +382,7 @@ defmodule Mobilizon.Actors.Actor do
)
total = Task.async(fn -> Repo.aggregate(query, :count, :id) end)
elements = Task.async(fn -> Repo.all(paginate(query, page, limit)) end)
elements = Task.async(fn -> Repo.all(Page.paginate(query, page, limit)) end)
%{total: Task.await(total), elements: Task.await(elements)}
end
@@ -428,7 +427,7 @@ defmodule Mobilizon.Actors.Actor do
)
total = Task.async(fn -> Repo.aggregate(query, :count, :id) end)
elements = Task.async(fn -> Repo.all(paginate(query, page, limit)) end)
elements = Task.async(fn -> Repo.all(Page.paginate(query, page, limit)) end)
%{total: Task.await(total), elements: Task.await(elements)}
end