FEATURE: add `topic_filtered_posts_count` attribute to web hook post serializer.
This commit is contained in:
parent
c5140ef3fb
commit
400f79cffc
|
@ -3,6 +3,7 @@
|
|||
class WebHookPostSerializer < PostSerializer
|
||||
|
||||
attributes :topic_posts_count,
|
||||
:topic_filtered_posts_count,
|
||||
:topic_archetype,
|
||||
:category_slug
|
||||
|
||||
|
@ -34,6 +35,10 @@ class WebHookPostSerializer < PostSerializer
|
|||
object.topic ? object.topic.posts_count : 0
|
||||
end
|
||||
|
||||
def topic_filtered_posts_count
|
||||
object.topic ? object.topic.posts.where(post_type: Post.types[:regular]).count : 0
|
||||
end
|
||||
|
||||
def topic_archetype
|
||||
object.topic ? object.topic.archetype : ''
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue