Initial commit
This commit is contained in:
18
app/commands/posts/create_entry.rb
Normal file
18
app/commands/posts/create_entry.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
module Adamantium
|
||||
module Commands
|
||||
module Posts
|
||||
class CreateEntry < Command
|
||||
include Deps["repos.post_repo",
|
||||
"post_utilities.slugify",
|
||||
renderer: "renderers.markdown"
|
||||
]
|
||||
def call(post)
|
||||
attrs = post.to_h
|
||||
attrs[:content] = renderer.call(content: attrs[:content])
|
||||
|
||||
post_repo.create(attrs)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user