Add more endpoints for now page
This commit is contained in:
17
slices/main/views/past_week/index.rb
Normal file
17
slices/main/views/past_week/index.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module Main
|
||||
module Views
|
||||
module PastWeek
|
||||
class Index < Main::View
|
||||
config.layout = false
|
||||
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :past_week do
|
||||
post_repo.week_posts(limit: 1).to_a.map do |post|
|
||||
Decorators::Posts::Decorator.new(post)
|
||||
end.first
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
25
slices/main/views/recently_played_games/index.rb
Normal file
25
slices/main/views/recently_played_games/index.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
module Main
|
||||
module Views
|
||||
module RecentlyPlayedGames
|
||||
class Index < Main::View
|
||||
config.layout = false
|
||||
|
||||
include Deps["queries.posts.recent_games"]
|
||||
|
||||
expose :recently_played_games do |recently_played_result|
|
||||
# raise recently_played_result["data"].inspect
|
||||
recently_played_result.map do |game|
|
||||
{
|
||||
name: game["name"],
|
||||
playtime_forever: game["playtime_forever"].to_i / 60,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
private_expose :recently_played_result do
|
||||
recent_games.call
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user