Create books via admin

This commit is contained in:
2023-12-22 21:17:02 +11:00
parent 900fdea472
commit bace782b54
5 changed files with 59 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
# frozen_string_literal: true
module Admin
module Actions
module Books
class Create < Admin::Action
include Deps["repos.book_repo"]
def handle(req, resp)
book_repo.create({
name: req.params[:name],
book_author: req.params[:book_author],
slug: req.params[:slug],
content: "",
book_status: req.params[:book_status],
post_type: "book",
published_at: Time.now
})
resp.redirect_to "/admin/books"
end
end
end
end
end