Show movies watched on weekly posts

This commit is contained in:
2023-05-13 12:45:31 +10:00
parent f613717852
commit bcaab0754a
12 changed files with 101 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ module Adamantium
module Views
module Posts
class Show < Adamantium::View
include Deps["repos.post_repo"]
include Deps["repos.post_repo", "repos.movie_repo"]
expose :post do |slug:|
Decorators::Posts::Decorator.new(post_repo.fetch!(slug))
@@ -17,6 +17,13 @@ module Adamantium
posts.map { |p| Decorators::Posts::Decorator.new(p) }
end
expose :past_movies do |post|
start_date = TimeMath.week.floor(post.published_at)
end_date = TimeMath.week.ceil(post.published_at)
movies = movie_repo.from_the_archives(start_date: start_date, end_date: end_date)
movies.map { |p| Decorators::Movies::Decorator.new(p) }
end
expose :text_posts do |past_posts|
past_posts.reject(&:photos?)
end