Backend support to get used media size for users and actors
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -37,6 +37,8 @@ defmodule Mobilizon.GraphQL.Schema.ActorInterface do
|
||||
field(:followersCount, :integer, description: "Number of followers for this actor")
|
||||
field(:followingCount, :integer, description: "Number of actors following this actor")
|
||||
|
||||
field(:media_size, :integer, description: "The total size of the media from this actor")
|
||||
|
||||
resolve_type(fn
|
||||
%Actor{type: :Person}, _ ->
|
||||
:person
|
||||
|
||||
@@ -3,6 +3,7 @@ defmodule Mobilizon.GraphQL.Schema.Actors.ApplicationType do
|
||||
Schema representation for Group.
|
||||
"""
|
||||
|
||||
alias Mobilizon.GraphQL.Resolvers.Picture
|
||||
use Absinthe.Schema.Notation
|
||||
|
||||
@desc """
|
||||
@@ -34,5 +35,10 @@ defmodule Mobilizon.GraphQL.Schema.Actors.ApplicationType do
|
||||
field(:followers, list_of(:follower), description: "List of followers")
|
||||
field(:followersCount, :integer, description: "Number of followers for this actor")
|
||||
field(:followingCount, :integer, description: "Number of actors following this actor")
|
||||
|
||||
field(:media_size, :integer,
|
||||
resolve: &Picture.actor_size/3,
|
||||
description: "The total size of the media from this actor"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ defmodule Mobilizon.GraphQL.Schema.Actors.GroupType do
|
||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||
|
||||
alias Mobilizon.Addresses
|
||||
alias Mobilizon.GraphQL.Resolvers.{Discussion, Group, Member, Post, Resource, Todos}
|
||||
alias Mobilizon.GraphQL.Resolvers.{Discussion, Group, Member, Picture, Post, Resource, Todos}
|
||||
alias Mobilizon.GraphQL.Schema
|
||||
|
||||
import_types(Schema.Actors.MemberType)
|
||||
@@ -52,6 +52,11 @@ defmodule Mobilizon.GraphQL.Schema.Actors.GroupType do
|
||||
field(:followersCount, :integer, description: "Number of followers for this actor")
|
||||
field(:followingCount, :integer, description: "Number of actors following this actor")
|
||||
|
||||
field(:media_size, :integer,
|
||||
resolve: &Picture.actor_size/3,
|
||||
description: "The total size of the media from this actor"
|
||||
)
|
||||
|
||||
# This one should have a privacy setting
|
||||
field :organized_events, :paginated_event_list do
|
||||
arg(:after_datetime, :datetime,
|
||||
|
||||
@@ -7,7 +7,7 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do
|
||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||
|
||||
alias Mobilizon.Events
|
||||
alias Mobilizon.GraphQL.Resolvers.Person
|
||||
alias Mobilizon.GraphQL.Resolvers.{Person, Picture}
|
||||
alias Mobilizon.GraphQL.Schema
|
||||
|
||||
import_types(Schema.Events.FeedTokenType)
|
||||
@@ -49,6 +49,11 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do
|
||||
field(:followersCount, :integer, description: "Number of followers for this actor")
|
||||
field(:followingCount, :integer, description: "Number of actors following this actor")
|
||||
|
||||
field(:media_size, :integer,
|
||||
resolve: &Picture.actor_size/3,
|
||||
description: "The total size of the media from this actor"
|
||||
)
|
||||
|
||||
field(:feed_tokens, list_of(:feed_token),
|
||||
resolve: dataloader(Events),
|
||||
description: "A list of the feed tokens for this person"
|
||||
|
||||
@@ -7,7 +7,7 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
|
||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||
|
||||
alias Mobilizon.Events
|
||||
alias Mobilizon.GraphQL.Resolvers.User
|
||||
alias Mobilizon.GraphQL.Resolvers.{Picture, User}
|
||||
alias Mobilizon.GraphQL.Schema
|
||||
|
||||
import_types(Schema.SortType)
|
||||
@@ -120,6 +120,11 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
|
||||
arg(:limit, :integer, default_value: 10, description: "The limit of user media per page")
|
||||
resolve(&User.user_medias/3)
|
||||
end
|
||||
|
||||
field(:media_size, :integer,
|
||||
resolve: &Picture.user_size/3,
|
||||
description: "The total size of all the media from this user (from all their actors)"
|
||||
)
|
||||
end
|
||||
|
||||
@desc "The list of roles an user can have"
|
||||
|
||||
Reference in New Issue
Block a user