From 85e41497e4459c4191443b4919a8798c8be14257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lobo?= Date: Sat, 4 Nov 2023 18:59:11 +0000 Subject: [PATCH 1/2] Remove v1 from API endpoints --- lib/safira_web/router.ex | 68 +++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/lib/safira_web/router.ex b/lib/safira_web/router.ex index ee9fe9a3..92582053 100644 --- a/lib/safira_web/router.ex +++ b/lib/safira_web/router.ex @@ -43,41 +43,39 @@ defmodule SafiraWeb.Router do resources "/passwords", PasswordController, only: [:create, :update] end - scope "/v1" do - get "/is_registered/:id", AuthController, :is_registered - - pipe_through :jwt_authenticated - - get "/user", AuthController, :user - get "/attendee", AuthController, :attendee - get "/company", AuthController, :company - get "/leaderboard", LeaderboardController, :index - get "/leaderboard/:date", LeaderboardController, :daily - get "/roulette/latestwins", RouletteController, :latest_wins - get "/store/redeem/:id", DeliverRedeemableController, :show - get "/roulette/redeem/:id", DeliverPrizeController, :show - - post "/roulette", RouletteController, :spin - post "/give_bonus/:id", BonusController, :give_bonus - post "/spotlight", SpotlightController, :create - post "/store/redeem", DeliverRedeemableController, :create - post "/roulette/redeem", DeliverPrizeController, :create - - delete "/roulette/redeem/:badge_id/:user_id", DeliverPrizeController, :delete - - resources "/badges", BadgeController, only: [:index, :show] - resources "/attendees", AttendeeController, except: [:create] - resources "/referrals", ReferralController, only: [:create] - resources "/companies", CompanyController, only: [:index, :show] - resources "/redeems", RedeemController, only: [:create] - resources "/store", RedeemableController, only: [:index, :show] - resources "/association", DiscordAssociationController, only: [:show, :create] - resources "/store/buy", BuyController, only: [:create] - resources "/roulette/prizes", PrizeController, only: [:index, :show] - - get "/company/attendees/:id", CompanyController, :company_attendees - get "/company/attendees/cvs/:id", CVController, :company_cvs - end + get "/is_registered/:id", AuthController, :is_registered + + pipe_through :jwt_authenticated + + get "/user", AuthController, :user + get "/attendee", AuthController, :attendee + get "/company", AuthController, :company + get "/leaderboard", LeaderboardController, :index + get "/leaderboard/:date", LeaderboardController, :daily + get "/roulette/latestwins", RouletteController, :latest_wins + get "/store/redeem/:id", DeliverRedeemableController, :show + get "/roulette/redeem/:id", DeliverPrizeController, :show + + post "/roulette", RouletteController, :spin + post "/give_bonus/:id", BonusController, :give_bonus + post "/spotlight", SpotlightController, :create + post "/store/redeem", DeliverRedeemableController, :create + post "/roulette/redeem", DeliverPrizeController, :create + + delete "/roulette/redeem/:badge_id/:user_id", DeliverPrizeController, :delete + + resources "/badges", BadgeController, only: [:index, :show] + resources "/attendees", AttendeeController, except: [:create] + resources "/referrals", ReferralController, only: [:create] + resources "/companies", CompanyController, only: [:index, :show] + resources "/redeems", RedeemController, only: [:create] + resources "/store", RedeemableController, only: [:index, :show] + resources "/association", DiscordAssociationController, only: [:show, :create] + resources "/store/buy", BuyController, only: [:create] + resources "/roulette/prizes", PrizeController, only: [:index, :show] + + get "/company/attendees/:id", CompanyController, :company_attendees + get "/company/attendees/cvs/:id", CVController, :company_cvs end scope "/" do From 315b252feb56a39baa191b6f838633c2c538dd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lobo?= Date: Sat, 4 Nov 2023 19:57:25 +0000 Subject: [PATCH 2/2] Remove v1 from API endpoint on CORS config --- lib/safira_web/cors.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/safira_web/cors.ex b/lib/safira_web/cors.ex index f4e3a976..f92b4937 100644 --- a/lib/safira_web/cors.ex +++ b/lib/safira_web/cors.ex @@ -10,5 +10,5 @@ defmodule SafiraWeb.CORS do max_age: 600 resource("/*") - resource("/api/v1/referrals/*", origins: "*") + resource("/api/referrals/*", origins: "*") end