Add auto tagger for posts

This commit is contained in:
2023-05-06 19:58:59 +10:00
parent c4bd903e74
commit 9f8359d782
25 changed files with 424 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
module Admin
module Entities
class AutoTagging < Dry::Struct
attribute :id, Types::Coercible::Integer
attribute? :title_contains, Types::Optional::String
attribute? :body_contains, Types::Optional::String
attribute :tag_id, Types::Coercible::Integer
def title_only?
!title_contains.empty?
end
def term
title_only? ? title_contains : body_contains
end
class WithTag < AutoTagging
attribute :tag, Types::Tag
end
end
end
end