From b261dd7193f49e3cd47c71a4ab236d97d1d95e24 Mon Sep 17 00:00:00 2001 From: Inhji Date: Mon, 17 Jul 2023 19:46:00 +0200 Subject: [PATCH] treat photo property as Plug.Upload struct --- lib/chiya_web/indie/micropub_handler.ex | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/chiya_web/indie/micropub_handler.ex b/lib/chiya_web/indie/micropub_handler.ex index ead85ab..47fc4c1 100644 --- a/lib/chiya_web/indie/micropub_handler.ex +++ b/lib/chiya_web/indie/micropub_handler.ex @@ -36,13 +36,16 @@ defmodule ChiyaWeb.Indie.MicropubHandler do # TODO: Make separate function for this note_attrs |> Props.get_photos() - |> Enum.map(fn photo_url -> + |> Enum.map(fn photo -> Chiya.Notes.create_note_image(%{ note_id: note.id, - path: photo_url + path: photo.path }) end) - |> Enum.each(&IO.inspect/1) + |> Enum.each(fn result -> + Logger.info("Photo created!") + Logger.info(inspect(result)) + end) {:ok, :created, Chiya.Notes.Note.note_url(note)} else