Add books page
This commit is contained in:
19
app/commands/posts/create_book_post.rb
Normal file
19
app/commands/posts/create_book_post.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
require "dry/monads"
|
||||
|
||||
module Adamantium
|
||||
module Commands
|
||||
module Posts
|
||||
class CreateBookPost < Command
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
include Dry::Monads[:result]
|
||||
|
||||
def call(post)
|
||||
created_post = post_repo.create(post)
|
||||
|
||||
Success(created_post)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -6,9 +6,11 @@ module Adamantium
|
||||
"validation.posts.post_contract",
|
||||
"validation.posts.bookmark_contract",
|
||||
"validation.posts.checkin_contract",
|
||||
"validation.posts.book_contract",
|
||||
"commands.posts.create_entry",
|
||||
"commands.posts.create_bookmark",
|
||||
"commands.posts.create_checkin"
|
||||
"commands.posts.create_checkin",
|
||||
"commands.posts.create_book_post"
|
||||
]
|
||||
|
||||
def call(entry_type:)
|
||||
@@ -17,6 +19,8 @@ module Adamantium
|
||||
{command: create_bookmark, validation: bookmark_contract}
|
||||
in Entities::CheckinRequest
|
||||
{command: create_checkin, validation: checkin_contract}
|
||||
in Entities::BookRequest
|
||||
{command: create_book_post, validation: book_contract}
|
||||
else
|
||||
{command: create_entry, validation: post_contract}
|
||||
end
|
||||
|
Reference in New Issue
Block a user