From 50ce8cb96b2b218751c2fc2a6b19372f51846acc Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Mon, 14 Jul 2025 19:34:59 +0300 Subject: feat: rewrite in rust --- .../controllers/location_controller.ex | 46 ---------------------- 1 file changed, 46 deletions(-) delete mode 100644 lib/silmataivas_web/controllers/location_controller.ex (limited to 'lib/silmataivas_web/controllers/location_controller.ex') diff --git a/lib/silmataivas_web/controllers/location_controller.ex b/lib/silmataivas_web/controllers/location_controller.ex deleted file mode 100644 index d494d59..0000000 --- a/lib/silmataivas_web/controllers/location_controller.ex +++ /dev/null @@ -1,46 +0,0 @@ -defmodule SilmataivasWeb.LocationController do - use SilmataivasWeb, :controller - - alias Silmataivas.Locations - alias Silmataivas.Locations.Location - - action_fallback SilmataivasWeb.FallbackController - - def index(conn, _params) do - locations = Locations.list_locations() - render(conn, :index, locations: locations) - end - - def create(conn, params) do - user = conn.assigns.current_user - params = Map.put(params, "user_id", user.id) - - with {:ok, %Location{} = location} <- Locations.create_location(params) do - conn - |> put_status(:created) - |> put_resp_header("location", ~p"/api/locations/#{location}") - |> render(:show, location: location) - end - end - - def show(conn, %{"id" => id}) do - location = Locations.get_location!(id) - render(conn, :show, location: location) - end - - def update(conn, %{"id" => id, "location" => location_params}) do - location = Locations.get_location!(id) - - with {:ok, %Location{} = location} <- Locations.update_location(location, location_params) do - render(conn, :show, location: location) - end - end - - def delete(conn, %{"id" => id}) do - location = Locations.get_location!(id) - - with {:ok, %Location{}} <- Locations.delete_location(location) do - send_resp(conn, :no_content, "") - end - end -end -- cgit v1.2.3