1
0
mirror of https://github.com/algora-io/tv.git synced 2024-11-26 01:00:20 +02:00

add function to update object in storage

This commit is contained in:
zafer 2024-05-06 02:28:56 +03:00
parent 0ab70fc530
commit 3c01987dc5

View File

@ -123,6 +123,17 @@ defmodule Algora.Storage do
) )
end end
def update_object!(bucket, object, opts) do
bucket = Algora.config([:buckets, bucket])
with {:ok, %{body: body}} <- ExAws.S3.get_object(bucket, object) |> ExAws.request(),
{:ok, res} <- ExAws.S3.put_object(bucket, object, body, opts) |> ExAws.request() do
res
else
err -> err
end
end
defp broadcast!(topic, msg) do defp broadcast!(topic, msg) do
Phoenix.PubSub.broadcast!(@pubsub, topic, {__MODULE__, msg}) Phoenix.PubSub.broadcast!(@pubsub, topic, {__MODULE__, msg})
end end