All checks were successful
Build and Publish / build-release (push) Successful in 2m13s
41 lines
1.3 KiB
Elixir
41 lines
1.3 KiB
Elixir
defmodule CustomerServiceWeb.Router do
|
|
use CustomerServiceWeb, :router
|
|
alias CustomerServiceWeb.{CustomerController, LeadController}
|
|
|
|
pipeline :api do
|
|
plug :accepts, ["json"]
|
|
plug OpenApiSpex.Plug.PutApiSpec, module: CustomerServiceWeb.ApiSpec
|
|
end
|
|
|
|
get("/health", CustomerServiceWeb.HealthController, :health)
|
|
get("/health/ready", CustomerServiceWeb.HealthController, :ready)
|
|
|
|
scope "/api" do
|
|
pipe_through :api
|
|
|
|
get "/openapi", OpenApiSpex.Plug.RenderSpec, []
|
|
|
|
scope "/v1" do
|
|
post "/customers", CustomerController, :create
|
|
post "/customers/individual", CustomerController, :create
|
|
post "/customers/corporate", CustomerController, :create_corporate
|
|
get "/customers", CustomerController, :index
|
|
get "/customers/:id", CustomerController, :show
|
|
put "/customers/individual/:id", CustomerController, :update
|
|
put "/customers/corporate/:id", CustomerController, :update_corporate
|
|
|
|
post "/leads", LeadController, :create
|
|
get "/leads", LeadController, :index
|
|
get "/leads/:id", LeadController, :show
|
|
put "/leads/:id", LeadController, :update
|
|
put "/leads/:id/status", LeadController, :update_status
|
|
end
|
|
end
|
|
|
|
if Mix.env() == :dev do
|
|
scope "/swaggerui" do
|
|
get "/", OpenApiSpex.Plug.SwaggerUI, path: "/api/openapi"
|
|
end
|
|
end
|
|
end
|