Added API to list and detail actors

This commit is contained in:
Eliot Berriot 2019-01-03 11:47:29 +01:00
parent bbc36201c8
commit 47209ee5ae
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
7 changed files with 174 additions and 2 deletions

View file

@ -61,6 +61,21 @@ class ActorQuerySet(models.QuerySet):
return qs
def with_outbox_activities_count(self):
return self.annotate(
outbox_activities_count=models.Count("outbox_activities", distinct=True)
)
def with_followers_count(self):
return self.annotate(
followers_count=models.Count("received_follows", distinct=True)
)
def with_uploads_count(self):
return self.annotate(
uploads_count=models.Count("libraries__uploads", distinct=True)
)
class DomainQuerySet(models.QuerySet):
def external(self):
@ -71,7 +86,7 @@ class DomainQuerySet(models.QuerySet):
def with_outbox_activities_count(self):
return self.annotate(
outbox_activities_count=models.Count("actors__outbox_activities")
outbox_activities_count=models.Count("actors__outbox_activities", distinct=True)
)