Refactor micropub specific things out to a slice

This commit is contained in:
2023-11-15 18:55:57 +11:00
parent 730ecb9ea4
commit 5b133363b3
63 changed files with 468 additions and 174 deletions

View File

@@ -0,0 +1,31 @@
module Micropub
module Commands
module Posts
class CreationResolver
include Deps[
"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_book_post"
]
def call(entry_type:)
case entry_type
in Entities::BookmarkRequest
{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
end
end
end
end
end