diff --git a/config/runtime.exs b/config/runtime.exs index a63e76c..220f5c6 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -92,8 +92,8 @@ end config :streamshore, Streamshore.Guardian, secret_key: guardian_secret config :streamshore, - :mailer_enabled, - not is_nil(email_key) and not is_nil(email_address) + :mailer_enabled, + not is_nil(email_key) and not is_nil(email_address) config :streamshore, :mailer_from_address, email_address diff --git a/lib/streamshore/accounts/favorites.ex b/lib/streamshore/accounts/favorites.ex index 9fdcde5..5fa2323 100644 --- a/lib/streamshore/accounts/favorites.ex +++ b/lib/streamshore/accounts/favorites.ex @@ -11,6 +11,9 @@ defmodule Streamshore.Favorites do favorite |> cast(params, [:user, :room]) |> validate_required([:user, :room]) - |> unique_constraint(:room, name: :favorites_user_room_index, message: "Room is already a favorite room") + |> unique_constraint(:room, + name: :favorites_user_room_index, + message: "Room is already a favorite room" + ) end end diff --git a/lib/streamshore/accounts/playlist.ex b/lib/streamshore/accounts/playlist.ex index f4ba989..3edae6f 100644 --- a/lib/streamshore/accounts/playlist.ex +++ b/lib/streamshore/accounts/playlist.ex @@ -11,6 +11,9 @@ defmodule Streamshore.Playlist do playlist |> cast(params, [:name, :owner]) |> validate_required([:name, :owner]) - |> unique_constraint(:name, name: :playlists_owner_name_index, message: "Playlist already exists") + |> unique_constraint(:name, + name: :playlists_owner_name_index, + message: "Playlist already exists" + ) end end diff --git a/lib/streamshore/accounts/playlist_video.ex b/lib/streamshore/accounts/playlist_video.ex index 98be5b0..2e041cc 100644 --- a/lib/streamshore/accounts/playlist_video.ex +++ b/lib/streamshore/accounts/playlist_video.ex @@ -12,6 +12,9 @@ defmodule Streamshore.PlaylistVideo do playlist_video |> cast(params, [:name, :owner, :video]) |> validate_required([:name, :owner, :video]) - |> unique_constraint(:video, name: :playlist_video_owner_name_video_index, message: "Video is already in playlist") + |> unique_constraint(:video, + name: :playlist_video_owner_name_video_index, + message: "Video is already in playlist" + ) end end diff --git a/lib/streamshore/queue_manager.ex b/lib/streamshore/queue_manager.ex index ecf2053..42cf868 100644 --- a/lib/streamshore/queue_manager.ex +++ b/lib/streamshore/queue_manager.ex @@ -57,7 +57,8 @@ defmodule Streamshore.QueueManager do {:error, error} -> {:error, :invalid_video, error} end else - {:error, :queue_limit, "You already have the maximum allowed amount of videos in the queue."} + {:error, :queue_limit, + "You already have the maximum allowed amount of videos in the queue."} end end diff --git a/lib/streamshore/videofetcher/videofetcher.ex b/lib/streamshore/videofetcher/videofetcher.ex index 6788306..0af3946 100644 --- a/lib/streamshore/videofetcher/videofetcher.ex +++ b/lib/streamshore/videofetcher/videofetcher.ex @@ -7,5 +7,6 @@ defmodule Streamshore.VideoFetcher do impl().fetch_video(id) end - defp impl, do: Application.get_env(:streamshore, :video_fetcher, Streamshore.VideoFetcher.Client) + defp impl, + do: Application.get_env(:streamshore, :video_fetcher, Streamshore.VideoFetcher.Client) end diff --git a/lib/streamshore_web/controllers/favorite_controller.ex b/lib/streamshore_web/controllers/favorite_controller.ex index 383b50d..3b759aa 100644 --- a/lib/streamshore_web/controllers/favorite_controller.ex +++ b/lib/streamshore_web/controllers/favorite_controller.ex @@ -57,7 +57,11 @@ defmodule StreamshoreWeb.FavoriteController do cond do anon -> - ApiResponses.error(conn, :forbidden, "You must be logged in to add a room to favorites") + ApiResponses.error( + conn, + :forbidden, + "You must be logged in to add a room to favorites" + ) current_user != user -> ApiResponses.error(conn, :forbidden, "Insufficient permission") @@ -90,7 +94,11 @@ defmodule StreamshoreWeb.FavoriteController do cond do anon -> - ApiResponses.error(conn, :forbidden, "You must be logged in to remove a room from favorites") + ApiResponses.error( + conn, + :forbidden, + "You must be logged in to remove a room from favorites" + ) current_user != user -> ApiResponses.error(conn, :forbidden, "Insufficient permission") diff --git a/lib/streamshore_web/controllers/friend_controller.ex b/lib/streamshore_web/controllers/friend_controller.ex index c175e9a..6851997 100644 --- a/lib/streamshore_web/controllers/friend_controller.ex +++ b/lib/streamshore_web/controllers/friend_controller.ex @@ -103,13 +103,13 @@ defmodule StreamshoreWeb.FriendController do accepted: 1 }) - case Repo.insert(changeset) do - {:ok, _schema} -> - ApiResponses.ok(conn) + case Repo.insert(changeset) do + {:ok, _schema} -> + ApiResponses.ok(conn) - {:error, changeset} -> - ApiResponses.changeset_error(conn, changeset) - end + {:error, changeset} -> + ApiResponses.changeset_error(conn, changeset) + end else case Repo.delete(relation) do {:ok, _schema} -> diff --git a/lib/streamshore_web/controllers/playlist_video_controller.ex b/lib/streamshore_web/controllers/playlist_video_controller.ex index 5d88df1..1fea368 100644 --- a/lib/streamshore_web/controllers/playlist_video_controller.ex +++ b/lib/streamshore_web/controllers/playlist_video_controller.ex @@ -51,7 +51,11 @@ defmodule StreamshoreWeb.PlaylistVideoController do cond do anon -> - ApiResponses.error(conn, :forbidden, "You must be logged in to add a video to a playlist") + ApiResponses.error( + conn, + :forbidden, + "You must be logged in to add a video to a playlist" + ) user != owner -> ApiResponses.error(conn, :forbidden, "Insufficient permission") @@ -100,7 +104,11 @@ defmodule StreamshoreWeb.PlaylistVideoController do cond do anon -> - ApiResponses.error(conn, :forbidden, "You must be logged in to delete a video from a playlist") + ApiResponses.error( + conn, + :forbidden, + "You must be logged in to delete a video from a playlist" + ) user != owner -> ApiResponses.error(conn, :forbidden, "Insufficient permission") diff --git a/lib/streamshore_web/controllers/session_controller.ex b/lib/streamshore_web/controllers/session_controller.ex index ef90aef..4ff191f 100644 --- a/lib/streamshore_web/controllers/session_controller.ex +++ b/lib/streamshore_web/controllers/session_controller.ex @@ -32,7 +32,11 @@ defmodule StreamshoreWeb.SessionController do String.capitalize(String.trim(random_adjective(), "\r")) <> String.capitalize(String.trim(random_animal(), "\r")) - ApiResponses.ok(conn, %{token: AuthTokens.create_token(username, true), user: username, anon: true}) + ApiResponses.ok(conn, %{ + token: AuthTokens.create_token(username, true), + user: username, + anon: true + }) end end diff --git a/priv/repo/migrations/20200223000712_create_users.exs b/priv/repo/migrations/20200223000712_create_users.exs index 7fd12b6..8ea9880 100644 --- a/priv/repo/migrations/20200223000712_create_users.exs +++ b/priv/repo/migrations/20200223000712_create_users.exs @@ -2,16 +2,16 @@ defmodule Streamshore.Repo.Migrations.CreateUsers do use Ecto.Migration def change do - create table(:users) do - add(:username, :string) - add(:email, :string) - add(:password, :string) - add(:room, :string) - add(:admin, :integer) - add(:verify_token, :text) - add(:reset_token, :text) + create table(:users) do + add(:username, :string) + add(:email, :string) + add(:password, :string) + add(:room, :string) + add(:admin, :integer) + add(:verify_token, :text) + add(:reset_token, :text) - timestamps() + timestamps() end create(unique_index(:users, [:username])) diff --git a/priv/repo/migrations/20200322033632_friends.exs b/priv/repo/migrations/20200322033632_friends.exs index 997962c..95752ce 100644 --- a/priv/repo/migrations/20200322033632_friends.exs +++ b/priv/repo/migrations/20200322033632_friends.exs @@ -2,12 +2,11 @@ defmodule Streamshore.Repo.Migrations.Friends do use Ecto.Migration def change do - create table(:friends) do + create table(:friends) do add(:friender, :string) add(:friendee, :string) add(:nickname, :string) add(:accepted, :integer) end - end end diff --git a/priv/repo/migrations/20200411231202_add_playlist.exs b/priv/repo/migrations/20200411231202_add_playlist.exs index c705c70..b261424 100644 --- a/priv/repo/migrations/20200411231202_add_playlist.exs +++ b/priv/repo/migrations/20200411231202_add_playlist.exs @@ -2,10 +2,9 @@ defmodule Streamshore.Repo.Migrations.AddPlaylist do use Ecto.Migration def change do - create table(:playlists) do + create table(:playlists) do add(:name, :string) add(:owner, :string) end - end end diff --git a/priv/repo/migrations/20200411231215_add_playlist_video.exs b/priv/repo/migrations/20200411231215_add_playlist_video.exs index adc1f79..18d5bb1 100644 --- a/priv/repo/migrations/20200411231215_add_playlist_video.exs +++ b/priv/repo/migrations/20200411231215_add_playlist_video.exs @@ -2,11 +2,10 @@ defmodule Streamshore.Repo.Migrations.AddPlaylistVideo do use Ecto.Migration def change do - create table(:playlist_video) do + create table(:playlist_video) do add(:name, :string) add(:owner, :string) add(:video, :string) end - end end diff --git a/priv/repo/migrations/20200412192058_favorites.exs b/priv/repo/migrations/20200412192058_favorites.exs index 8ac05da..e0d0760 100644 --- a/priv/repo/migrations/20200412192058_favorites.exs +++ b/priv/repo/migrations/20200412192058_favorites.exs @@ -2,10 +2,9 @@ defmodule Streamshore.Repo.Migrations.Favorites do use Ecto.Migration def change do - create table(:favorites) do + create table(:favorites) do add(:user, :string) add(:room, :string) end - end end