Admin post management

This commit is contained in:
2023-05-07 17:28:45 +10:00
parent 4fb1b2b166
commit d679ea1947
8 changed files with 110 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
module Admin
module Actions
module Posts
class Archive < Action
include Deps["repos.post_repo"]
def handle(req, res)
post_id = req.params[:id]
post_repo.archive(id: post_id)
end
end
end
end
end

View File

@@ -0,0 +1,17 @@
module Admin
module Actions
module Posts
class Delete < Action
include Deps["repos.post_repo", "repos.post_tag_repo"]
def handle(req, res)
post_id = req.params[:id]
post_tag_repo.delete_by_post_id(post_id: post_id)
post_repo.delete(id: post_id)
end
end
end
end
end

View File

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