From 93041ee2076a960072c29ea421f0dcf1fbda8462 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sun, 2 Jul 2023 09:49:41 +1000 Subject: [PATCH] Return success from media upload --- app/commands/media/upload.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/commands/media/upload.rb b/app/commands/media/upload.rb index 90844c8..3ffc73c 100644 --- a/app/commands/media/upload.rb +++ b/app/commands/media/upload.rb @@ -23,8 +23,14 @@ module Adamantium return Failure(:invalid_file_type) unless VALID_UPLOAD_TYPES.include? type - save_image(file: file) if IMAGE_TYPES.include? type - save_video(file: file) if VIDEO_TYPES.include? type + result = save_image(file: file) if IMAGE_TYPES.include? type + result = save_video(file: file) if VIDEO_TYPES.include? type + + if result.success? + Success(result.value!) + else + Failure() + end end private