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,28 @@
module Admin
module Actions
module AutoTagging
class Create < Action
include Deps["commands.auto_tagging.create",
"views.auto_tagging.index",
auto_tag: "commands.auto_tagging.tag"]
def handle(req, res)
title_contains = req.params[:title_contains]
body_contains = req.params[:body_contains]
tag_id = req.params[:tag_id]
result = create.(title_contains: title_contains,
body_contains: body_contains,
tag_id: tag_id)
if result.success?
auto_tag.(auto_tag_id: result.value!)
end
res.render index
end
end
end
end
end

View File

@@ -0,0 +1,14 @@
module Admin
module Actions
module AutoTagging
class Delete < Action
include Deps["repos.auto_tagging_repo"]
def handle(req, res)
auto_tagging_repo.delete(id: req.params[:id])
end
end
end
end
end

View File

@@ -0,0 +1,14 @@
module Admin
module Actions
module AutoTagging
class Index < Action
include Deps["views.auto_tagging.index"]
def handle(req, res)
res.render index
end
end
end
end
end

View File

@@ -0,0 +1,14 @@
module Admin
module Actions
module AutoTagging
class New < Action
include Deps[new_view: "views.auto_tagging.new"]
def handle(req, res)
res.render new_view
end
end
end
end
end