Add mising repos post-refactor
This commit is contained in:
26
app/repos/podcast_scrobble_repo.rb
Normal file
26
app/repos/podcast_scrobble_repo.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
module Adamantium
|
||||
module Repos
|
||||
class PodcastScrobbleRepo < Adamantium::Repo[:podcast_scrobbles]
|
||||
commands :create
|
||||
|
||||
def exists?(id:)
|
||||
!!podcast_scrobbles
|
||||
.where(overcast_id: id)
|
||||
.one
|
||||
end
|
||||
|
||||
def listing
|
||||
podcast_scrobbles
|
||||
.order(Sequel.desc(:listened_at))
|
||||
.limit(5)
|
||||
.to_a
|
||||
end
|
||||
|
||||
def for_timemachine(date:)
|
||||
podcast_scrobbles
|
||||
.where(listened_at: TimeMath.day.floor(date)...TimeMath.day.advance(date, +1))
|
||||
.to_a
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
19
app/repos/post_repo.rb
Normal file
19
app/repos/post_repo.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
module Adamantium
|
||||
module Repos
|
||||
class PostRepo < Adamantium::Repo[:posts]
|
||||
Sequel.extension :pg_json
|
||||
Sequel.extension :pg_json_ops
|
||||
|
||||
def for_reminders(limit:)
|
||||
posts
|
||||
.where(post_type: "bookmark", is_read: false)
|
||||
.limit(limit)
|
||||
.published
|
||||
.combine(:tags)
|
||||
.order(Sequel.desc(:published_at))
|
||||
.to_a
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user