Skip to content

Commit

Permalink
Fix formating
Browse files Browse the repository at this point in the history
  • Loading branch information
Rados13 committed May 27, 2024
1 parent 6ff2b2b commit 3d5a6b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 2 additions & 0 deletions lib/fishjam/room_service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ defmodule Fishjam.RoomService do
{:reply, {:ok, room, Fishjam.address()}, state}
else
{:error, :room_already_exists} = error ->
Logger.warning("Room creation failed, because it already exists")

{:reply, error, state}

reason ->
Expand Down
3 changes: 1 addition & 2 deletions lib/fishjam_web/controllers/fallback_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ defmodule FishjamWeb.FallbackController do
require Logger

def call(conn, {:error, status, reason}) do
# TODO FIXME
Logger.warning("Generic error handler status: #{status}, reason: #{reason}")
Logger.debug("Generic error handler status: #{status}, reason: #{reason}")

conn
|> put_resp_content_type("application/json")
Expand Down
12 changes: 6 additions & 6 deletions lib/fishjam_web/controllers/peer_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ defmodule FishjamWeb.PeerController do
alias FishjamWeb.PeerToken
alias OpenApiSpex.{Response, Schema}

action_fallback(FishjamWeb.FallbackController)
action_fallback FishjamWeb.FallbackController

tags([:room])
tags [:room]

security(%{"authorization" => []})

operation(:create,
operation :create,
operation_id: "add_peer",
summary: "Create peer",
parameters: [
Expand All @@ -43,9 +43,9 @@ defmodule FishjamWeb.PeerController do
service_unavailable: ApiSpec.error("Peer limit has been reached"),
unauthorized: ApiSpec.error("Unauthorized")
]
)

operation(:delete,

operation :delete,
operation_id: "delete_peer",
summary: "Delete peer",
parameters: [
Expand All @@ -65,7 +65,7 @@ defmodule FishjamWeb.PeerController do
not_found: ApiSpec.error("Room ID or Peer ID references a resource that doesn't exist"),
unauthorized: ApiSpec.error("Unauthorized")
]
)


def create(conn, %{"room_id" => room_id} = params) do
Logger.debug("Start adding peer in room: #{room_id}")
Expand Down
16 changes: 6 additions & 10 deletions lib/fishjam_web/controllers/room_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ defmodule FishjamWeb.RoomController do
alias FishjamWeb.ApiSpec
alias OpenApiSpex.Response

action_fallback(FishjamWeb.FallbackController)
action_fallback FishjamWeb.FallbackController

tags([:room])
tags [:room]

security(%{"authorization" => []})

operation(:index,
operation :index,
operation_id: "get_all_rooms",
summary: "Show information about all rooms",
responses: [
ok: ApiSpec.data("Success", ApiSpec.RoomsListingResponse),
unauthorized: ApiSpec.error("Unauthorized")
]
)

operation(:create,
operation :create,
operation_id: "create_room",
summary: "Creates a room",
request_body: {"Room configuration", "application/json", ApiSpec.Room.Config},
Expand All @@ -32,9 +31,8 @@ defmodule FishjamWeb.RoomController do
bad_request: ApiSpec.error("Invalid request structure"),
unauthorized: ApiSpec.error("Unauthorized")
]
)

operation(:show,
operation :show,
operation_id: "get_room",
summary: "Shows information about the room",
parameters: [
Expand All @@ -49,9 +47,8 @@ defmodule FishjamWeb.RoomController do
not_found: ApiSpec.error("Room doesn't exist"),
unauthorized: ApiSpec.error("Unauthorized")
]
)

operation(:delete,
operation :delete,
operation_id: "delete_room",
summary: "Delete the room",
parameters: [
Expand All @@ -66,7 +63,6 @@ defmodule FishjamWeb.RoomController do
not_found: ApiSpec.error("Room doesn't exist"),
unauthorized: ApiSpec.error("Unauthorized")
]
)

def index(conn, _params) do
rooms =
Expand Down

0 comments on commit 3d5a6b6

Please sign in to comment.