Use new hanami db classes
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class AutoTaggings < ROM::Relation[:sql]
|
||||
class AutoTaggings < Adamantium::DB::Relation
|
||||
schema :auto_taggings, infer: true do
|
||||
associations do
|
||||
belongs_to :tag
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Highlights < ROM::Relation[:sql]
|
||||
class Highlights < Adamantium::DB::Relation
|
||||
schema :highlights, infer: true do
|
||||
associations do
|
||||
belongs_to :post
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class LoginTokens < ROM::Relation[:sql]
|
||||
class LoginTokens < Adamantium::DB::Relation
|
||||
schema :login_tokens, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Movies < ROM::Relation[:sql]
|
||||
class Movies < Adamantium::DB::Relation
|
||||
schema :movies, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Pages < ROM::Relation[:sql]
|
||||
class Pages < Adamantium::DB::Relation
|
||||
schema :pages, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class PodcastScrobbles < ROM::Relation[:sql]
|
||||
class PodcastScrobbles < Adamantium::DB::Relation
|
||||
schema :podcast_scrobbles, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Podcasts < ROM::Relation[:sql]
|
||||
class Podcasts < Adamantium::DB::Relation
|
||||
schema :podcasts, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class PostTags < ROM::Relation[:sql]
|
||||
class PostTags < Adamantium::DB::Relation
|
||||
schema :post_tags, infer: true do
|
||||
associations do
|
||||
belongs_to :post
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class PostTrips < ROM::Relation[:sql]
|
||||
class PostTrips < Adamantium::DB::Relation
|
||||
schema :post_trips, infer: true do
|
||||
associations do
|
||||
belongs_to :post
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Posts < ROM::Relation[:sql]
|
||||
class Posts < Adamantium::DB::Relation
|
||||
schema :posts, infer: true do
|
||||
associations do
|
||||
has_many :post_tags
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Reactions < ROM::Relation[:sql]
|
||||
class Reactions < Adamantium::DB::Relation
|
||||
schema :reactions, infer: true do
|
||||
associations do
|
||||
belongs_to :post
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Tags < ROM::Relation[:sql]
|
||||
class Tags < Adamantium::DB::Relation
|
||||
schema :tags, infer: true do
|
||||
associations do
|
||||
has_many :post_tags
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class TopTracks < ROM::Relation[:sql]
|
||||
class TopTracks < Adamantium::DB::Relation
|
||||
schema :top_tracks, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Trips < ROM::Relation[:sql]
|
||||
class Trips < Adamantium::DB::Relation
|
||||
schema :trips, infer: true do
|
||||
associations do
|
||||
has_many :post_trips
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Users < ROM::Relation[:sql]
|
||||
class Users < Adamantium::DB::Relation
|
||||
schema :users, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Webmentions < ROM::Relation[:sql]
|
||||
class Webmentions < Adamantium::DB::Relation
|
||||
schema :webmentions, infer: true do
|
||||
associations do
|
||||
belongs_to :post
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Adamantium
|
||||
module Relations
|
||||
class Workouts < ROM::Relation[:sql]
|
||||
class Workouts < Adamantium::DB::Relation
|
||||
schema :workouts, infer: true
|
||||
|
||||
auto_struct(true)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Adamantium
|
||||
module Repos
|
||||
class PageRepo < Adamantium::Repo[:pages]
|
||||
class PageRepo < Adamantium::DB::Repo[:pages]
|
||||
def fetch!(slug:)
|
||||
pages
|
||||
.published
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Adamantium
|
||||
module Repos
|
||||
class PodcastScrobbleRepo < Adamantium::Repo[:podcast_scrobbles]
|
||||
class PodcastScrobbleRepo < Adamantium::DB::Repo[:podcast_scrobbles]
|
||||
commands :create
|
||||
|
||||
def exists?(id:)
|
||||
|
@@ -2,7 +2,7 @@ require "time_math"
|
||||
|
||||
module Adamantium
|
||||
module Repos
|
||||
class PostRepo < Adamantium::Repo[:posts]
|
||||
class PostRepo < Adamantium::DB::Repo[:posts]
|
||||
def recent(limit:)
|
||||
date = Time.now
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class AutoTaggingRepo < Adamantium::Repo[:auto_taggings]
|
||||
class AutoTaggingRepo < Adamantium::DB::Repo[:auto_taggings]
|
||||
commands :create
|
||||
|
||||
def find(id)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class BookRepo < Adamantium::Repo[:posts]
|
||||
class BookRepo < Adamantium::DB::Repo[:posts]
|
||||
commands :create, update: :by_pk
|
||||
|
||||
def list_all
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class BookmarkRepo < Adamantium::Repo[:posts]
|
||||
class BookmarkRepo < Adamantium::DB::Repo[:posts]
|
||||
def list
|
||||
posts
|
||||
.where(post_type: "bookmark")
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class HighlightRepo < Adamantium::Repo[:highlights]
|
||||
class HighlightRepo < Adamantium::DB::Repo[:highlights]
|
||||
commands :create, delete: :by_pk
|
||||
|
||||
def list_all
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class LoginTokensRepo < Adamantium::Repo[:login_tokens]
|
||||
class LoginTokensRepo < Adamantium::DB::Repo[:login_tokens]
|
||||
commands :create
|
||||
|
||||
def by_token(token:)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class MovieRepo < Adamantium::Repo[:movies]
|
||||
class MovieRepo < Adamantium::DB::Repo[:movies]
|
||||
commands :create
|
||||
|
||||
def by_title_and_year(title:, year:)
|
||||
|
@@ -2,7 +2,7 @@ require "time_math"
|
||||
|
||||
module Admin
|
||||
module Repos
|
||||
class PageRepo < Adamantium::Repo[:pages]
|
||||
class PageRepo < Adamantium::DB::Repo[:pages]
|
||||
commands :create, update: :by_pk
|
||||
|
||||
def list
|
||||
|
@@ -2,7 +2,7 @@ require "time_math"
|
||||
|
||||
module Admin
|
||||
module Repos
|
||||
class PostRepo < Adamantium::Repo[:posts]
|
||||
class PostRepo < Adamantium::DB::Repo[:posts]
|
||||
commands update: :by_pk
|
||||
|
||||
def tag_post(post_id:, tags:)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class PostTagRepo < Adamantium::Repo[:post_tags]
|
||||
class PostTagRepo < Adamantium::DB::Repo[:post_tags]
|
||||
def merge_tags(target_id:, source_id:)
|
||||
post_tags.where(tag_id: source_id).update(tag_id: target_id)
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class PostTripRepo < Adamantium::Repo[:post_trips]
|
||||
class PostTripRepo < Adamantium::DB::Repo[:post_trips]
|
||||
commands :create
|
||||
|
||||
def remove(trip_id:, post_id:)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class TagRepo < Adamantium::Repo[:tags]
|
||||
class TagRepo < Adamantium::DB::Repo[:tags]
|
||||
def list
|
||||
tags
|
||||
.order(Sequel.function(:lower, :label))
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class TripRepo < Adamantium::Repo[:trips]
|
||||
class TripRepo < Adamantium::DB::Repo[:trips]
|
||||
commands :create
|
||||
|
||||
def list
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class UserRepo < Adamantium::Repo[:users]
|
||||
class UserRepo < Adamantium::DB::Repo[:users]
|
||||
commands :create
|
||||
|
||||
def exists(id)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class WebmentionRepo < Adamantium::Repo[:webmentions]
|
||||
class WebmentionRepo < Adamantium::DB::Repo[:webmentions]
|
||||
commands update: :by_pk
|
||||
|
||||
def list_all_for_check
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class MovieRepo < Adamantium::Repo[:movies]
|
||||
class MovieRepo < Adamantium::DB::Repo[:movies]
|
||||
def listing
|
||||
movies.order(Sequel.lit("year desc")).to_a
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class PageRepo < Adamantium::Repo[:pages]
|
||||
class PageRepo < Adamantium::DB::Repo[:pages]
|
||||
def fetch!(slug:)
|
||||
pages
|
||||
.published
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class PodcastRepo < Adamantium::Repo[:podcasts]
|
||||
class PodcastRepo < Adamantium::DB::Repo[:podcasts]
|
||||
def listing
|
||||
podcasts.order(:name).to_a
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class PodcastScrobbleRepo < Adamantium::Repo[:podcast_scrobbles]
|
||||
class PodcastScrobbleRepo < Adamantium::DB::Repo[:podcast_scrobbles]
|
||||
def exists?(id:)
|
||||
!!podcast_scrobbles
|
||||
.where(overcast_id: id)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class PostRepo < Adamantium::Repo[:posts]
|
||||
class PostRepo < Adamantium::DB::Repo[:posts]
|
||||
Sequel.extension :pg_json
|
||||
Sequel.extension :pg_json_ops
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class PostTagRepo < Adamantium::Repo[:post_tags]
|
||||
class PostTagRepo < Adamantium::DB::Repo[:post_tags]
|
||||
def posts_tagged(tag:)
|
||||
tag_id = post_tags
|
||||
.tags
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class ReactionRepo < Adamantium::Repo[:reactions]
|
||||
class ReactionRepo < Adamantium::DB::Repo[:reactions]
|
||||
commands :create
|
||||
|
||||
def count(post_id:)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class TagRepo < Adamantium::Repo[:tags]
|
||||
class TagRepo < Adamantium::DB::Repo[:tags]
|
||||
def fetch!(slug)
|
||||
tags.where(slug: slug).one!
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class TopTrackRepo < Adamantium::Repo[:top_tracks]
|
||||
class TopTrackRepo < Adamantium::DB::Repo[:top_tracks]
|
||||
def for_post(id:)
|
||||
top_tracks
|
||||
.where(post_id: id)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class TripRepo < Adamantium::Repo[:trips]
|
||||
class TripRepo < Adamantium::DB::Repo[:trips]
|
||||
def fetch!(id)
|
||||
trips
|
||||
.where(id: id)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Main
|
||||
module Repos
|
||||
class WorkoutRepo < Adamantium::Repo[:workouts]
|
||||
class WorkoutRepo < Adamantium::DB::Repo[:workouts]
|
||||
def list
|
||||
workouts.order(:published_at).to_a
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Micropub
|
||||
module Repos
|
||||
class AutoTaggingRepo < Adamantium::Repo[:auto_taggings]
|
||||
class AutoTaggingRepo < Adamantium::DB::Repo[:auto_taggings]
|
||||
def find(id)
|
||||
auto_taggings
|
||||
.where(id: id)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Micropub
|
||||
module Repos
|
||||
class MovieRepo < Adamantium::Repo[:movies]
|
||||
class MovieRepo < Adamantium::DB::Repo[:movies]
|
||||
commands :create
|
||||
end
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Micropub
|
||||
module Repos
|
||||
class PodcastRepo < Adamantium::Repo[:podcasts]
|
||||
class PodcastRepo < Adamantium::DB::Repo[:podcasts]
|
||||
commands :create
|
||||
|
||||
def listing
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Micropub
|
||||
module Repos
|
||||
class PostRepo < Adamantium::Repo[:posts]
|
||||
class PostRepo < Adamantium::DB::Repo[:posts]
|
||||
commands update: :by_pk
|
||||
|
||||
def remove_tag(post_id:, tag:)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Micropub
|
||||
module Repos
|
||||
class WebmentionsRepo < Adamantium::Repo[:webmentions]
|
||||
class WebmentionsRepo < Adamantium::DB::Repo[:webmentions]
|
||||
commands :create
|
||||
end
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Micropub
|
||||
module Repos
|
||||
class WorkoutRepo < Adamantium::Repo[:workouts]
|
||||
class WorkoutRepo < Adamantium::DB::Repo[:workouts]
|
||||
commands :create, update: :by_pk
|
||||
end
|
||||
end
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "Webmention creation", :db, :requests do
|
||||
let(:post_repo) { Adamantium::Repos::PostRepo.new }
|
||||
let(:post_repo) { Adamantium::DB::Repos::PostRepo.new }
|
||||
let(:post_record) { Test::Factory[:post] }
|
||||
|
||||
context "reply" do
|
||||
|
Reference in New Issue
Block a user