From e64dacf8ba39b6fda97415d3b7f473f812b04764 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Fri, 3 Feb 2023 11:23:56 +1100 Subject: [PATCH] Add photos to source response --- app/commands/posts/update.rb | 13 ++++++++++++- app/queries/posts/microformat_post.rb | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/commands/posts/update.rb b/app/commands/posts/update.rb index 808e4f2..464eca4 100644 --- a/app/commands/posts/update.rb +++ b/app/commands/posts/update.rb @@ -7,7 +7,18 @@ module Adamantium def call(params:) slug = URI(params[:url]).path.split("/").last post = post_repo.fetch!(slug) - post_repo.update(post.id, params) + + if prams.key? :replace + post_repo.update(post.id, params) + end + + if params.key? :add + + end + + if params.key? :delete + + end end end end diff --git a/app/queries/posts/microformat_post.rb b/app/queries/posts/microformat_post.rb index f070d39..5a8f4c9 100644 --- a/app/queries/posts/microformat_post.rb +++ b/app/queries/posts/microformat_post.rb @@ -18,6 +18,7 @@ module Adamantium properties: { published: [post.published_at], content: [markdown_content], + photo: post.photos, category: post.tags.map { |t| t.label.to_s } } } @@ -27,6 +28,7 @@ module Adamantium result[:properties][:published] = [post.published_at] if properties.include? "published" result[:properties][:content] = [markdown_content] if properties.include? "content" result[:properties][:category] = post.tags.map { |t| t.label.to_s } if properties.include? "category" + result[:properties][:photos] = post.photos if properties.include? "photos" result end end