Add books page

This commit is contained in:
2023-06-26 21:07:29 +10:00
parent c92b74b238
commit 2e019c00f4
13 changed files with 179 additions and 2 deletions

View 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

View File

@@ -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