I am trying to add the following field to my GQL postFactCount
- total count of post_facts
associated with posts
for post_type
- Entertainment
. Is there any way to do this without making changes/addition to ecto? If not, what are some suggested ways to get the count?
For example,
this is my schema
@post_types [:entertainment, :health]
schema "posts" do
field :title, :string
field :type, Ecto.Enum, values: @post_types
timestamps()
end
schema "post_facts" do
belongs_to :comments, Comments,
references: :comment_data_id,
foreign_key: :comment_data_id
belongs_to :post, Post
timestamps()
end