diff options
author | Pierre de Lacroix <pierre@pdelacroix.com> | 2020-09-14 05:52:22 +0200 |
---|---|---|
committer | Pierre de Lacroix <pierre@pdelacroix.com> | 2020-09-14 05:52:22 +0200 |
commit | 8353040a0c29289395f6a8cf0477a5d497a4e609 (patch) | |
tree | c051a34b3ff0c5184655874851a3e1c9cd4c6509 | |
parent | adapt to recent polyjuice changes (diff) |
rename adapters
3 files changed, 15 insertions, 8 deletions
diff --git a/lib/matrix_app_service_web/controllers/v1/room_controller.ex b/lib/matrix_app_service_web/controllers/v1/room_controller.ex index 17cbac0..b236dd2 100644 --- a/lib/matrix_app_service_web/controllers/v1/room_controller.ex +++ b/lib/matrix_app_service_web/controllers/v1/room_controller.ex @@ -2,9 +2,9 @@ defmodule MatrixAppServiceWeb.V1.RoomController do use MatrixAppServiceWeb, :controller def show(conn, %{"room_alias" => room_alias}) do - module = Application.fetch_env!(:matrix_app_service, :room_module) + adapter = Application.fetch_env!(:matrix_app_service, :room_adapter) - with :ok <- module.query_alias(room_alias) do + with :ok <- adapter.query_alias(room_alias) do send_resp(conn, 200, "{}") else _ -> diff --git a/lib/matrix_app_service_web/controllers/v1/transaction_controller.ex b/lib/matrix_app_service_web/controllers/v1/transaction_controller.ex index bbb0293..c2a47e3 100644 --- a/lib/matrix_app_service_web/controllers/v1/transaction_controller.ex +++ b/lib/matrix_app_service_web/controllers/v1/transaction_controller.ex @@ -28,7 +28,7 @@ defmodule MatrixAppServiceWeb.V1.TransactionController do "unsigned" => unsigned, "user_id" => user_id }) do - module = Application.fetch_env!(:matrix_app_service, :transaction_module) + adapter = Application.fetch_env!(:matrix_app_service, :transaction_adapter) event = %MatrixAppService.Event{ age: age, @@ -43,7 +43,7 @@ defmodule MatrixAppServiceWeb.V1.TransactionController do user_id: user_id } - module.new_event(event) + adapter.new_event(event) end defp create_event(%{ @@ -57,7 +57,7 @@ defmodule MatrixAppServiceWeb.V1.TransactionController do "unsigned" => unsigned, "user_id" => user_id }) do - module = Application.fetch_env!(:matrix_app_service, :transaction_module) + adapter = Application.fetch_env!(:matrix_app_service, :transaction_adapter) event = %MatrixAppService.Event{ age: age, @@ -72,7 +72,7 @@ defmodule MatrixAppServiceWeb.V1.TransactionController do user_id: user_id } - module.new_event(event) + adapter.new_event(event) end def create(conn, %{"events" => events}) do diff --git a/lib/matrix_app_service_web/controllers/v1/user_controller.ex b/lib/matrix_app_service_web/controllers/v1/user_controller.ex index 31301d2..2f73ad7 100644 --- a/lib/matrix_app_service_web/controllers/v1/user_controller.ex +++ b/lib/matrix_app_service_web/controllers/v1/user_controller.ex @@ -1,7 +1,14 @@ defmodule MatrixAppServiceWeb.V1.UserController do use MatrixAppServiceWeb, :controller - def show(conn, _params) do - send_resp(conn, 404, "") + def show(conn, %{"user_id" => user_id}) do + adapter = Application.fetch_env!(:matrix_app_service, :user_adapter) + + with :ok <- adapter.query_user(user_id) do + send_resp(conn, 200, "{}") + else + _ -> + send_resp(conn, 404, "") + end end end |