Allow adding of syndication sources after a post is created

This commit is contained in:
2023-09-24 10:06:34 +10:00
parent 8b280afc75
commit 9be6389904
4 changed files with 57 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
require "readability"
require "down"
module Admin
module Commands
module Posts
class AddSyndicationSource
include Dry::Monads[:result]
include Deps["repos.post_repo"]
def call(post_id:, source_name:, source_url:)
post = post_repo.find(id: post_id)
syndication_sources = post[:syndication_sources]
updated_syndication_sources = syndication_sources.merge(source_name => source_url)
post_repo.update(post_id, syndication_sources: updated_syndication_sources)
Success()
end
end
end
end
end