Skip to content

Commit

Permalink
refactor: remove api versioning (#348)
Browse files Browse the repository at this point in the history
* Remove v1 from API endpoints
  • Loading branch information
joaodiaslobo authored Nov 4, 2023
1 parent 1853cfc commit dad48ff
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion lib/safira_web/cors.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ defmodule SafiraWeb.CORS do
max_age: 600

resource("/*")
resource("/api/v1/referrals/*", origins: "*")
resource("/api/referrals/*", origins: "*")
end
68 changes: 33 additions & 35 deletions lib/safira_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dad48ff

Please sign in to comment.