docbrown/app/services/articles/feeds/latest.rb
Michael Kohl c7ba9d81db
Clean up feed-related code (#14707)
* Start cleaning up feed code

* Move published_articles_by_tag to service

* Add timeframe and latest feed services

* fixup! Move published_articles_by_tag to service

* Move constant to correct location

* Fix spec
2021-09-17 09:23:32 +07:00

15 lines
346 B
Ruby

module Articles
module Feeds
module Latest
MINIMUM_SCORE = -20
def self.call(tag: nil, number_of_articles: 50, page: 1)
Articles::Feeds::Tag.call(tag)
.order(published_at: :desc)
.where("score > ?", MINIMUM_SCORE)
.page(page)
.per(number_of_articles)
end
end
end
end