Media folder queries

Our Phoenix umbrella application will send us a user_id and a folder_path values and we will need to fetch all the Media entries on the given path. Paths in ElixirDrip always start with $, so $, $/folder, and $/a/b/c/d/e/f/g are all valid paths (notice that paths can't have a trailing slash).

Under the hood, we store the full path of each media file, but we store all the media in a single folder on Google Cloud Storage (given by each media storage_key). As such, typical file operations, such as move and rename, are just a matter of changing the media full_path and the file_name accordingly:

iex> Storage.list_all_media         |> Enum.map(fn m -> %{user_id: m.user_id,                               file_name: m.file_name,                               path: m.full_path, storage_key: m.storage_key} ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.