api specs

This commit is contained in:
2026-04-29 00:45:48 +04:00
parent 27143319e3
commit 8cda54548f
67 changed files with 5052 additions and 93 deletions

View File

@@ -0,0 +1,49 @@
defmodule ShootingEventPhxWeb.Router do
use ShootingEventPhxWeb, :router
pipeline :api_json do
plug :accepts, ["json"]
end
pipeline :frontend do
end
pipeline :admin_api do
plug ShootingEventPhxWeb.Plugs.AdminOnly
end
scope "/api", ShootingEventPhxWeb do
get "/events", EventsController, :stream
end
scope "/api", ShootingEventPhxWeb do
pipe_through :api_json
get "/health", ApiController, :health
get "/state", ApiController, :state
post "/admin/login", ApiController, :admin_login
scope "/admin" do
pipe_through :admin_api
post "/logout", ApiController, :admin_logout
get "/state", ApiController, :admin_state
put "/settings", ApiController, :update_settings
post "/players", ApiController, :create_player
post "/players/auto-group", ApiController, :auto_group_players
put "/players/:id", ApiController, :update_player
delete "/players/:id", ApiController, :delete_player
put "/scores/:stage/:id", ApiController, :update_score
put "/scores/:stage/:id/proof", ApiController, :update_score_proof
delete "/scores/:stage/:id/proof", ApiController, :delete_score_proof
post "/scores/:stage/:id/advice", ApiController, :score_advice
post "/scores/:stage/reset", ApiController, :reset_stage
end
end
scope "/", ShootingEventPhxWeb do
pipe_through :frontend
match :*, "/*path", FrontendController, :serve
end
end