Scaffold denizen controller

This commit is contained in:
Nat 2023-06-14 10:46:23 -07:00
parent 3d154897a7
commit cdbb6646eb
Signed by: nat
GPG Key ID: B53AB05285D710D6
4 changed files with 43 additions and 0 deletions

View File

@ -46,6 +46,8 @@ defmodule HostasWeb do
import HostasWeb.Gettext import HostasWeb.Gettext
unquote(verified_routes()) unquote(verified_routes())
import HostasWeb.ControllerHelpers
end end
end end

View File

@ -0,0 +1,11 @@
defmodule HostasWeb.ControllerHelpers do
import Plug.Conn
@doc """
Mark an endpoint as unimplemented
"""
def unimplemented(conn) do
conn
|> send_resp(501, "")
end
end

View File

@ -0,0 +1,24 @@
defmodule HostasWeb.DenizenController do
# import Ecto.Query, only: [from: 2]
use HostasWeb, :controller
# alias Hostas.Repo
# alias Hostas.Denizen
# alias Hostas.Token
def open(conn, _params) do
unimplemented(conn)
end
def close(conn, _params) do
unimplemented(conn)
end
def show(conn, _params) do
unimplemented(conn)
end
def update(conn, _params) do
unimplemented(conn)
end
end

View File

@ -35,6 +35,12 @@ defmodule HostasWeb.Router do
get "/auth/token", Auth.TokenController, :verify get "/auth/token", Auth.TokenController, :verify
delete "/auth/token/:id", Auth.TokenController, :revoke delete "/auth/token/:id", Auth.TokenController, :revoke
get "/auth/token/:id/renew", Auth.TokenController, :renew get "/auth/token/:id/renew", Auth.TokenController, :renew
post "/denizen", DenizenController, :open
delete "/denizen/:id", DenizenController, :close
get "/denizen/:id", DenizenController, :show
patch "/denizen/:id", DenizenController, :update
end end
# Enable LiveDashboard and Swoosh mailbox preview in development # Enable LiveDashboard and Swoosh mailbox preview in development