So I recall someone saying something along the lines of that you should put your query logic in the Repo module.
I’m wondering if that is still a true statement.
For example. I have a blog context where I want to get only published blog posts. so I have a function like so.
def list_publised_posts do
from(
p in Digitalcakes.Blog.Post,
where: p.published_at <= ^Timex.now(),
where: p.draft == false,
order_by: [desc: :published_at],
select: p
)
|> Repo.all()
end
Does it really make sense to move that logic into the Repo vs the keeping it in the context of the blog module?
If so what I’m I gaining from doing that?
And if not then what is a good use for the Repo module?