From 2a043d9f34f43ac3d48b12937311d0f152fea73f Mon Sep 17 00:00:00 2001 From: Jannik Streek <jannik.streek@gmail.com> Date: Mon, 28 Oct 2024 08:32:08 +0100 Subject: [PATCH] fix naming --- ...s3_object_storage_local_sandbox_service.ex | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/mindwendel/services/s3_object_storage_local_sandbox_service.ex diff --git a/lib/mindwendel/services/s3_object_storage_local_sandbox_service.ex b/lib/mindwendel/services/s3_object_storage_local_sandbox_service.ex new file mode 100644 index 00000000..79c5afa3 --- /dev/null +++ b/lib/mindwendel/services/s3_object_storage_local_sandbox_service.ex @@ -0,0 +1,19 @@ +defmodule Mindwendel.Services.S3ObjectStorageLocalSandboxService do + def get_object(_bucket_name, bucket_path) do + dest = Path.join("priv/static/uploads", Path.basename(bucket_path)) + {:ok, content} = File.read(dest) + {:ok, %{status_code: 200, body: content}} + end + + def put_object(_bucket_name, bucket_path, file, _opts) do + dest = Path.join("priv/static/uploads", Path.basename(bucket_path)) + File.write(dest, file) + {:ok, {}} + end + + def delete_object(_bucket_name, file_to_delete) do + dest = Path.join("priv/static/uploads", Path.basename(file_to_delete)) + File.rm(dest) + {:ok, {}} + end +end