Initial commit

This commit is contained in:
2023-01-27 22:55:09 +11:00
commit 833f3ea8b2
130 changed files with 5637 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# frozen_string_literal: true
module Adamantium
module Persistence
module Relations
class PostTags < ROM::Relation[:sql]
schema :post_tags, infer: true do
associations do
belongs_to :post
belongs_to :tag
end
end
auto_struct(true)
end
end
end
end

View File

@@ -0,0 +1,22 @@
# frozen_string_literal: true
module Adamantium
module Persistence
module Relations
class Posts < ROM::Relation[:sql]
schema :posts, infer: true do
associations do
has_many :post_tags
has_many :tags, through: :post_tags
end
end
auto_struct(true)
def published
where(self[:published_at] <= Time.now)
end
end
end
end
end

View File

@@ -0,0 +1,18 @@
# frozen_string_literal: true
module Adamantium
module Persistence
module Relations
class Tags < ROM::Relation[:sql]
schema :tags, infer: true do
associations do
belongs_to :post_tag
belongs_to :post, through: :post_tag
end
end
auto_struct(true)
end
end
end
end