From 0ec82319ef51123def915a1b97f7cdeeef4adb47 Mon Sep 17 00:00:00 2001 From: LucasLvy Date: Mon, 14 Oct 2024 10:53:48 +0200 Subject: [PATCH] update endpoints to patch --- backend/lib/peach_web/router.ex | 10 +++++----- .../test/peach_web/controllers/update_event_test.exs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/lib/peach_web/router.ex b/backend/lib/peach_web/router.ex index 0164bb9..4926cae 100644 --- a/backend/lib/peach_web/router.ex +++ b/backend/lib/peach_web/router.ex @@ -8,11 +8,11 @@ defmodule PeachWeb.Router do scope "/api", PeachWeb do pipe_through(:api) post "/events/create", EventController, :create - put "/events/:id/name", EventController, :update_event_name - put "/events/:id/description", EventController, :update_event_description - put "/events/:id/location", EventController, :update_event_location - put "/events/:id/cover", EventController, :update_event_cover - put "/events/:id/treasury", EventController, :update_event_treasury + patch "/events/:id/name", EventController, :update_event_name + patch "/events/:id/description", EventController, :update_event_description + patch "/events/:id/location", EventController, :update_event_location + patch "/events/:id/cover", EventController, :update_event_cover + patch "/events/:id/treasury", EventController, :update_event_treasury end # Enable LiveDashboard and Swoosh mailbox preview in development diff --git a/backend/test/peach_web/controllers/update_event_test.exs b/backend/test/peach_web/controllers/update_event_test.exs index a3ef93d..f447264 100644 --- a/backend/test/peach_web/controllers/update_event_test.exs +++ b/backend/test/peach_web/controllers/update_event_test.exs @@ -34,7 +34,7 @@ defmodule PeachWeb.EventUpdateControllertest do expected_event = @original_event Enum.reduce(updated_fields, expected_event, fn {field, value}, acc -> - conn = put(conn, "/api/events/1/#{field}", %{"#{field}" => value}) + conn = patch(conn, "/api/events/1/#{field}", %{"#{field}" => value}) acc = Map.replace(acc, String.to_atom(field), value) # Assert response status @@ -62,7 +62,7 @@ defmodule PeachWeb.EventUpdateControllertest do expected_event = @original_event Enum.each(updated_fields, fn {field, value} -> - conn = put(conn, "/api/events/1/#{field}", %{"#{field}" => value}) + conn = patch(conn, "/api/events/1/#{field}", %{"#{field}" => value}) # Assert response status assert conn.status == 400