Add bookmark admin

This commit is contained in:
2023-05-07 11:31:15 +10:00
parent fa146fbfb3
commit 3fddc1757e
17 changed files with 186 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
module Admin
module Actions
module Bookmarks
class Cache < Action
include Deps["commands.bookmarks.cache"]
def handle(req, res)
bookmark_id = req.params[:id]
if cache.(bookmark_id: bookmark_id).success?
res.body = "Success"
else
res.body = "Failed"
end
end
end
end
end
end

View File

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

View File

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