I have an ecto schema of Post as follows
schema "posts" do
field :title, :string
field :body, :string
field :publish_date, :date
has_many :comments, MyRepo.Blogs.Comments.Comment
end
GQL schema
mutation do
field :delete_post, type: :blog_post do
arg(:post, :struct)
resolve(&MyRepoWeb.Schema.Resolvers.Posts.delete_post/1)
end
My question is how do I write a resolver function in such a way that I delete posts that are only published,. i.e posts that have a publish_date (non-null value).